go-create-enum

Generate type-safe Go enums with validation and a String method.

Updated Jan 4, 2026
One-click install
npx skills add https://github.com/cristiano-pacheco/ai-rules --skill go-create-enum
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: go-create-enum
Source: https://github.com/cristiano-pacheco/ai-rules/tree/main/skills/go-create-enum
Command: npx skills add https://github.com/cristiano-pacheco/ai-rules --skill go-create-enum

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Go projects often need type-safe enums with strict validation, a reusable constructor, and a consistent String method across modules. This skill standardizes a maintainable enum pattern to reduce boilerplate and ensure correctness in internal/modules/<module>/enum/.

Core Features & Use Cases

  • Generated file structure: internal/modules/<module>/enum/<name>_enum.go containing constants, a validation map, an enum type, a constructor, a String method, and a private validator.
  • Validation integration: uses a central errs package to surface invalid values with clear errors.
  • Reusability and consistency: enforces a uniform enum pattern across different modules and services.

Quick Start

Provide the enum name and its value list; the tool will generate a complete, validated Go enum in internal/modules/<module>/enum.

Frequently Asked Questions about go-create-enum

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

FAQPage Schema
How do I create type-safe Go enums with validation?▼

Go enum validation works by using a private validation function and a validation map to check values. Invalid values trigger errors surfaced through a central errs package, ensuring strict correctness across internal modules.

What's the best way to standardize Go enum patterns across multiple modules?▼

The best way to standardize Go enum patterns is generating files in a dedicated internal/modules/<module>/enum/ directory. This enforces consistent constructors, String methods, and validation integration across different services.

How do I generate a Go enum constructor and String method?▼

You generate a Go enum constructor and String method by providing an enum name and value list. The output file includes a New<Name>Enum constructor and a String() method alongside the constants and validation map.

Does generating Go enums with a validation map require external dependencies?▼

Generating Go enums with a validation map requires no external dependencies. It relies on a central errs package within your project to surface invalid values clearly during the private validation process.

When do I need a generated Go enum file in internal/modules?▼

You need a generated Go enum file in internal/modules when your project requires strict type safety, reusable constructors, and consistent String methods across different modules. This reduces boilerplate and ensures validation correctness.