enum

Creates domain enums in TypeScript and Go with language-specific conventions and registries.

4|Updated Jul 30, 2026
One-click install
npx skills add https://github.com/gabriellst/codm --skill enum-gabriellst
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: enum
Source: https://github.com/gabriellst/codm/tree/main/.claude/skills/enum
Command: npx skills add https://github.com/gabriellst/codm --skill enum-gabriellst

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Defining fixed sets of domain values (statuses, types, categories) consistently across a polyglot backend is error-prone: wire values, file layout, validation helpers, and OpenAPI registration all follow strict conventions that are easy to get wrong. This Skill encodes those conventions so enums are created correctly the first time in both the TypeScript daemon and the Go gateway. ## Core Features & Use Cases - Language dispatch hub: Routes to the TypeScript or Go playbook based on file extension (.ts / .go) or a --lang flag, so the right idioms apply per backend. - TypeScript enum playbook: Enforces native enum with SCREAMING_SNAKE_CASE key=value pairs, z.enum() in Zod schemas, barrel exports, central openapi.registerEnums() registration, and i18n-based UI labels under enums.<EnumName>.<VALUE>. - Go enum playbook: Enforces typed string constants, one enum per snake_case file, // Values: doc-comments, IsValid() guards for external input, and typed struct fields instead of plain strings. - Machine-checkable registries: Each language ships a registry.yaml with patterns, bad practices (e.g. z.nativeEnum(), as const arrays, lowercase wire values), and detection regexes used by review tooling. - Use Case: When adding a JobStatus state machine to the Go gateway or an OrderStatus to the TypeScript API, invoke this Skill to scaffold the enum, wire it into entities, repositories, controllers, and locale files following project rules. ## Quick Start Ask the agent to create a new domain enum such as PaymentStatus with values PENDING, PAID, and FAILED in the TypeScript or Go backend, and it will apply the matching language playbook and registry rules.

Frequently Asked Questions about enum

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a domain enum in TypeScript for a status field?

Create a file in the context's enums folder using a native TypeScript enum with SCREAMING_SNAKE_CASE keys and values, export it from the enums index barrel, and reference it in Zod schemas via z.enum(OrderStatus). Register it centrally through openapi.registerEnums() in shared/index.ts.

How do I define an enum in Go without a native enum keyword?

Declare a named string type plus a const block of typed constants, one enum per snake_case file. Add a // Values: doc-comment line for tooling, and an IsValid() method when the value arrives from external input like HTTP bodies or database rows.

Should I use z.enum() or z.nativeEnum() with TypeScript enums?

Always use z.enum() with the TypeScript enum reference, never z.nativeEnum() and never inline string arrays like z.enum(['PENDING']). This generates correct OpenAPI types and ensures the SDK exposes the enum values.

How are enum labels displayed in the React frontend?

Enum labels resolve through i18n under the canonical enums.<EnumName>.<VALUE> namespace in both pt and en locale files. For Select components, pass the translated label as children of SelectValue, since Base UI does not auto-resolve it from SelectItem.

When should I not use this enum skill?

Avoid it for open-ended string fields with no fixed value set, bitmasks or flags where Go iota is more idiomatic, and values already defined in the contracts package, which should be imported from contracts generated bindings instead of re-declared.

Why must enum wire values be SCREAMING_SNAKE_CASE?

The string literal stored in the database and sent over the wire must be uppercase to satisfy DB constraints, OpenAPI enum schemas, and wire compatibility between the TypeScript and Go peers. Lowercase values break cross-language consistency and are flagged as a bad practice.