$npx -y skills add huangjia2019/claude-code-engineering --skill 05-api-generatorGenerate API endpoint code and documentation from specifications. Use when the user wants to create new API endpoints, generate route handlers, scaffold REST APIs, or produce OpenAPI/Swagger specs from code.
| 1 | # API Documentation Generator |
| 2 | |
| 3 | Generate comprehensive API documentation from source code. |
| 4 | |
| 5 | ## Quick Reference |
| 6 | |
| 7 | | Task | Resource | |
| 8 | |------|----------| |
| 9 | | Identify framework | See `PATTERNS.md` | |
| 10 | | Documentation standards | See `STANDARDS.md` | |
| 11 | | Example outputs | See `EXAMPLES.md` | |
| 12 | |
| 13 | ## Process |
| 14 | |
| 15 | ### Step 1: Identify API Endpoints |
| 16 | |
| 17 | Look for route definitions. For framework-specific patterns, see `PATTERNS.md`. |
| 18 | |
| 19 | ### Step 2: Extract Information |
| 20 | |
| 21 | For each endpoint, extract: |
| 22 | - HTTP method (GET, POST, PUT, DELETE, etc.) |
| 23 | - Path/route |
| 24 | - Parameters (path, query, body) |
| 25 | - Request/response schemas |
| 26 | - Authentication requirements |
| 27 | |
| 28 | ### Step 3: Generate Documentation |
| 29 | |
| 30 | Use the template in `templates/endpoint.md` for each endpoint. |
| 31 | |
| 32 | ### Step 4: Create Overview |
| 33 | |
| 34 | Generate an index using `templates/index.md`. |
| 35 | |
| 36 | ## Output Formats |
| 37 | |
| 38 | ### Markdown (Default) |
| 39 | Generate markdown suitable for README or docs site. |
| 40 | |
| 41 | ### OpenAPI/Swagger |
| 42 | If requested, generate OpenAPI 3.0 spec. See `templates/openapi.yaml`. |
| 43 | |
| 44 | ## Automation |
| 45 | |
| 46 | To auto-detect routes: |
| 47 | ```bash |
| 48 | python scripts/detect_routes.py <source_directory> |
| 49 | ``` |
| 50 | |
| 51 | To validate OpenAPI spec: |
| 52 | ```bash |
| 53 | ./scripts/validate_openapi.sh <spec_file> |
| 54 | ``` |