typespec-enums

Automate TypeSpec enum creation and emission across C#, Java, TypeScript, Go, and Rust.

1|Updated Mar 15, 2026
One-click install
npx skills add https://github.com/hafley66/claude-research --skill typespec-enums
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typespec-enums
Source: https://github.com/hafley66/claude-research/tree/main/skills/typespec-enums
Command: npx skills add https://github.com/hafley66/claude-research --skill typespec-enums

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill automates the creation and cross-language emission of TypeSpec enums, eliminating manual boilerplate and ensuring consistent enum behavior across targets.

Core Features & Use Cases

  • Enum declarations with members and values (auto, explicit, string, numeric).
  • Enum-to-union conversions for stricter typing and flexible usage.
  • Support for common decorators like @doc, @summary, @fixed, @flags.
  • Multi-language emission: C#, Java, TypeScript, Go, Rust, and additional targets.
  • Replication of legacy codegen enum patterns and extension scenarios.
  • Use cases include API schema definitions, code generation pipelines, and ensuring consistent enum metadata across languages.

Quick Start

Define an enum with a mix of member value types, then emit corresponding enums to multiple languages.

Frequently Asked Questions about typespec-enums

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

FAQPage Schema
How do I generate TypeSpec enums across multiple programming languages?

TypeSpec enum emission across C#, Java, TypeScript, Go, and Rust is automated by defining enum declarations with member values and decorators, which the skill then emits as consistent cross-language enum representations.

Can I convert TypeSpec enums to unions for stricter typing?

Yes, you can convert TypeSpec enums to unions for stricter typing. The skill handles enum-to-union conversions to provide flexible usage and stricter type representations across your API schema definitions.

What decorators are supported when defining TypeSpec enums?

Supported decorators when defining TypeSpec enums include @doc, @summary, @fixed, and @flags. These decorators allow you to attach metadata and control enum behavior during the multi-language emission process.

Does TypeSpec support mixed value types for enum members in code generation?

TypeSpec supports mixed value types for enum members in code generation. You can define enums with auto, explicit, string, and numeric member values, ensuring consistent metadata across all emitted target languages.

What is the best way to replicate legacy codegen enum patterns using TypeSpec?

The best way to replicate legacy codegen enum patterns using TypeSpec is by utilizing this skill's extension scenarios, which automate the creation of enum declarations and emit consistent representations matching your existing codebase.

When should I use TypeSpec unions instead of enums for API schemas?

You should use TypeSpec unions instead of enums when you need stricter typing and flexible usage beyond fixed member values. This skill facilitates enum-to-union conversions to satisfy these advanced API schema requirements.