api-generating
Scannednpx machina-cli add skill huangjia2019/claude-code-engineering/05-api-generator --openclawAPI Documentation Generator
Generate comprehensive API documentation from source code.
Quick Reference
| Task | Resource |
|---|---|
| Identify framework | See PATTERNS.md |
| Documentation standards | See STANDARDS.md |
| Example outputs | See EXAMPLES.md |
Process
Step 1: Identify API Endpoints
Look for route definitions. For framework-specific patterns, see PATTERNS.md.
Step 2: Extract Information
For each endpoint, extract:
- HTTP method (GET, POST, PUT, DELETE, etc.)
- Path/route
- Parameters (path, query, body)
- Request/response schemas
- Authentication requirements
Step 3: Generate Documentation
Use the template in templates/endpoint.md for each endpoint.
Step 4: Create Overview
Generate an index using templates/index.md.
Output Formats
Markdown (Default)
Generate markdown suitable for README or docs site.
OpenAPI/Swagger
If requested, generate OpenAPI 3.0 spec. See templates/openapi.yaml.
Automation
To auto-detect routes:
python scripts/detect_routes.py <source_directory>
To validate OpenAPI spec:
./scripts/validate_openapi.sh <spec_file>
Source
git clone https://github.com/huangjia2019/claude-code-engineering/blob/main/04-Skills/projects/05-api-generator/SKILL.mdView on GitHub Overview
Generates endpoint code and documentation from specifications. It scans source for routes, extracts HTTP method, path, parameters, schemas, and authentication, and renders per-endpoint docs plus a project index. It supports Markdown docs by default and can output OpenAPI/Swagger specs when requested.
How This Skill Works
It identifies endpoints using framework patterns, extracts key details, and applies templates (endpoint.md and index.md) to generate docs. It can auto-detect routes with a Python script and validate OpenAPI specs with a shell script.
When to Use It
- Starting a new REST API project by generating endpoints from specifications
- Documenting existing routes with standardized Markdown or OpenAPI
- Scaffolding CRUD routes for a resource across services
- Generating a centralized OpenAPI/Swagger spec from codebase
- Producing README/docs for an API alongside code
Quick Start
- Step 1: Identify endpoints from your source with python scripts/detect_routes.py <source_directory>
- Step 2: Use templates to generate endpoint docs (templates/endpoint.md) and index (templates/index.md)
- Step 3: Optional: output OpenAPI/Swagger (templates/openapi.yaml) and validate with scripts
Best Practices
- Keep your source of truth in one spec and generate code/docs from it
- Keep endpoint templates updated to match your framework conventions
- Run route auto-detection regularly during refactors
- Validate the generated OpenAPI spec after generation
- Include request/response schemas and authentication examples in specs
Example Use Cases
- Generate /users endpoints and docs from a YAML spec
- Auto-generate OpenAPI 3.0 for a microservice
- Scaffold CRUD endpoints for a new resource
- Produce endpoint.md and index.md for a REST API
- Validate a generated OpenAPI spec with scripts