
openapi-to-typescript
Type generator that turns OpenAPI 3.0 specs into TypeScript interfaces and runtime type guards.
- GitHub stars
- 2.7K
What it does
- Converts OpenAPI 3.0 JSON and YAML schemas into TypeScript interfaces and type guards
- Runs as a single skill,
openapi-to-typescript, triggered by requests to generate types or API interfaces - Designed for projects that need typed API clients generated from an existing OpenAPI specification
Converts OpenAPI 3.0 JSON/YAML to TypeScript interfaces and type guards. Use when generating types from OpenAPI or creating API interfaces.
Add marketplace
/plugin marketplace add softaworks/agent-toolkitRun it inside Claude Code once, then install the plugin below.
Install
/plugin install openapi-to-typescript@agent-toolkitRun it inside Claude Code after adding the marketplace.
Files
Discovered from sourceOpenAPI 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 |
Format Modifiers
| Format | TypeScript |
|---|---|
uuid | string (comment UUID) |
date | string (comment date) |
date-time | string (comment ISO) |
email | string (comment email) |
uri | string (comment URI) |
Complex Types
Object:
// OpenAPI: type: object, properties: {id, name}, required: [id]
interface Example {
id: string; // required: no ?
name?: string; // optional: with ?
}
Array:
// OpenAPI: type: array, items: {type: string}
type Names = string[];
Enum:
// OpenAPI: type: string, enum: [active, draft]
type Status = "active" | "draft";
oneOf (Union):
// OpenAPI: oneOf: [{$ref: Cat}, {$ref: Dog}]
type Pet = Cat | Dog;
allOf (Intersection/Extends):
// OpenAPI: allOf: [{$ref: Base}, {type: object, properties: ...}]
interface Extended extends Base {
extraField: string;
}
Code Generation
File Header
/**
* Auto-generated from: {source_file}
* Generated at: {timestamp}
*
* DO NOT EDIT MANUALLY - Regenerate from OpenAPI schema
*/
Interfaces (from components/schemas)
For each schema in components/schemas:
export interface Product {
/** Product unique identifier */
id: string;
/** Product title */
title: string;
/** Product price */
price: number;
/** Created timestamp */
created_at?: string;
}
- Use OpenAPI description as JSDoc
- Fields in
required[]have no? - Fields outside
required[]have?
Request/Response Types (from paths)
For each endpoint in paths:
// GET /products - query params
export interface GetProductsRequest {
page?: number;
limit?: number;
}
// GET /products - response 200
export type GetProductsResponse = ProductList;
// POST /products - request body
export interface CreateProductRequest {
title: string;
price: number;
}
// POST /products - response 201
export type CreateProductResponse = Product;
Naming convention:
{Method}{Path}Requestfor params/body{Method}{Path}Responsefor response
Type Guards
For each main interface, generate a type guard:
export function isProduct(value: unknown): value is Product {
return (
typeof value === 'object' &&
value !== null &&
'id' in value &&
typeof (value as any).id === 'string' &&
'title' in value &&
typeof (value as any).title === 'string' &&
'price' in value &&
typeof (value as any).price === 'number'
);
}
Type guard rules:
- Check
typeof value === 'object' && value !== null - For each required field: check
'field' in value - For primitive fields: check
typeof - For arrays: check
Array.isArray() - For enums: check
.includes()
Error Type (always include)
export interface ApiError {
status: number;
error: string;
detail?: string;
}
export function isApiError(value: unknown): value is ApiError {
return (
typeof value === 'object' &&
value !== null &&
'status' in value &&
typeof (value as any).status === 'number' &&
'error' in value &&
typeof (value as any).error === 'string'
);
}
$ref Resolution
When encountering {"$ref": "#/components/schemas/Product"}:
- Extract the schema name (
Product) - Use the type directly (don't resolve inline)
// OpenAPI: items: {$ref: "#/components/schemas/Product"}
// TypeScript:
items: Product[] // reference, not inline
Complete Example
Input (OpenAPI):
{
"openapi": "3.0.0",
"components": {
"schemas": {
"User": {
"type": "object",
"properties": {
"id": {"type": "string", "format": "uuid"},
"email": {"type": "string", "format": "email"},
"role": {"type": "string", "enum": ["admin", "user"]}
},
"required": ["id", "email", "role"]
}
}
},
"paths": {
"/users/{id}": {
"get": {
"parameters": [{"name": "id", "in": "path", "required": true}],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {"$ref": "#/components/schemas/User"}
}
}
}
}
}
}
}
}
Output (TypeScript):
/**
* Auto-generated from: api.openapi.json
* Generated at: 2025-01-15T10:30:00Z
*
* DO NOT EDIT MANUALLY - Regenerate from OpenAPI schema
*/
// ============================================================================
// Types
// ============================================================================
export type UserRole = "admin" | "user";
export interface User {
/** UUID */
id: string;
/** Email */
email: string;
role: UserRole;
}
// ============================================================================
// Request/Response Types
// ============================================================================
export interface GetUserByIdRequest {
id: string;
}
export type GetUserByIdResponse = User;
// ============================================================================
// Type Guards
// ============================================================================
export function isUser(value: unknown): value is User {
return (
typeof value === 'object' &&
value !== null &&
'id' in value &&
typeof (value as any).id === 'string' &&
'email' in value &&
typeof (value as any).email === 'string' &&
'role' in value &&
['admin', 'user'].includes((value as any).role)
);
}
// ============================================================================
// Error Types
// ============================================================================
export interface ApiError {
status: number;
error: string;
detail?: string;
}
export function isApiError(value: unknown): value is ApiError {
return (
typeof value === 'object' &&
value !== null &&
'status' in value &&
typeof (value as any).status === 'number' &&
'error' in value &&
typeof (value as any).error === 'string'
);
}
Common Errors
| Error | Action |
|---|---|
| OpenAPI version != 3.0.x | Report that only 3.0 is supported |
| $ref not found | List missing refs |
| Unknown type | Use unknown and warn |
| Circular reference | Use type alias with lazy reference |
From the softaworks/agent-toolkit README
Softaworks Agent Skills
Opinionated skills shared by @leonardocouy for improving daily work efficiency with Claude Code. Skills are packaged instructions and scripts that extend agent capabilities across development, documentation, planning, and professional workflows.
Skills follow the Agent Skills format.
๐งญ Quick Navigation
๐ Installation โข ๐ Available Skills โข ๐ค Agents & Commands โข ๐ Skill Structure โข ๐ค Contributing โข ๐ License โข ๐ Links
๐ Installation
Quick Install (Recommended)
npx skills add softaworks/agent-toolkit
This method works with multiple AI coding agents (Claude Code, Codex, Cursor, AdaL, etc.)
Register as Plugin Marketplace
Run the following commands in Claude Code:
/plugin marketplace add softaworks/agent-toolkit
/plugin
Install Plugins
Option 1: Via Browse UI
- Switch to Marketplaces tab (use arrow keys or Tab)
- Select agent-toolkit, press Enter
- Browse and select the plugin(s) you want to install
- Select Install now
Option 2: Direct Install
# Install specific skill
/plugin install codex@agent-toolkit
/plugin install humanizer@agent-toolkit
# Install specific agent
/plugin install agent-codebase-pattern-finder@agent-toolkit
# Install specific command
/plugin install command-codex-plan@agent-toolkit
Option 3: Ask the Agent
Simply tell Claude Code:
Please install Skills from github.com/softaworks/agent-toolkit
Available Plugins
Each skill, agent, and command is an individual plugin that can be installed separately:
- Skills โ See Available Skills for the full list
- Agents โ See Agents (install as
agent-<name>@agent-toolkit) - Commands โ See Slash Commands (install as
command-<name>@agent-toolkit)
Update Plugins
To update plugins to the latest version:
- Run
/pluginin Claude Code - Switch to Marketplaces tab
- Select agent-toolkit
- Choose Update marketplace
You can also Enable auto-update to get the latest versions automatically.
Manual Installation
For Claude Code (Manual) โ Skills only
cp -r skills/<skill-name> ~/.claude/skills/
For claude.ai โ Skills only
Add skills to project knowledge or paste SKILL.md contents into the conversation.
๐ Available Skills
| Category | Skill | Description |
|---|---|---|
| ๐ค AI Tools | codex | Advanced code analysis with GPT-5.2 |
| ๐ค AI Tools | gemini | Large-scale review (200k+ context) |
| ๐ค AI Tools | perplexity | Web search & research |
| ๐ฎ Meta | agent-md-refactor | Refactor bloated agent instruction files |
| ๐ฎ Meta | command-creator | Create Claude Code slash commands |
| ๐ฎ Meta | plugin-forge | Build Claude Code plugins & manifests |
| ๐ฎ Meta | skill-judge | Evaluate skill design quality |
| ๐ Documentation | backend-to-frontend-handoff-docs | API handoff docs for frontend |
| ๐ Documentation | c4-architecture | C4 architecture diagrams with Mermaid |
| ๐ Documentation | crafting-effective-readmes | Write effective README files |
| ๐ Documentation | draw-io | Create & edit draw.io diagrams |
| ๐ Documentation | excalidraw | Work with Excalidraw diagrams |
| ๐ Documentation | frontend-to-backend-requirements | Document API requirements |
| ๐ Documentation | marp-slide | Professional presentation slides |
| ๐ Documentation | mermaid-diagrams | Software diagrams with Mermaid |
| ๐ Documentation | writing-clearly-and-concisely | Clear, professional writing |
| ๐จ Design & Frontend | design-system-starter | Create design systems |
| ๐จ Design & Frontend | mui | Material-UI v7 patterns |
| ๐จ Design & Frontend | openapi-to-typescript | Convert OpenAPI to TypeScript |
| ๐จ Design & Frontend | react-dev | Type-safe React 18-19 with TypeScript |
| ๐จ Design & Frontend | react-useeffect | React useEffect best practices |
| ๐ ๏ธ Development | database-schema-designer | Design robust database schemas |
| ๐ ๏ธ Development | dependency-updater | Smart dependency management |
| ๐ ๏ธ Development | naming-analyzer | Suggest better variable/function names |
| ๐ ๏ธ Development | lesson-learned | Extract SE lessons from recent code changes |
| ๐ ๏ธ Development | reducing-entropy | Minimize codebase size |
| ๐ ๏ธ Development | session-handoff | Seamless AI session transfers |
| ๐ฏ Planning | game-changing-features | Find 10x product opportunities |
| ๐ฏ Planning | gepetto | Detailed implementation planning |
| ๐ฏ Planning | requirements-clarity | Clarify requirements before coding |
| ๐ฏ Planning | ship-learn-next | Turn learning into actionable reps |
| ๐ Professional | daily-meeting-update | Interactive daily standup generator |
| ๐ Professional | difficult-workplace-conversations | Navigate difficult conversations |
| ๐ Professional | feedback-mastery | Deliver constructive feedback |
| ๐ Professional | professional-communication | Technical communication guide |
| ๐งช Testing | qa-test-planner | Comprehensive QA test planning |
| ๐ฆ Git | commit-work | High-quality git commits |
| ๐ง Utilities | datadog-cli | Debug with Datadog logs & metrics |
| ๐ง Utilities | domain-name-brainstormer | Generate & check domain names |
| ๐ง Utilities | humanizer | Remove AI writing patterns |
| ๐ง Utilities | meme-factory | Generate memes with API |
| ๐ง Utilities | jira | Natural language Jira interaction |
| ๐ง Utilities | web-to-markdown | Convert webpages to Markdown |
๐ค Agents & Commands
Requires Claude Code CLI โ These agents and commands are exclusive to Claude Code users.
For full access, add the marketplace and install plugins:
/plugin marketplace add softaworks/agent-toolkit /plugin install codex@agent-toolkit
Agents
Specialized sub-agents that Claude Code can delegate tasks to:
| Agent | Description |
|---|---|
| ascii-ui-mockup-generator | Visualize UI concepts through ASCII mockups |
| codebase-pattern-finder | Find similar implementations and patterns |
| communication-excellence-coach | Email refinement, tone calibration, roleplay |
| general-purpose | Default agent for complex multi-step tasks |
| mermaid-diagram-specialist | Create flowcharts, sequence diagrams, ERDs |
| ui-ux-designer | Research-backed UI/UX design feedback |
Slash Commands
Reusable workflows invoked with /command-name:
| Command | Description |
|---|---|
/codex-plan | Create implementation plans using Codex 5.2 |
/compose-email | Draft professional emails |
/explain-changes-mental-model | Build mental model of code changes |
/explain-pr-changes | Generate PR summaries |
/sync-branch | Sync feature branch with main |
/sync-skills-readme | Update README skills table |
/viral-tweet | Optimize tweet ideas for X engagement |
๐ Skill Structure
Each skill contains:
SKILL.md- Detailed instructions for the agent (with YAML frontmatter)README.md- User-friendly documentation with examplesscripts/- Helper scripts for automation (optional)references/- Supporting documentation (optional)
๐ค Contributing
Contributions are welcome! When adding new skills:
- Follow the Agent Skills format
- Include both
SKILL.md(for agents) andREADME.md(for users) - Add YAML frontmatter to
SKILL.mdwithname:anddescription:fields - Update this README.md with a link to your skill
๐ License
MIT
๐ Links
Details
- Marketplace
- softaworks/agent-toolkit
- Source
- dist/plugins/openapi-to-typescript
- Category
- Design Frontend
- Keywords
- design, frontend, openapi, typescript, api
- Listed since
- Apr 6, 2026
More from softaworks/agent-toolkit
All 56- perplexity
- plugin-forge
- professional-communication
- qa-test-planner
- react-dev
- react-useeffect
- reducing-entropy
- requirements-clarity
- session-handoff
- ship-learn-next
- skill-judge
- web-to-markdown
- writing-clearly-and-concisely
- agent-ascii-ui-mockup-generator
- agent-codebase-pattern-finder
- agent-communication-excellence-coach
- agent-general-purpose
- agent-md-refactor
- agent-mermaid-diagram-specialist
- agent-ui-ux-designer
- backend-to-frontend-handoff-docs
- c4-architecture
- codex
- command-codex-plan
Similar to openapi-to-typescript
More Developer Tools
openapi-to-typescriptSkillsoftaworks/agent-toolkit4K installsConverts OpenAPI 3.0 specs into TypeScript interfaces, request/response types, and type guards for validation.
openapi-generatorSkillpatricio0312rev/skills319 installsGenerates OpenAPI 3.0/3.1 specs from Express, Next.js, Fastify, Hono, or NestJS routes with schemas and examples.
datamodel-code-generatorPlugindatamodel-code-generator/datamodel-code-generator4.1K starsGenerate Python models from OpenAPI, AsyncAPI, JSON Schema, GraphQL and more, plus typed HTTP and WebSocket clients and FastAPI servers (experimental), with dat
kubbPluginkubb-labs/kubb1.8K starsTurn your API spec into type-safe code: TypeScript types, Zod schemas, Axios clients, React Query hooks and more from an OpenAPI spec, with the Kubb MCP server
api-toolkitPluginarmanzeroeight/fastagent-plugins29 starsAPI design toolkit for REST and GraphQL with endpoint design, versioning strategies, and OpenAPI documentation generation. Includes api architect agent for stra
openapi-expertPluginrohitg00/awesome-claude-code-toolkit2.8K starsOpenAPI spec generation, validation, and client code scaffolding