Skip to main content
skill

openapi-to-typescript — Claude Code skill: type generation

This skill turns an OpenAPI 3.0 file into TypeScript interfaces and type guards. Use it when API schemas need corresponding types in your codebase.

Install into Claude Code · claude-code-templates All methods and platforms ↓
npx claude-code-templates@latest --skill development/openapi-to-typescript
Open on GitHub

What openapi-to-typescript does

The skill reads an OpenAPI file in JSON or YAML, checks its structure, then uses components/schemas and paths to build TypeScript output. Generated types cover schemas as well as endpoint parameters and responses. Required properties stay required; optional ones receive ?. Enums and $ref links are handled too.

The document must identify an OpenAPI 3.0.x version and contain paths; components.schemas is needed when the spec defines types. Validation failures stop generation, so a spec from another version will not pass this check. The output also includes an ApiError interface and a guard for it. The skill asks where to write the result, with types/api.ts in the current directory as its suggested path.

What it helps with

  • generate TypeScript interfaces from OpenAPI schemas
  • model API request parameters and responses
  • add runtime checks for required fields
  • represent enums and $ref links as TypeScript types

Example prompts for the agent

  • Generate TypeScript types from the api.yaml specification.
  • Turn openapi.json into interfaces and guards for its API endpoints.
  • Check this OpenAPI 3.0 file and save the result as types/api.ts.

How to install openapi-to-typescript

1claude-code-templates

npx claude-code-templates@latest --skill development/openapi-to-typescript

2Skills CLI (Vercel)

npx skills add davila7/claude-code-templates --skill openapi-to-typescript -a claude-code

3Manually: put the files in place

~/.claude/skills/openapi-to-typescript/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/openapi-to-typescript/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about openapi-to-typescript

How do I install openapi-to-typescript in Claude Code?

Run npx claude-code-templates@latest --skill development/openapi-to-typescript. Then give the agent the path to your OpenAPI file.

What does openapi-to-typescript do?

It reads an OpenAPI 3.0 specification and generates TypeScript interfaces for schemas, requests, and responses, along with type guards.

Which OpenAPI files can openapi-to-typescript process?

It accepts JSON or YAML for OpenAPI 3.0.x. The spec needs openapi and paths; components.schemas is needed when types are defined.

Similar skills

All skills for Backend and APIs →

From the same set804

The whole set →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor