api-docs-generator
Skill1 starsChanged 11 months agoMITView on GitHub
Automatically extract API routes from your codebase and generate comprehensive OpenAPI 3.0 specifications with proper schemas, examples, and descriptions. When a user asks for API documentation, follow this checklist: Run the route analyzer to detect the API framework and find all endpoints: Supported Frameworks: Output includes: For each detected endpoint, extract: Express Example: Extract schemas from validation libraries and TypeScript types: Schema Mapping: Create the OpenAPI 3.0 YAML/JSON file:
2 other projects use a version of this.
Adopted by
Most recently taken up by
- vercel-labs/cooking-school-feedbacktheir own version, first seen Mar 31, 2026
- tomique34/claude-skill-creatortheir own version, first seen Oct 28, 2025
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- tomique34/claude-skill-creator★ 9same name
- vercel-labs/cooking-school-feedback★ 4same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository7 other files it gives its agents.
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 5
Use when user asks for API docs, OpenAPI spec, Swagger docs, endpoint documentation, or wants to document their REST API.
- Distinctive: line 15
When a user asks for API documentation, follow this checklist:
- Distinctive: line 34
Run the route analyzer to detect the API framework and find all endpoints:
- Distinctive: line 134
Create the OpenAPI 3.0 YAML/JSON file:
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
API Documentation Generator
Automatically extract API routes from your codebase and generate comprehensive OpenAPI 3.0 specifications with proper schemas, examples, and descriptions.
Quick Start
When a user asks for API documentation, follow this checklist:
API Documentation Progress:
- [ ] Step 1: Detect API framework and analyze routes
- [ ] Step 2: Extract endpoint definitions
- [ ] Step 3: Infer request/response schemas
- [ ] Step 4: Generate OpenAPI specification
- [ ] Step 5: Create markdown documentation
- [ ] Step 6: Add examples and descriptions
- [ ] Step 7: Validate and outputWorkflow
Step 1: Detect Framework and Analyze Routes
Run the route analyzer to detect the API framework and find all endpoints:
python .claude/skills/api-docs-generator/scripts/analyze_routes.py .Supported Frameworks:
- Express.js / Fastify / Hono / NestJS (Node.js)
- FastAPI / Flask / Django REST (Python)
- Gin / Echo / Chi (Go)
- Next.js API Routes / App Router
Output includes:
- Framework detected
- Base URL/prefix
- List of all routes with methods
- Middleware detected (auth, validation)
Step 2: Extract Endpoint Definitions
For each detected endpoint, extract:
| Property | Source |
| Path | Route definition |
| Method | GET, POST, PUT, PATCH, DELETE |
| Parameters | Path params, query params |
| Request body | Validation schema, TypeScript types |
| Response | Return statements, response calls |
| Auth | Middleware, decorators |
| Tags | File/folder structure |
Express Example:
// Route: POST /api/users
// Extract: path params, body schema, response type
router.post("/", validateRequest(createUserSchema), userController.create);Step 3: Infer Request/Response Schemas
Extract schemas from validation libraries and TypeScript types:
From Zod
const createUserSchema = z.object({
email: z.string().email(),
name: z.string().min(2).max(100),
role: z.enum(["admin", "user"]),
});
// → Infer OpenAPI schema with types, formats, constraintsFrom TypeScript Interfaces
interface UserResponse {
id: string;
email: string;
createdAt: Date;
}
// → Convert to OpenAPI schemaFrom Pydantic (Python)
class UserCreate(BaseModel):
email: EmailStr
name: str = Field(..., min_length=2, max_length=100)
# → Convert to OpenAPI schemaSchema Mapping:
| Source Type | OpenAPI Type | Format |
| string | string | - |
| number | number | - |
| boolean | boolean | - |
| Date | string | date-time |
| string | ||
| uuid | string | uuid |
| url | string | uri |
| int | integer | int32 |
| array | array | - |
| object | object | - |
Step 4: Generate OpenAPI Specification
Create the OpenAPI 3.0 YAML/JSON file:
openapi: 3.0.3
info:
title: { { API_NAME } }
description: { { API_DESCRIPTION } }
version: { { VERSION } }
contact:
name: API Support
email: support@example.com
servers:
- url: http://localhost:3000
description: Development
- url: https://api.example.com
description: Production
paths:
/api/users:
get:
summary: List users
operationId: listUsers
tags:
- Users
parameters:
- $ref: "#/components/parameters/PageParam"
- $ref: "#/components/parameters/LimitParam"
responses:
"200":
description: Successful response
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/User"
post:
summary: Create user
operationId: createUser
tags:
- Users
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreateUserInput"
responses:
"201":
description: Created
content:
application/json:
schema:
$ref: "#/components/schemas/User"
"400":
$ref: "#/components/responses/BadRequest"
components:
schemas:
User:
type: object
properties:
id:
type: string
format: uuid
email:
type: string
format: email
name:
type: string
createdAt:
type: string
format: date-time
required:
- id
- email
- name
- createdAt
parameters:
PageParam:
name: page
in: query
schema:
type: integer
default: 1
minimum: 1
LimitParam:
name: limit
in: query
schema:
type: integer
default: 20
minimum: 1
maximum: 100
responses:
BadRequest:
description: Invalid request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
securitySchemes:
BearerAuth:
type: http
scheme: bearer
bearerFormat: JWTStep 5: Create Markdown Documentation
Generate human-readable API documentation:
python .claude/skills/api-docs-generator/scripts/generate_markdown.py openapi.yaml --output docs/API.mdOutput Structure:
# API Documentation
## Authentication
Bearer token required for protected endpoints.
## Endpoints
### Users
#### List Users
`GET /api/users`
**Parameters:**
| Name | Type | Required | Description |
|------|------|----------|-------------|
| page | integer | No | Page number (default: 1) |
| limit | integer | No | Items per page (default: 20) |
**Response:**
```json
[
{
"id": "abc123",
"email": "user@example.com",
"name": "John Doe",
"createdAt": "2024-01-15T10:30:00Z"
}
]
```Create User
POST /api/users
Request Body:
{
"email": "user@example.com",
"name": "John Doe",
"role": "user"
}...
---
### Step 6: Add Examples and Descriptions
Enhance documentation with:
1. **Request/Response Examples**
- Generate realistic sample data
- Include edge cases
- Show error responses
2. **Descriptions**
- Summarize each endpoint's purpose
- Document business rules
- Note rate limits and permissions
3. **Code Snippets**
- cURL examples
- JavaScript/fetch examples
- Python requests examples
---
### Step 7: Validate and Output
Validate the generated OpenAPI spec:
```bash
python .claude/skills/api-docs-generator/scripts/validate_openapi.py openapi.yamlChecks:
- Valid OpenAPI 3.0 syntax
- All $ref references resolve
- Required fields present
- Schema consistency
Output Files:
docs/
├── openapi.yaml # OpenAPI 3.0 spec
├── openapi.json # JSON version
├── API.md # Markdown docs
└── postman_collection.json # Postman importConfiguration
Create .claude/api-docs-config.yaml to customize:
info:
title: My API
version: 1.0.0
description: Backend API for MyApp
servers:
- url: http://localhost:3000
description: Development
- url: https://api.myapp.com
description: Production
defaults:
auth: BearerAuth
content_type: application/json
tag_from: folder # folder, file, or manual
output:
format: yaml # yaml or json
path: docs/openapi.yaml
markdown: docs/API.md
postman: true
ignore:
- /health
- /metrics
- /internal/*Framework-Specific Extraction
Express.js
// Patterns detected:
router.get("/users", handler); // Basic route
router.post("/users", validate, handler); // With middleware
app.use("/api", apiRouter); // Nested routersFastAPI
# Patterns detected:
@router.get("/users", response_model=List[User])
@router.post("/users", status_code=201)
# + Pydantic models for schemasNext.js App Router
// app/api/users/route.ts
export async function GET(request: Request) {}
export async function POST(request: Request) {}
// → Infer routes from file structureNestJS
// Patterns detected:
@Controller('users')
@Get()
@Post()
@ApiOperation({ summary: 'List users' }) // Already has OpenAPI decoratorsExamples
Example 1: Express API
User asks: "Generate OpenAPI docs for my API"
- Run
analyze_routes.py→ Detects Express - Find routes in
src/routes/*.ts - Extract Zod schemas from
src/schemas/ - Generate
openapi.yaml - Create
API.md
Example 2: FastAPI
User asks: "Create Swagger documentation"
- Detect FastAPI
- Parse routers with decorators
- Extract Pydantic models
- Generate spec (FastAPI has built-in support, enhance it)
Example 3: Next.js
User asks: "Document my Next.js API routes"
- Scan
app/api/**orpages/api/** - Infer routes from file structure
- Parse request/response types
- Generate documentation
Tips for Best Results
- Use validation libraries - Zod, Pydantic, etc. provide schema info
- Add TypeScript types - Help infer request/response shapes
- Organize routes by resource - Creates better tags automatically
- Include JSDoc/docstrings - Used for descriptions
- Use consistent patterns - Easier to detect and extract
Related Skills
- fullstack-feature-generator - Generate APIs with built-in docs
- codebase-onboarding - Understand existing APIs first
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

