API Documentation Generator
by @charlie-morrison
Generate comprehensive API documentation from code — extract endpoints, parameters, response schemas, and examples from Express, FastAPI, Django, Rails, and...
clawhub install api-documentation-generator📖 About This Skill
name: api-documentation-generator description: Generate comprehensive API documentation from code — extract endpoints, parameters, response schemas, and examples from Express, FastAPI, Django, Rails, and more. metadata: tags: ["api", "documentation", "openapi", "swagger", "developer-experience"]
API Documentation Generator
Generate comprehensive API documentation by analyzing source code. Extracts endpoints, parameters, request/response schemas, authentication requirements, and generates examples. Works with Express, FastAPI, Django REST Framework, Rails, Spring Boot, and other frameworks.
Usage
"Generate API docs from my Express app"
"Create API reference documentation"
"Document all endpoints in this project"
"Generate OpenAPI spec from my code"
How It Works
1. Framework Detection
# Detect framework from dependencies
cat package.json 2>/dev/null | python3 -c "
import json,sys
d=json.load(sys.stdin).get('dependencies',{})
for fw in ['express','fastify','koa','hapi','nestjs','next']:
if fw in str(d): print(f'Node: {fw}')
" 2>/dev/nullcat requirements.txt setup.py pyproject.toml 2>/dev/null | grep -i "fastapi\|django\|flask\|starlette"
2. Endpoint Extraction
Scan source code for route definitions:
Express/Node:
grep -rn "router\.\(get\|post\|put\|patch\|delete\|all\)\|app\.\(get\|post\|put\|patch\|delete\)" src/ routes/
FastAPI/Python:
grep -rn "@app\.\(get\|post\|put\|patch\|delete\)\|@router\.\(get\|post\|put\|patch\|delete\)" src/ app/
Django REST Framework:
grep -rn "class.*ViewSet\|class.*APIView\|path(" */views.py */urls.py
For each endpoint, extract:
3. Schema Extraction
Analyze types/models for request/response schemas:
4. Example Generation
Generate realistic request/response examples:
5. Documentation Output
Generate in multiple formats:
Markdown API Reference:
## POST /api/usersCreate a new user account.
Authentication: Bearer token required
Rate limit: 10 requests/minute
Request Body
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| email | string | yes | Valid email address |
| name | string | yes | Full name (2-100 chars) |
| role | enum | no | "user" or "admin" (default: "user") |Response (201 Created)
json
{
"id": "usr_abc123",
"email": "user@example.com",
"name": "Jane Smith",
"role": "user",
"createdAt": "2026-04-30T10:00:00Z"
}
Errors
400 — Invalid email format or missing required field
409 — Email already registered
429 — Rate limit exceeded
OpenAPI 3.1 spec — machine-readable for Swagger UI, Redoc, Postman
6. Completeness Check
Verify documentation quality:
Output
## API Documentation GeneratedFramework: Express.js + TypeScript
Endpoints found: 23
Documentation completeness: 87%
Generated Files
docs/api-reference.md (full markdown reference)
docs/openapi.yaml (OpenAPI 3.1 spec)
docs/examples/ (curl examples per endpoint) Coverage
| Category | Endpoints | Documented | Missing |
|----------|-----------|------------|---------|
| Auth | 4 | 4 (100%) | — |
| Users | 6 | 5 (83%) | PATCH /users/:id |
| Orders | 8 | 7 (88%) | webhook handler |
| Admin | 5 | 5 (100%) | — |Undocumented
PATCH /api/users/:id — has route but no type annotations
POST /api/webhooks/stripe — raw req.body, no schema
💡 Examples
"Generate API docs from my Express app"
"Create API reference documentation"
"Document all endpoints in this project"
"Generate OpenAPI spec from my code"