go-enum

Generate type-safe Go enums with validation using the bricks/pkg/errs package.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the creation of type-safe enumerations in Go, ensuring data integrity and reducing runtime errors by enforcing valid enum values.

Core Features & Use Cases

  • Type Safety: Define enums as distinct types, preventing the use of arbitrary strings.
  • Built-in Validation: Automatically validates input strings against predefined enum values.
  • Use Case: When defining user roles (e.g., 'admin', 'editor', 'viewer') or status codes (e.g., 'pending', 'processing', 'completed'), this skill ensures only valid options are used, preventing bugs.

Quick Start

Generate a new Go enum for the 'monitor' module with values 'email' and 'webhook' named 'ContactType'.

Frequently Asked Questions about go-enum

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

FAQPage Schema
How do I generate type-safe enums in Go with validation?

Type-safe enums in Go with validation are generated as distinct types, preventing arbitrary strings and automatically validating input strings against predefined enum values to ensure data integrity.

What is the best way to define domain constants and validated enum types in a Go module?

Validated enum types in a Go module are defined as distinct types using modular architecture conventions, requiring specific file placement, naming patterns, and error definitions via the bricks/pkg/errs package.

When do I need string-based enumerations for Go domain modeling?

String-based enumerations for Go domain modeling are needed when defining user roles like admin or viewer, or status codes like pending or completed, ensuring only valid options are used to prevent runtime bugs.

Does this Go enum generation approach work with modular architecture conventions?

This Go enum generation approach works with modular architecture conventions by enforcing specific file placement, naming patterns, and error definition structures using the bricks/pkg/errs package for validated domain constants.

Can I use type-safe Go enums to prevent invalid user roles and status codes?

Type-safe Go enums prevent invalid user roles and status codes by defining enumerations as distinct types and automatically validating input strings against predefined valid values, reducing runtime errors.