Back to catalog

API Documentation Generator

Generate API documentation from code comments and OpenAPI specs

  • Category: Documentation
  • Tags: api, documentation, openapi, swagger, rest
  • Downloads: 0
  • Updated: 2025-11-09

Syntax

/api-docs

Command

{"argument_hint": "[api-file] | [--openapi] | [--format markdown|html]", "allowed_tools": "Read, Edit, Bash, Grep", "model": null, "disable_model_invocation": false, "markdown_body": "# API Documentation Generator\n\nGenerate comprehensive API documentation: $ARGUMENTS\n\n## Current State\n\n- API files: !`find . -name \"*.api.*\" -o -name \"*api*.ts\" -o -name \"*api*.js\" 2>/dev/null | head -10`\n- OpenAPI spec: !`find . -name \"openapi.*\" -o -name \"swagger.*\" 2>/dev/null`\n- API routes: !`grep -r \"router\\\\|app\\\\.(get|post|put|delete)\" . --include=\"*.ts\" --include=\"*.js\" 2>/dev/null | head -10`\n\n## Task\n\nFollow these steps to generate API documentation:\n\n1. **API Discovery**\n   - Find all API endpoints\n   - Identify route definitions\n   - Locate OpenAPI/Swagger specs\n   - Find API documentation comments\n\n2. **Documentation Extraction**\n   - Extract endpoint definitions\n   - Parse request/response schemas\n   - Extract parameter descriptions\n   - Get example requests/responses\n   - Extract authentication requirements\n\n3. **Documentation Generation**\n   - If `--openapi` flag: Generate OpenAPI spec\n   - If `--format html`: Generate HTML documentation\n   - Otherwise: Generate Markdown documentation\n   - Include endpoint descriptions\n   - Add request/response examples\n   - Include authentication info\n\n4. **Documentation Structure**\n   - Organize by API version\n   - Group related endpoints\n   - Add navigation/index\n   - Include code examples\n   - Add troubleshooting section\n\n5. **Documentation Quality**\n   - Verify all endpoints documented\n   - Check for missing parameters\n   - Validate examples work\n   - Ensure consistency\n   - Add interactive examples if possible\n\n6. **Output**\n   - Save documentation file\n   - Update README with API links\n   - Generate changelog if needed\n   - Create API reference index\n\nRemember to:\n- Keep documentation up to date\n- Include practical examples\n- Document all parameters\n- Show error responses\n- Make it easy to navigate"}

Usage examples

/api-docs
/api-docs --openapi
/api-docs --format html