/frontend-openapi-skills:generate-modelsfrom frontend-openapi-skills
Generate TypeScript interfaces and enums from OpenAPI schemas using aptx-ft CLI. Use when user asks to: (1) generate types/models from OpenAPI/Swagger, (2) create TypeScript interfaces from API schema, (3) extract type definitions from openapi.json, (4) generate selective models with --name filter, (5) preserve translated enum values, (6) track generated files with manifest, (7) preview changes before generation, or (8) update barrel files automatically. Do NOT use for full artifact generation with request layer or Material UI enum adaptation.
Ships in frontend-openapi-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Generate TypeScript interfaces/enums from OpenAPI via aptx-ft.
pnpm add -D @aptx-js/frontend-tk-cli
Before executing any generation command, you MUST discover the actual project configuration.
Find packages directory:
ls -d packages/*/
Identify model package and get its name:
# Find package that likely contains models (domains, models, types, shared, etc.)
cat packages/domains/package.json 2>/dev/null || cat packages/models/package.json 2>/dev/null
Extract the "name" field - this is your --model-path value.
| ❌ NEVER Do This | ✅ ALWAYS Do This |
|---|---|
| Guess package name from project directory | Read package.json to get actual "name" |
Assume @project-name/models | Use the exact value from "name" field |
Infer from packages/domains/ path | Package name ≠ directory name |
# User says: "generate to packages/domains"
$ cat packages/domains/package.json
{ "name": "@repo/domains", ... } ← Package name is @repo/domains
package.json files to get actual package names--preserve is neededALWAYS check if target directory contains existing models before generating:
# Check if output directory has existing model files
ls ./src/models/*.ts 2>/dev/null || echo "empty"
| Directory State | Action |
|---|---|
| Empty or not exists | Generate WITHOUT --preserve |
| Has existing .ts files | Generate WITH --preserve to keep enum translations |
Why: When regenerating models in a non-empty directory, --preserve keeps manually translated enum names while adding new values. Only skip --preserve for fresh generation.
| Type | Output | Command |
|---|---|---|
| Single project | ./src/models | pnpm exec aptx-ft -i ./openapi.json model gen --output ./src/models --style module |
| Monorepo | ./packages/models/src | pnpm exec aptx-ft -i ./openapi.json model gen --output ./packages/models/src --style module |
| Option | Purpose |
|---|---|
--style module | ES modules, individual exports (default, recommended) |
--style declaration | Single declaration file (legacy compatibility) |
--name <Schema> | Generate only specified models (repeatable) |
--preserve | Keep manually translated enum names on regeneration |
The CLI automatically tracks generated files and detects changes between generations.
| Option | Default | Purpose |
|---|---|---|
--no-manifest | false | Disable manifest tracking |
--manifest-dir <path> | .generated | Custom manifest directory |
--dry-run | false | Preview mode: generate report without updating manifest |
When manifest tracking is enabled (default), the following files are generated:
<output>/
├── .generated/
│ ├── manifest.json # Tracks all generated files
│ ├── deletion-report.json # Machine-readable change report
│ └── deletion-report.md # Human-readable change report with LLM suggestions
└── models...
The deletion-report.md includes:
| Scenario | Command |
|---|---|
| Normal generation | Omit manifest options (default) |
| CI/CD without tracking | Add --no-manifest |
| Preview changes before applying | Add --dry-run |
| Custom manifest location | Add --manifest-dir ./meta |
The CLI automatically updates barrel files (index.ts) after generation.
You no longer need to manually run barrel gen after generating models - the model gen command handles this automatically.
<output>/index.ts - Barrel file for the models directoryThe automatic update handles most cases. Use manual barrel gen only when:
Recommended when regenerating models after API updates. Keeps manually translated enum names while adding new values.
Value1 → Success)--preserve → keeps translations, adds new values# First generation
pnpm exec aptx-ft -i ./openapi.json model gen --output ./src/models
# After translating enums, regenerate with preserve
pnpm exec aptx-ft -i ./openapi.json model gen --output ./src/models --preserve
# Check if output directory has existing models first
ls ./src/models/*.ts 2>/dev/null
# First generation (empty directory)
pnpm exec aptx-ft -i ./openapi.json model gen --output ./src/models
# Regeneration (non-empty directory) - use --preserve
pnpm exec aptx-ft -i ./openapi.json model gen --output ./src/models --preserve
# Declaration style
pnpm exec aptx-ft -i ./openapi.json model gen --output ./src/models --style declaration
# Selective generation
pnpm exec aptx-ft -i ./openapi.json model gen --output ./src/models --name User --name Role
# Preview changes without updating manifest
pnpm exec aptx-ft -i ./openapi.json model gen --output ./src/models --dry-run
# Disable manifest tracking (CI/CD)
pnpm exec aptx-ft -i ./openapi.json model gen --output ./src/models --no-manifest
# Custom manifest directory
pnpm exec aptx-ft -i ./openapi.json model gen --output ./src/models --manifest-dir ./meta
# Without pnpm
npx aptx-ft -i ./openapi.json model gen --output ./src/models
TypeScript model files (interface/enum). Does not include request layer code.
This skill generates TypeScript models only:
generate-artifactsadapt-materal-enumsWhat SKILL.md sets; muted values are Claude Code's defaults
7 skills in this plugin
/adapt-materal-enumsMateral-specific enum adaptation workflow: fetch enum values from provider API, let LLM fill suggested_name, then apply patch with aptx-ft. Use ONLY when: (1) user mentions Materal framework, (2) Materal naming rules are required, or (3) adapting Materal enum semantics. Do NOT use for generic OpenAPI projects./download-openapiDownload remote OpenAPI/Swagger JSON specification from a URL to local file using aptx-ft CLI. TRIGGER when user mentions: (1) fetch/pull/download swagger or openapi from URL, (2) save API spec to openapi.json locally, (3) get API documentation from server, or (4) prepare local input for code generation. DO NOT TRIGGER when: generating code/types from local file, reading existing openapi.json, downloading non-OpenAPI files, or authentication is required./Other plugins' skills for the same job
npx claudepluginhub haibaraaiaptx/frontend-openapi-skills --plugin frontend-openapi-skills