openapi-to-typescript

Convert OpenAPI 3.0 JSON or YAML specifications into TypeScript interfaces and type guards.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/program-the-brain-not-the-heartbeat/dotfiles --skill openapi-to-typescript-program-the-brain-not-the-heartbeat
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: openapi-to-typescript
Source: https://github.com/program-the-brain-not-the-heartbeat/dotfiles/tree/main/config/claude/skills/openapi-to-typescript
Command: npx skills add https://github.com/program-the-brain-not-the-heartbeat/dotfiles --skill openapi-to-typescript-program-the-brain-not-the-heartbeat

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Converts OpenAPI 3.0 specifications (JSON or YAML) into strongly-typed TypeScript definitions to reduce contract drift between backend and frontend.

Core Features & Use Cases

  • Generates TypeScript interfaces for all schemas in components/schemas
  • Creates request/response types from paths for API endpoints
  • Produces runtime type guards for validation and safety
  • Handles common OpenAPI constructs like oneOf, allOf, and enums
  • Supports OpenAPI input in JSON or YAML format and outputs a single TypeScript file (e.g., types/api.ts)

Quick Start

Provide the path to your OpenAPI spec and I will generate TypeScript types and guards.

Frequently Asked Questions about openapi-to-typescript

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

FAQPage Schema
How do I generate TypeScript types from an OpenAPI spec?

Yes, generating TypeScript type guards from OpenAPI schemas is fully supported. The tool produces runtime validators alongside TypeScript interfaces to enforce API contracts and ensure type safety for client code.

Can I generate runtime type guards from OpenAPI schemas?

Yes, generating TypeScript type guards from OpenAPI schemas is fully supported. The tool produces runtime validators alongside TypeScript interfaces to enforce API contracts and ensure type safety for client code.

Does the generator support complex OpenAPI constructs like oneOf, allOf, and enums?

The generator handles common OpenAPI constructs including oneOf, allOf, and enums. It extracts these definitions from your OpenAPI 3.0 specification to produce corresponding TypeScript interfaces and runtime type guards.

What is the best way to prevent API contract drift between frontend and backend?

Generating TypeScript definitions directly from OpenAPI specifications is an effective way to prevent API contract drift. It creates strongly-typed interfaces and request/response types to enforce contracts at compile time.

Can I use a YAML file as input to generate TypeScript API interfaces?

Yes, you can use OpenAPI input in either JSON or YAML format. The tool scans the provided specification file to generate TypeScript interfaces for all schemas and request/response types for API endpoints.