$npx -y skills add huangjia2019/claude-code-engineering --skill api-documentingGenerate API documentation from code. Use when the user wants to document APIs, create API reference, generate endpoint documentation, or needs help with OpenAPI/Swagger specs.
| 1 | # API Documentation Generator |
| 2 | |
| 3 | Generate comprehensive API documentation from source code. |
| 4 | |
| 5 | ## Quick Reference |
| 6 | |
| 7 | For common documentation patterns, see `PATTERNS.md`. |
| 8 | |
| 9 | ## Documentation Standards |
| 10 | |
| 11 | See `STANDARDS.md` for our documentation conventions. |
| 12 | |
| 13 | ## Process |
| 14 | |
| 15 | ### Step 1: Identify API Endpoints |
| 16 | |
| 17 | Look for: |
| 18 | - Route definitions (Express, FastAPI, etc.) |
| 19 | - Controller methods |
| 20 | - Handler functions |
| 21 | |
| 22 | ### Step 2: Extract Information |
| 23 | |
| 24 | For each endpoint, extract: |
| 25 | - HTTP method (GET, POST, PUT, DELETE, etc.) |
| 26 | - Path/route |
| 27 | - Parameters (path, query, body) |
| 28 | - Request/response schemas |
| 29 | - Authentication requirements |
| 30 | |
| 31 | ### Step 3: Generate Documentation |
| 32 | |
| 33 | Use the template in `templates/endpoint.md` for consistent formatting. |
| 34 | |
| 35 | ### Step 4: Create Overview |
| 36 | |
| 37 | Generate an index of all endpoints with the template in `templates/index.md`. |
| 38 | |
| 39 | ## Output Formats |
| 40 | |
| 41 | ### Markdown (Default) |
| 42 | Generate markdown documentation suitable for README or docs site. |
| 43 | |
| 44 | ### OpenAPI/Swagger |
| 45 | If requested, generate OpenAPI 3.0 spec. See `templates/openapi.yaml` for structure. |
| 46 | |
| 47 | ## Examples |
| 48 | |
| 49 | See `EXAMPLES.md` for sample inputs and outputs. |
| 50 | |
| 51 | ## Scripts |
| 52 | |
| 53 | To auto-detect routes in common frameworks: |
| 54 | ```bash |
| 55 | python scripts/detect_routes.py <source_directory> |
| 56 | ``` |
| 57 | |
| 58 | To validate generated OpenAPI spec: |
| 59 | ```bash |
| 60 | ./scripts/validate_openapi.sh <spec_file> |
| 61 | ``` |