goravel-enum

Generate Go enum types and corresponding TypeScript unions from Go source files.

16|11|Updated Jun 12, 2025
One-click install
npx skills add https://github.com/liwoo/goravel-inertia-tw-starter --skill goravel-enum
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: goravel-enum
Source: https://github.com/liwoo/goravel-inertia-tw-starter/tree/main/.claude/skills/goravel-enum
Command: npx skills add https://github.com/liwoo/goravel-inertia-tw-starter --skill goravel-enum

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Create a Go enum type and automatically generate the corresponding TypeScript union, ensuring consistent client-server representations and reducing boilerplate.

Core Features & Use Cases

  • Go to TS: Generates a Go enum type and a TypeScript union with form-friendly options.
  • Naming conventions: Enforces PascalCase type names and uppercase constants aligned with database values.
  • Use Case: Useful when building Go backends with a React/TypeScript frontend, API contracts, and form validation where enum values are shared across domains.

Quick Start

Run the generator to create Go enums and TypeScript unions from your Go source files.

Frequently Asked Questions about goravel-enum

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

FAQPage Schema
How do I generate TypeScript unions from Go enums?

Generating TypeScript unions from Go enums involves using a scriptable generator that reads Go source files and outputs TS types. This ensures consistent client-server representations and reduces manual boilerplate code for shared data models.

How do I keep Go backend and React frontend enum values in sync?

Keeping Go backend and React frontend enum values in sync requires generating a TypeScript union directly from your Go enum type definitions. This cross-language generation ensures API contracts and form validation share identical enum values without manual duplication.

What naming conventions are enforced when generating Go enums and TS unions?

Generating Go enums and TS unions enforces PascalCase type names and uppercase constants aligned with database values. This naming convention standardizes form-friendly options across both backend and frontend codebases automatically.

Can I use this Go to TypeScript enum generation for form validation?

Yes, you can use Go to TypeScript enum generation for form validation. It creates TypeScript unions with form-friendly options, ensuring the frontend validation logic strictly matches the Go backend's allowed enum values for API contracts.

What is the best way to share API contract enum definitions between Go and TypeScript?

The best way to share API contract enum definitions is using a code generation script that automatically produces a TypeScript union from your Go enum type. This eliminates manual synchronization errors and ensures cross-language consistency.