Skip to content
Skills Library
Programming · Conversion & formats

openapi-generate

/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.

Licence
MIT
Last repository change
16.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
2
Scripts
0
HTML comments
0
URLs in SKILL.md
1
Deprecation

No signals detected. Repository changed on 16.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

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.

Original author description

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 it works

  1. Quick Start
  2. Directions
  3. Workflow — Code to Spec
  4. Generated Spec Example
  5. SDK Generation
  6. Mock Server
  7. Validation
  8. Frameworks Supported
Original SKILL.md headings · 177 lines, 525 words
SKILL.md preview
---
name: openapi-generate
description: 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.
---

# OpenAPI Generate

Code → spec → SDK → mocks. Full API documentation lifecycle.

## Quick Start

```
/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
```

## Directions

### Code → Spec (most common)
Claude reads your route files, controllers, and type definitions, then produces a complete `openapi.yaml`.

### Spec → Code (spec-first)
Claude reads an existing `openapi.yaml` and generates:
- TypeScript types / Zod schemas
- Route handlers (Express / Fastify / NestJS / Next.js)
- Typed client SDK
- Test fixtures

## Workflow — Code to Spec

Claude will:
1. Discover route files (Express `router.get`, NestJS `@Get`, Next.js `route.ts`, etc.)
2. Extract path params, query params, request body, response shapes
3. Infer types from TypeScript / Zod / Joi / Prisma schema
4. Generate `openapi.yaml` with examples
5. Add `$ref` components to avoid duplication
6. Validate with `@redocly/cli lint`

## Generated Spec Example

```yaml
openapi: 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
```

## SDK Generation

```bash
# 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
```

### TypeScript SDK Example

```typescript
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
```

## Mock Server

```bash
/openapi-generate --mock
# Generates: mock-server/ (uses Prism)
# Run: npx @stoplight/prism-cli mock openapi.yaml
# → Serves realistic mocks from examples in spec
```

## Validation

```
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
```

## Frameworks Supported

| 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` |
Files in this package (2)
  • SKILL.md 5 KB
  • plugin.json 1 KB

Versions

The database has no other skills named openapi-generate.

Database snapshot: 13.11.2026 · package version 6755501c34d3 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 95postman
    Full API lifecycle management through Postman. Sync OpenAPI specs to collections, generate typed client code, run API tests, create mock servers, publish documentation, audit security against OWASP Top 10, and discover APIs across workspaces. Requires the Postman MCP Server. Use…
  • 100openapi-to-zod
    Generate Zod v4 TypeScript schemas from OpenAPI (openapi.yaml / openapi.json) definitions. This skill exists because npm packages like openapi-zod-client do not support Zod v4 — Claude reads the YAML/JSON directly and writes the conversion. Use this skill whenever the user wants…
  • 100rc-openapi
    Creates or updates an OpenAPI specification by discovering the project's HTTP endpoints, request schemas, and response models from source. Use to keep an openapi.yaml in sync after API changes, or to generate a spec for an existing service. Do not use for Postman collections…
  • 100openapi-spec
    OpenAPI is the standard format for describing HTTP APIs in YAML or JSON, from which docs, typed clients and mock servers can be generated. Use this skill to write an OpenAPI 3.1 spec, lint it with Redocly CLI, generate TypeScript types and a typed fetch client, build HTML docs,…
  • 100openapi-swagger-specification
    Use this skill when authoring, validating, and generating mock servers or client SDKs from OpenAPI 3.1 definitions.
  • 100generating-api-sdks
    Generate client SDKs in multiple languages from OpenAPI specifications. Use when generating client libraries for API consumption. Trigger with phrases like "generate SDK", "create client library", or "build API SDK".

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.