/doc-api
Generate API documentation from code
$ npx -y skills add qdhenry/Claude-Command-Suite --agent claude-codeHow it fires
How this command gets triggered: by you, by Claude, or both.
- Fires itselfClaude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/doc-api
Context preview
What this command does when you run it.
Generate API documentation from code
Command definition
doc-api.mdAPI Documentation Generator Command
Generate API documentation from code
Instructions
Follow this systematic approach to create API documentation: **$ARGUMENTS**
1. **Code Analysis and Discovery**
- Scan the codebase for API endpoints, routes, and handlers
- Identify REST APIs, GraphQL schemas, and RPC services
- Map out controller classes, route definitions, and middleware
- Discover request/response models and data structures
2. **Documentation Tool Selection**
- Choose appropriate documentation tools based on stack:
- **OpenAPI/Swagger**: REST APIs with interactive documentation
- **GraphQL**: GraphiQL, GraphQL Playground, or Apollo Studio
- **Postman**: API collections and documentation
- **Insomnia**: API design and documentation
- **Redoc**: Alternative OpenAPI renderer
- **API Blueprint**: Markdown-based API documentation
3. **API Specification Generation**
**For REST APIs with OpenAPI:**
openapi: 3.0.0
info:
title: $ARGUMENTS API
version: 1.0.0
description: Comprehensive API for $ARGUMENTS
servers:
- url: https://api.example.com/v1
paths:
/users:
get:
summary: List users
parameters:
- name: page
in: query
schema:
type: integer
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
components:
schemas:
User:
type: object
properties:
id:
type: integer
name:
type: string
email:
type: string4. **Endpoint Documentation**
- Document all HTTP methods (GET, POST, PUT, DELETE, PATCH)
- Specify request parameters (path, query, header, body)
- Define response schemas and status codes
- Include error responses and error codes
- Document authentication and authorization requirements
5. **Request/Response Examples**
- Provide realistic request examples for each endpoint
- Include sample response data with proper formatting
- Show different response scenarios (success, error, edge cases)
- Document content types and encoding
6. **Authentication Documentation**
- Document authentication methods (API keys, JWT, OAuth)
- Explain authorization scopes and permissions
- Provide authentication examples and token formats
- Document session management and refresh token flows
7. **Data Model Documentation**
- Define all data schemas and models
- Document field types, constraints, and validation rules
- Include relationships between entities
- Provide example data structures
8. **Error Handling Documentation**
- Document all possible error responses
- Explain error codes and their meanings
- Provide troubleshooting guidance
- Include rate limiting and throttling information
9. **Interactive Documentation Setup**
**Swagger UI Integration:**
<!DOCTYPE html>
<html>
<head>
<title>API Documentation</title>
<link rel="stylesheet" type="text/css" href="./swagger-ui-bundle.css" />
</head>
<body>
<div id="swagger-ui"></div>
<script src="./swagger-ui-bundle.js"></script>
<script>
SwaggerUIBundle({
url: './api-spec.yaml',
dom_id: '#swagger-ui'
});
</script>
</body>
</html>10. **Code Annotation and Comments**
- Add inline documentation to API handlers
- Use framework-specific annotation tools:
- **Java**: @ApiOperation, @ApiParam (Swagger annotations)
- **Python**: Docstrings with FastAPI or Flask-RESTX
- **Node.js**: JSDoc comments with swagger-jsdoc
- **C#**: XML documentation comments
11. **Automated Documentation Generation**
**For Node.js/Express:**
const swaggerJsdoc = require('swagger-jsdoc');
const swaggerUi = require('swagger-ui-express');
const options = {
definition: {
openapi: '3.0.0',
info: {
title: 'API Documentation',
version: '1.0.0',
},
},
apis: ['./routes/*.js'],
};
const specs = swaggerJsdoc(options);
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(specs));12. **Testing Integration**
- Generate API test collections from documentation
- Include test scripts and validation rules
- Set up automated API testing
- Document test scenarios and expected outcomes
13. **Version Management**
- Document API versioning strategy
- Maintain documentation for multiple API versions
- Document deprecation timelines and migration guides
- Track breaking changes between versions
14. **Performance Documentation**
- Document rate limits and throttling policies
- Include performance benchmarks and SLAs
- Document caching strategies and headers
- Explain pagination and filtering options
15. **SDK and Client Library Documentation**
- Generate client libraries from API specifications
- Document SDK usage and examples
- Provide quickstart guides for different languages
- Include integration examples and best practices
16. **Environment-Specific Documentation**
- Document different environments (dev, staging, prod)
- Include environment-specific endpoints and configurations
- Document deployment and configuration requirements
- Provide environment setup instructions
17. **Security Documentation**
- Document security best practices
- Include CORS and CSP policies
- Document input validation and sanitization
- Explain security headers and their purposes
18. **Maintenance and Updates**
- Set up automated documentation updates
- Create processes for keeping document
Read more
API Documentation Generator Command
Generate API documentation from code
Instructions
Follow this systematic approach to create API documentation: **$ARGUMENTS**
1. **Code Analysis and Discovery**
- Scan the codebase for API endpoints, routes, and handlers
- Identify REST APIs, GraphQL schemas, and RPC services
- Map out controller classes, route definitions, and middleware
- Discover request/response models and data structures
2. **Documentation Tool Selection**
- Choose appropriate documentation tools based on stack:
- **OpenAPI/Swagger**: REST APIs with interactive documentation
- **GraphQL**: GraphiQL, GraphQL Playground, or Apollo Studio
- **Postman**: API collections and documentation
- **Insomnia**: API design and documentation
- **Redoc**: Alternative OpenAPI renderer
- **API Blueprint**: Markdown-based API documentation
3. **API Specification Generation**
**For REST APIs with OpenAPI:**
openapi: 3.0.0
info:
title: $ARGUMENTS API
version: 1.0.0
description: Comprehensive API for $ARGUMENTS
servers:
- url: https://api.example.com/v1
paths:
/users:
get:
summary: List users
parameters:
- name: page
in: query
schema:
type: integer
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
components:
schemas:
User:
type: object
properties:
id:
type: integer
name:
type: string
email:
type: string4. **Endpoint Documentation**
- Document all HTTP methods (GET, POST, PUT, DELETE, PATCH)
- Specify request parameters (path, query, header, body)
- Define response schemas and status codes
- Include error responses and error codes
- Document authentication and authorization requirements
5. **Request/Response Examples**
- Provide realistic request examples for each endpoint
- Include sample response data with proper formatting
- Show different response scenarios (success, error, edge cases)
- Document content types and encoding
6. **Authentication Documentation**
- Document authentication methods (API keys, JWT, OAuth)
- Explain authorization scopes and permissions
- Provide authentication examples and token formats
- Document session management and refresh token flows
7. **Data Model Documentation**
- Define all data schemas and models
- Document field types, constraints, and validation rules
- Include relationships between entities
- Provide example data structures
8. **Error Handling Documentation**
- Document all possible error responses
- Explain error codes and their meanings
- Provide troubleshooting guidance
- Include rate limiting and throttling information
9. **Interactive Documentation Setup**
**Swagger UI Integration:**
<!DOCTYPE html>
<html>
<head>
<title>API Documentation</title>
<link rel="stylesheet" type="text/css" href="./swagger-ui-bundle.css" />
</head>
<body>
<div id="swagger-ui"></div>
<script src="./swagger-ui-bundle.js"></script>
<script>
SwaggerUIBundle({
url: './api-spec.yaml',
dom_id: '#swagger-ui'
});
</script>
</body>
</html>10. **Code Annotation and Comments**
- Add inline documentation to API handlers
- Use framework-specific annotation tools:
- **Java**: @ApiOperation, @ApiParam (Swagger annotations)
- **Python**: Docstrings with FastAPI or Flask-RESTX
- **Node.js**: JSDoc comments with swagger-jsdoc
- **C#**: XML documentation comments
11. **Automated Documentation Generation**
**For Node.js/Express:**
const swaggerJsdoc = require('swagger-jsdoc');
const swaggerUi = require('swagger-ui-express');
const options = {
definition: {
openapi: '3.0.0',
info: {
title: 'API Documentation',
version: '1.0.0',
},
},
apis: ['./routes/*.js'],
};
const specs = swaggerJsdoc(options);
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(specs));12. **Testing Integration**
- Generate API test collections from documentation
- Include test scripts and validation rules
- Set up automated API testing
- Document test scenarios and expected outcomes
13. **Version Management**
- Document API versioning strategy
- Maintain documentation for multiple API versions
- Document deprecation timelines and migration guides
- Track breaking changes between versions
14. **Performance Documentation**
- Document rate limits and throttling policies
- Include performance benchmarks and SLAs
- Document caching strategies and headers
- Explain pagination and filtering options
15. **SDK and Client Library Documentation**
- Generate client libraries from API specifications
- Document SDK usage and examples
- Provide quickstart guides for different languages
- Include integration examples and best practices
16. **Environment-Specific Documentation**
- Document different environments (dev, staging, prod)
- Include environment-specific endpoints and configurations
- Document deployment and configuration requirements
- Provide environment setup instructions
17. **Security Documentation**
- Document security best practices
- Include CORS and CSP policies
- Document input validation and sanitization
- Explain security headers and their purposes
18. **Maintenance and Updates**
- Set up automated documentation updates
- Create processes for keeping document
A comprehensive development toolkit designed following Anthropic's Claude Code Best Practices for AI-assisted software development.
Repo: qdhenry/Claude-Command-Suite
Other commands on claude-command-suite.
- /boundary-bbcr-fallback
Execute automatic BBCR (Collapse-Rebirth Correction) when knowledge boundaries are exceeded or reasoning fails.
Open command - /boundary-detect
Analyze semantic position relative to knowledge boundaries to prevent hallucination and identify uncertainty zones.
Open command - /boundary-heatmap
Generate a visual heatmap of knowledge boundaries showing safe zones, risk areas, and semantic coverage.
Open command - /boundary-risk-assess
Evaluate the current risk level and provide detailed analysis of potential hallucination or reasoning failure.
Open command - /boundary-safe-bridge
Find and construct semantic bridges to safely navigate from current position to target concept without crossing dangerous boundaries.
Open command - /optimize-prompt
Takes an input prompt and returns ONLY a token-optimized version that preserves meaning while minimizing token count. Based on LLM tokenization principles: common words tokenize more efficiently, unusual words break into more tokens, and conciseness reduces cost.
Open command

