From all-commands
Scans a codebase for API endpoints and generates structured documentation with OpenAPI specs, request/response examples, and authentication details.
How this command is triggered — by the user, by Claude, or both
Slash command
/all-commands:doc-api 1. **Code Analysis and Discovery**Files this command reads when invoked
The summary Claude sees in its command listing — used to decide when to auto-load this command
# 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 inte...Generate API documentation from code
Follow this systematic approach to create API documentation: $ARGUMENTS
Code Analysis and Discovery
Documentation Tool Selection
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: string
Endpoint Documentation
Request/Response Examples
Authentication Documentation
Data Model Documentation
Error Handling Documentation
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>
Code Annotation and Comments
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));
Testing Integration
Version Management
Performance Documentation
SDK and Client Library Documentation
Environment-Specific Documentation
Security Documentation
Maintenance and Updates
Framework-Specific Examples:
FastAPI (Python):
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI(title="My API", version="1.0.0")
class User(BaseModel):
id: int
name: str
email: str
@app.get("/users/{user_id}", response_model=User)
async def get_user(user_id: int):
"""Get a user by ID."""
return {"id": user_id, "name": "John", "email": "[email protected]"}
Spring Boot (Java):
@RestController
@Api(tags = "Users")
public class UserController {
@GetMapping("/users/{id}")
@ApiOperation(value = "Get user by ID")
public ResponseEntity<User> getUser(
@PathVariable @ApiParam("User ID") Long id) {
// Implementation
}
}
Remember to keep documentation up-to-date with code changes and make it easily accessible to both internal teams and external consumers.
npx claudepluginhub davepoon/buildwithclaude --plugin all-commands2plugins reuse this command
First indexed Jan 8, 2026
/doc-apiScans a codebase for API endpoints and generates structured documentation with OpenAPI specs, request/response examples, and authentication details.
/generate-api-docsGenerates API documentation from source code — produces OpenAPI 3.0 specs, interactive Swagger UI and ReDoc, TypeScript definitions, and Postman collections with authentication and example support.
/generate-api-docsGenerates OpenAPI 3.0 specification and human-readable API docs from codebase, scanning endpoints, extracting schemas, adding examples and errors.
/generate-api-docsGenerates OpenAPI 3.0 spec and interactive docs from existing APIs via endpoint analysis, schema extraction, and Swagger UI deployment. Also generates test collections and client SDKs.
/api-docsScans source code routes and type definitions to generate structured API reference documentation with endpoints, request/response schemas, and code examples.
/generate-api-refScans source code and route definitions to detect the API framework, extracts endpoints with methods, parameters, schemas, and auth, then generates a structured Markdown API reference document.