api-docs-generatelisted
Install: claude install-skill manastalukdar/ai-devstudio
# API Documentation Generation
I'll generate comprehensive OpenAPI/Swagger documentation from your API code.
**Features:**
- Auto-generate from Express, FastAPI, Next.js API routes
- OpenAPI 3.0 specification format
- Interactive Swagger UI setup
- Automatic schema extraction
- Integration with `/api-test-generate`
## Token Optimization
This skill uses aggressive optimization strategies to minimize token usage during API documentation generation:
### 1. Framework Detection Caching (600 token savings)
**Pattern:** Cache framework type and API patterns
- Store framework detection in `.api-framework-cache` (1 hour TTL)
- Cache: framework type, route patterns, schema locations
- Read cached framework on subsequent runs (50 tokens vs 650 tokens fresh)
- Invalidate on package.json/requirements.txt changes
- **Savings:** 92% on repeat runs, most common after initial setup
### 2. Grep-Based Endpoint Discovery (2,000 token savings)
**Pattern:** Use Grep to find routes instead of reading all files
- Grep for route patterns: `router.get`, `@app.route`, `router.Get` (300 tokens)
- Don't read full route files until schema generation (save 1,700+ tokens)
- Extract paths and methods from grep results
- **Savings:** 85% vs reading all route files for discovery
### 3. Existing OpenAPI Spec Detection (95% savings)
**Pattern:** Early exit if spec already exists and is current
- Check for `openapi.json`, `swagger.json`, `openapi.yaml` (50 tokens)
- Compare file mtime with route file mtime