API Documentation
Generate comprehensive, interactive API documentation for multiple API protocols including REST/HTTP, gRPC, GraphQL, and RPC. This skill helps create documentation that is accurate, up-to-date, and useful for both developers and consumers.
When to use me
Use this skill when:
- You need to document APIs for internal or external consumers
- You have multiple API protocols (REST, gRPC, GraphQL, RPC) that need consistent documentation
- You want to generate documentation from code or API definitions automatically
- You need interactive documentation with testing capabilities
- You're preparing API documentation for public release or developer portals
- You need to maintain documentation consistency across multiple API versions
- You want to improve API discoverability and usability
What I do
- Multi-protocol support: Generate documentation for REST/HTTP, gRPC, GraphQL, and RPC APIs
- Code-first documentation: Extract documentation from code annotations, OpenAPI/Swagger, Protobuf, GraphQL schemas
- Interactive examples: Create executable API examples with testing capabilities
- Version management: Handle multiple API versions with migration guides
- Consistency checking: Ensure consistency between API implementation and documentation
- Documentation generation: Generate HTML, Markdown, PDF, and interactive API consoles
- Authentication documentation: Document authentication methods (OAuth, API keys, JWT)
- Error handling documentation: Document error codes, messages, and troubleshooting
- Rate limiting documentation: Document rate limits, quotas, and usage policies
Examples
# Generate OpenAPI documentation from code
./scripts/analyze-api-docs.sh --source src/ --format openapi
# Generate gRPC documentation from Protobuf files
./scripts/analyze-api-docs.sh --source proto/ --format grpc
# Generate GraphQL schema documentation
./scripts/analyze-api-docs.sh --source schema.graphql --format graphql
# Generate comprehensive API portal
./scripts/analyze-api-docs.sh --portal --output docs/api-portal
# Check documentation consistency
./scripts/analyze-api-docs.sh --consistency-check --api implementations/
Output format
API Documentation Analysis
─────────────────────────────────────
API Protocol: REST/HTTP
Source Files: 42
Endpoints Documented: 127/142 (89%)
DOCUMENTATION QUALITY METRICS:
───────────────────────────────
✅ Complete: Authentication documented (OAuth 2.0, API keys)
✅ Complete: Error responses documented (25 error codes)
✅ Complete: Request/response examples provided
⚠️ Needs Improvement: Rate limiting documentation missing
⚠️ Needs Improvement: 15 endpoints missing parameter descriptions
❌ Missing: Version migration guide for v1 → v2
API DISCOVERABILITY:
────────────────────
• Endpoints grouped by resource (Users, Products, Orders)
• Search functionality available
• Interactive testing console enabled
• SDK generation for 5 languages (JavaScript, Python, Go, Java, C#)
MULTI-PROTOCOL ANALYSIS:
────────────────────────
REST/HTTP APIs: 142 endpoints
• OpenAPI specification: Complete
• Interactive docs: Available via Swagger UI
• Testing examples: 85%
gRPC APIs: 28 services
• Protobuf documentation: Complete
• gRPC reflection: Enabled
• Client libraries: Generated for 3 languages
GraphQL APIs: 1 schema
• GraphQL schema: Documented
• GraphiQL interface: Available
• Queries/Mutations: 47 operations documented
RPC APIs: 12 methods
• JSON-RPC documentation: Partial
• WebSocket support: Documented
• Binary protocols: Not documented
CONSISTENCY ISSUES (3):
────────────────────────
1. Endpoint /api/v1/users/{id}/profile missing from OpenAPI spec
2. gRPC service "PaymentService" missing authentication documentation
3. GraphQL field "Product.inventory" description inconsistent with REST API
RECOMMENDATIONS:
────────────────
1. HIGH PRIORITY: Document rate limiting policies for all endpoints
2. HIGH PRIORITY: Add version migration guide for upcoming v2 release
3. MEDIUM PRIORITY: Complete JSON-RPC documentation for remaining 5 methods
4. MEDIUM PRIORITY: Generate SDKs for additional languages (Ruby, PHP, Swift)
5. LOW PRIORITY: Add deprecation notices for endpoints scheduled for removal
GENERATED ARTIFACTS:
────────────────────
• OpenAPI 3.0 specification: openapi.yaml
• Interactive API console: docs/api-console/index.html
• Client SDKs: sdk/javascript/, sdk/python/, sdk/go/
• API reference PDF: docs/api-reference.pdf
• Postman collection: docs/postman-collection.json
• cURL examples: docs/curl-examples.md
Notes
- Documentation should be generated as close to the code as possible
- Interactive documentation increases API adoption and reduces support requests
- Consistency between API implementation and documentation is critical
- Consider documentation as part of the API development lifecycle
- Different API protocols may require different documentation approaches
- Version management helps consumers migrate between API versions
- Authentication and error handling are the most commonly referenced sections
- Regular documentation reviews help maintain accuracy and completeness
1---2name: api-documentation3description: Use when you need to generate comprehensive API documentation for REST/HTTP, gRPC, GraphQL, and RPC APIs4license: MIT5compatibility: opencode6metadata:7 audience: developers, technical-writers8 category: documentation9---1011# API Documentation1213Generate comprehensive, interactive API documentation for multiple API protocols including REST/HTTP, gRPC, GraphQL, and RPC. This skill helps create documentation that is accurate, up-to-date, and useful for both developers and consumers.1415## When to use me1617Use this skill when:18- You need to document APIs for internal or external consumers19- You have multiple API protocols (REST, gRPC, GraphQL, RPC) that need consistent documentation20- You want to generate documentation from code or API definitions automatically21- You need interactive documentation with testing capabilities22- You're preparing API documentation for public release or developer portals23- You need to maintain documentation consistency across multiple API versions24- You want to improve API discoverability and usability2526## What I do2728- **Multi-protocol support**: Generate documentation for REST/HTTP, gRPC, GraphQL, and RPC APIs29- **Code-first documentation**: Extract documentation from code annotations, OpenAPI/Swagger, Protobuf, GraphQL schemas30- **Interactive examples**: Create executable API examples with testing capabilities31- **Version management**: Handle multiple API versions with migration guides32- **Consistency checking**: Ensure consistency between API implementation and documentation33- **Documentation generation**: Generate HTML, Markdown, PDF, and interactive API consoles34- **Authentication documentation**: Document authentication methods (OAuth, API keys, JWT)35- **Error handling documentation**: Document error codes, messages, and troubleshooting36- **Rate limiting documentation**: Document rate limits, quotas, and usage policies3738## Examples3940```bash41# Generate OpenAPI documentation from code42./scripts/analyze-api-docs.sh --source src/ --format openapi4344# Generate gRPC documentation from Protobuf files45./scripts/analyze-api-docs.sh --source proto/ --format grpc4647# Generate GraphQL schema documentation48./scripts/analyze-api-docs.sh --source schema.graphql --format graphql4950# Generate comprehensive API portal51./scripts/analyze-api-docs.sh --portal --output docs/api-portal5253# Check documentation consistency54./scripts/analyze-api-docs.sh --consistency-check --api implementations/55```5657## Output format5859```60API Documentation Analysis61─────────────────────────────────────62API Protocol: REST/HTTP63Source Files: 4264Endpoints Documented: 127/142 (89%)6566DOCUMENTATION QUALITY METRICS:67───────────────────────────────68✅ Complete: Authentication documented (OAuth 2.0, API keys)69✅ Complete: Error responses documented (25 error codes)70✅ Complete: Request/response examples provided71⚠️ Needs Improvement: Rate limiting documentation missing72⚠️ Needs Improvement: 15 endpoints missing parameter descriptions73❌ Missing: Version migration guide for v1 → v27475API DISCOVERABILITY:76────────────────────77• Endpoints grouped by resource (Users, Products, Orders)78• Search functionality available79• Interactive testing console enabled80• SDK generation for 5 languages (JavaScript, Python, Go, Java, C#)8182MULTI-PROTOCOL ANALYSIS:83────────────────────────84REST/HTTP APIs: 142 endpoints85 • OpenAPI specification: Complete86 • Interactive docs: Available via Swagger UI87 • Testing examples: 85%8889gRPC APIs: 28 services90 • Protobuf documentation: Complete91 • gRPC reflection: Enabled92 • Client libraries: Generated for 3 languages9394GraphQL APIs: 1 schema95 • GraphQL schema: Documented96 • GraphiQL interface: Available97 • Queries/Mutations: 47 operations documented9899RPC APIs: 12 methods100 • JSON-RPC documentation: Partial101 • WebSocket support: Documented102 • Binary protocols: Not documented103104CONSISTENCY ISSUES (3):105────────────────────────1061. Endpoint /api/v1/users/{id}/profile missing from OpenAPI spec1072. gRPC service "PaymentService" missing authentication documentation1083. GraphQL field "Product.inventory" description inconsistent with REST API109110RECOMMENDATIONS:111────────────────1121. HIGH PRIORITY: Document rate limiting policies for all endpoints1132. HIGH PRIORITY: Add version migration guide for upcoming v2 release1143. MEDIUM PRIORITY: Complete JSON-RPC documentation for remaining 5 methods1154. MEDIUM PRIORITY: Generate SDKs for additional languages (Ruby, PHP, Swift)1165. LOW PRIORITY: Add deprecation notices for endpoints scheduled for removal117118GENERATED ARTIFACTS:119────────────────────120• OpenAPI 3.0 specification: openapi.yaml121• Interactive API console: docs/api-console/index.html122• Client SDKs: sdk/javascript/, sdk/python/, sdk/go/123• API reference PDF: docs/api-reference.pdf124• Postman collection: docs/postman-collection.json125• cURL examples: docs/curl-examples.md126```127128## Notes129130- Documentation should be generated as close to the code as possible131- Interactive documentation increases API adoption and reduces support requests132- Consistency between API implementation and documentation is critical133- Consider documentation as part of the API development lifecycle134- Different API protocols may require different documentation approaches135- Version management helps consumers migrate between API versions136- Authentication and error handling are the most commonly referenced sections137- Regular documentation reviews help maintain accuracy and completeness