
Openapi To Typescript
This converts OpenAPI 3.0 specs into TypeScript interfaces and runtime type guards. It reads your JSON or YAML spec, pulls out schemas and endpoint definitions, then generates properly typed interfaces with optional fields marked correctly, plus type guard functions for runtime validation. The output includes request and response types for each endpoint, handles refs and complex types like oneOf and allOf, and adds JSDoc comments from your spec descriptions. Saves you from manually writing types and keeps them in sync with your API contract. The type guards are especially handy since TypeScript's types disappear at runtime but you still need to validate API responses.
- skills.sh installs
- 211
- GitHub stars
- 33.2K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add davila7/claude-code-templates --skill openapi-to-typescript --agent claude-codeInstalls into .claude/skills of the current project.
Files
OpenAPI to TypeScript
Converts OpenAPI 3.0 specifications to TypeScript interfaces and type guards.
Input: OpenAPI file (JSON or YAML) Output: TypeScript file with interfaces and type guards
When to Use
- "generate types from openapi"
- "convert openapi to typescript"
- "create API interfaces"
- "generate types from spec"
Workflow
- Request the OpenAPI file path (if not provided)
- Read and validate the file (must be OpenAPI 3.0.x)
- Extract schemas from
components/schemas - Extract endpoints from
paths(request/response types) - Generate TypeScript (interfaces + type guards)
- Ask where to save (default:
types/api.tsin current directory) - Write the file
OpenAPI Validation
Check before processing:
- Field "openapi" must exist and start with "3.0"
- Field "paths" must exist
- Field "components.schemas" must exist (if there are types)
If invalid, report the error and stop.
Type Mapping
Primitives
| OpenAPI | TypeScript |
|---|---|
string | string |
number | number |
integer | number |
boolean | boolean |
null | null |
Sponsors
Details
- Repository
- github.com/davila7/claude-code-templates
- Category
- Backend & APIs
- First seen
- Jun 3, 2026
More from davila7/claude-code-templates
All 618- Vaex211
- Gtars210
- Flowio209
- Latchbio Integration209
- Molfeat209
- Dnanexus Integration208
- Exa Search208
- Labarchive Integration208
- Datamol207
- Pathml207
- Referral Program207
- Neon Postgres206
- Address Github Comments205
- Slack Bot Builder205
- Plaid Fintech204
- Daily Meeting Update203
- Github Actions Creator203
- Omero Integration203
- Opentrons Integration202
- Protocolsio Integration202
- Footballbin Predictions201
- Raffle Winner Picker201
- Avalonia Zafiro Development192
- Clickhouse Io192