From openapi-generate
Generate OpenAPI 3.1 specs from existing code (routes, controllers, types, Zod/Joi schemas), or generate code from an existing spec. Produces valid openapi.yaml, typed client SDKs, mock servers, and Postman collections. Use when documenting an API, onboarding clients, generating typed SDKs, or migrating to spec-first development.
How this skill is triggered — by the user, by Claude, or both
Slash command
/openapi-generate:openapi-generateThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Code → spec → SDK → mocks. Full API documentation lifecycle.
Code → spec → SDK → mocks. Full API documentation lifecycle.
/openapi-generate — generate spec from codebase routes
/openapi-generate --from spec — generate code/SDK from openapi.yaml
/openapi-generate --sdk typescript — generate TypeScript client SDK
/openapi-generate --mock — generate mock server from spec
/openapi-generate --postman — export Postman collection
/openapi-generate --validate — validate existing openapi.yaml
Claude reads your route files, controllers, and type definitions, then produces a complete openapi.yaml.
Claude reads an existing openapi.yaml and generates:
Claude will:
router.get, NestJS @Get, Next.js route.ts, etc.)openapi.yaml with examples$ref components to avoid duplication@redocly/cli lintopenapi: 3.1.0
info:
title: Products API
version: 1.0.0
paths:
/products:
get:
summary: List products
operationId: listProducts
parameters:
- name: category
in: query
schema:
type: string
- name: limit
in: query
schema:
type: integer
default: 20
maximum: 100
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/ProductList'
'400':
$ref: '#/components/responses/BadRequest'
/products/{id}:
get:
summary: Get product by ID
operationId: getProduct
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/Product'
'404':
$ref: '#/components/responses/NotFound'
components:
schemas:
Product:
type: object
required: [id, name, price]
properties:
id:
type: string
format: uuid
name:
type: string
price:
type: number
format: float
category:
type: string
# TypeScript (via openapi-typescript)
/openapi-generate --sdk typescript
# → generates: src/types/api.ts (fully typed)
# Typed fetch client (openapi-fetch)
/openapi-generate --sdk typescript-fetch
# → generates: src/lib/api-client.ts
# Python (via openapi-python-client)
/openapi-generate --sdk python
import createClient from 'openapi-fetch'
import type { paths } from './types/api'
const client = createClient<paths>({ baseUrl: 'https://api.example.com' })
// Fully typed — autocomplete on params + response
const { data, error } = await client.GET('/products/{id}', {
params: { path: { id: '123' } },
})
// data.name is typed as string
/openapi-generate --mock
# Generates: mock-server/ (uses Prism)
# Run: npx @stoplight/prism-cli mock openapi.yaml
# → Serves realistic mocks from examples in spec
OPENAPI VALIDATION — openapi.yaml
====================================
❌ 3 errors | ⚠️ 7 warnings
ERRORS
[E1] /paths/~1orders~1{id}/put — requestBody is required but not defined
[E2] /components/schemas/User — 'email' format should be 'email' not 'string'
[E3] Missing operationId on GET /users
WARNINGS
[W1] No examples defined for 5 schemas (reduces mock quality)
[W2] Missing 401/403 responses on authenticated endpoints
| Framework | Route Discovery |
|---|---|
| Express / Fastify | router.get/post/put/delete |
| NestJS | @Get, @Post, @Controller decorators |
| Next.js App Router | route.ts export handlers |
| FastAPI (Python) | @app.get, @app.post |
| Django REST | ViewSet + urlpatterns |
| Hono | app.get/post |
npx claudepluginhub andersonlimahw/lemon-ai-hub --plugin openapi-generateGenerates or updates OpenAPI 3.0 specs by scanning codebases for API route definitions in Express, Python, Go, Java Spring, and Rails projects. Use to create or update API documentation from existing endpoints.
Generates and validates OpenAPI 3.1 specs from code or design-first contracts. Use for API documentation, SDK generation, and contract compliance.
Generates OpenAPI 3.0+ specs from existing API code, enhances with schemas/examples/errors, creates interactive docs/SDKs, and validates compliance.