Ask Claude to Generate an OpenAPI Spec from Your Existing API Endpoints
Your API documentation is probably out of date. Claude reads the actual code and generates an OpenAPI spec that matches what the API really does right now.
"Read all my API routes and controllers, then generate a complete OpenAPI 3.1 spec"
Claude traces each route through your code — the HTTP method, URL parameters, query parameters, request body validation, response structures, middleware (auth, rate limits), and status codes — then assembles it into a proper OpenAPI document.
# Claude generates specs like this from your actual code:
paths:
/api/users/{id}:
get:
summary: Get user by ID
parameters:
- name: id
in: path
required: true
schema:
type: integer
responses:
'200':
description: User found
content:
application/json:
schema:
$ref: '#/components/schemas/User'
'404':
description: User not found
You can scope and customize the output:
# Just the public endpoints
"Generate an OpenAPI spec for only the public-facing API routes (no admin endpoints)"
# With examples
"Include realistic example values for every request and response field"
# Specific format
"Output the spec in JSON format, not YAML"
# Grouped by feature
"Organize the endpoints by tag — users, orders, products, payments"
After generating the spec, Claude can also:
- Validate it — check for inconsistencies between the spec and actual code behavior
- Add missing descriptions — write clear summaries for every endpoint and parameter
- Generate a Postman collection — convert the spec into an importable collection
- Update an existing spec — diff your old spec against the current code and patch the differences
The best API docs are generated from code, not written from memory — Claude reads your endpoints and writes the spec that matches.
via Claude Code
Log in to leave a comment.
Set up Claude Code as an automated reviewer in your CI pipeline — on every pull request, it reads the diff, checks for bugs, security issues, missing tests, and convention violations, then posts its findings as a PR comment. Your human reviewers get a head start because the obvious issues are already flagged before they look.
Before deploying, tell Claude to read your project — migrations, environment variables, queue workers, scheduled tasks, caching, third-party integrations — and generate a deployment checklist that's specific to your app. Not a generic "did you run migrations?" list, but one that knows YOUR infrastructure and catches the things YOUR deploy can break.
Instead of writing a README from memory or copying a template, tell Claude to read your project and generate one that's actually accurate — real setup instructions from your config, real architecture from your directory structure, real API examples from your routes, and real prerequisites from your dependency files.