softaworks avatar

Openapi To Typescript

This converts OpenAPI 3.0 specs into TypeScript interfaces and runtime type guards, handling the full range of schema types including oneOf unions, allOf intersections, and nested references. It extracts types from both component schemas and endpoint definitions, generating request/response interfaces with proper naming conventions. The type guards it produces actually check required fields and primitives at runtime, which is useful if you're validating API responses in production code. It maps format hints like uuid and date-time to string with comments rather than trying to get fancy with branded types. Saves you from hand-writing boilerplate when working with typed API clients.

skills.sh installs
4K
GitHub stars
2.7K
last updated
Aug 21, 2026

Install

$ npx -y skills add softaworks/agent-toolkit --skill openapi-to-typescript --agent claude-code

Installs 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

  1. Request the OpenAPI file path (if not provided)
  2. Read and validate the file (must be OpenAPI 3.0.x)
  3. Extract schemas from components/schemas
  4. Extract endpoints from paths (request/response types)
  5. Generate TypeScript (interfaces + type guards)
  6. Ask where to save (default: types/api.ts in current directory)
  7. 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

OpenAPITypeScript
stringstring
numbernumber
integernumber
booleanboolean
nullnull

Sponsors

Details

Repository
github.com/softaworks/agent-toolkit
Categories
Backend & APIs, AI & Agent Building

More from softaworks/agent-toolkit

All 43
1yaklang avatar401-403-bypass-techniquesyaklang/hack-skills401/403 bypass playbook. Use when encountering access-denied responses on admin panels, API endpoints, or restricted paths. Covers path manipulation, HTTP metho4Kskills.sh installs
2tanstack-skills avatartanstack-starttanstack-skills/tanstack-skillsFull-stack React framework powered by TanStack Router with SSR, streaming, server functions, and deployment to any hosting provider.4Kskills.sh installs
3giuseppe-trisciuoglio avatarnestjs-code-reviewgiuseppe-trisciuoglio/developer-kitProvides comprehensive code review capability for NestJS applications, analyzing controllers, services, modules, guards, interceptors, pipes, dependency injecti4Kskills.sh installs
4giuseppe-trisciuoglio avatarspring-boot-cachegiuseppe-trisciuoglio/developer-kitProvides patterns for implementing Spring Boot caching: configures Redis/Caffeine/EhCache providers with TTL and eviction policies, applies @Cacheable/@CacheEvi4Kskills.sh installs
5analogjs avatarangular-ssranalogjs/angular-skillsImplement server-side rendering and hydration in Angular v20+ using @angular/ssr. Use for SSR setup, hydration strategies, prerendering static pages, and handli3.9Kskills.sh installs
6yaklang avatarrecon-for-secyaklang/hack-skillsEntry P1 category router for reconnaissance and methodology. Use when mapping scope, discovering assets, fingerprinting technology, building endpoint inventory,3.9Kskills.sh installs