API Documentation Generator
Skill9 starsChanged 8 months agoMITView on GitHub
Generates OpenAPI-compatible documentation for REST API endpoints from code or route definitions.
In this repository61 other files it gives its agents.
- Accessibility Audit HelperSkill
- Agent Context File WriterSkill
- Agent Evaluation Framework BuilderSkill
- AI Feature Spec WriterSkill
- REST API Endpoint DesignerSkill
- Architecture ExplainerSkill
- Article RepurposerSkill
- Auth Flow PlannerSkill
- Blog Outline GeneratorSkill
- Breaking Change DetectorSkill
- Bug Root Cause AnalyzerSkill
- Caching Strategy AdvisorSkill
- Changelog CuratorSkill
- Code Review ChecklistSkill
- Database Schema ReviewerSkill
- Docker Compose GeneratorSkill
- Documentation Gap FinderSkill
- Edge Case DiscoverySkill
- Error Log SummarizerSkill
- FAQ GeneratorSkill
- Flaky Test AnalyzerSkill
- Form UX OptimizerSkill
- Git Commit WriterSkill
- Hallucination Risk ReviewerSkill
- Hybrid Search ArchitectSkill
- Incident Postmortem WriterSkill
- Issue to PR PlannerSkill
- Landing Page Copy ImproverSkill
- LangGraph State Machine DesignerSkill
- LLM Cost OptimizerSkill
- LLM Tracing and Observability SetupSkill
- MCP Integration AssistantSkill
- MCP Server BuilderSkill
- Migration Guide WriterSkill
- Newsletter Summary WriterSkill
- Observability ChecklistSkill
- Playwright Test BuilderSkill
- PR Description WriterSkill
- Prompt Injection Defense AuditorSkill
- Prompt RefinerSkill
- Prompt Version Control WorkflowSkill
- RAG Chunking Strategy AdvisorSkill
- RAG Workflow PlannerSkill
- React Component ReviewerSkill
- README WriterSkill
- Refactor PlannerSkill
- Release Notes GeneratorSkill
- Responsive Layout ReviewerSkill
- SDK Quickstart WriterSkill
- SEO Content OptimizerSkill
- SEO Metadata GeneratorSkill
- Social Post Thread WriterSkill
- Sprint Summary GeneratorSkill
- SQL Query OptimizerSkill
- Stack Trace AnalyzerSkill
- Technical Blog Post WriterSkill
- Tech Debt AuditorSkill
- Troubleshooting Guide BuilderSkill
- Unit Test ImproverSkill
- Unit Test WriterSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 19
Use this when you have undocumented API code and need to produce accurate, usable API documentation quickly.
- Very specific: line 35
Add the "Prompt / Instructions" section to your .cursorrules file.
- Distinctive: line 43
When asked to generate API documentation, follow these steps:
- Very specific: line 59
If a Zod/Joi/Pydantic/serializer schema exists for the body or response, use it as the source of truth
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
API Documentation Generator
What this skill does
This skill reads REST API route handlers (Express, FastAPI, Go net/http, Rails, Django, or any framework) and generates complete OpenAPI 3.0 YAML documentation. It extracts paths, HTTP methods, path/query/body parameters, response shapes, and error codes, then writes properly structured YAML with example request and response bodies. The output can be loaded directly into Swagger UI, Redoc, or any OpenAPI-compatible tool.
Use this when you have undocumented API code and need to produce accurate, usable API documentation quickly.
How to use
Claude Code / Cline
Copy this file to .agents/skills/api-docs-generator/SKILL.md in your project root.
Then point the agent at your routes file and ask:
- "Use the API Documentation Generator skill on
server/routes.ts." - "Generate OpenAPI docs for all routes in
src/api/using the API Documentation Generator skill."
The agent will read the route files and any referenced handler functions to extract parameter and response shapes.
Cursor
Add the "Prompt / Instructions" section to your .cursorrules file. Open your routes file in the editor and ask Cursor to generate the OpenAPI YAML.
Codex
Paste your route definitions and handler code into the chat along with the instructions below. Include type definitions or schema files if they exist — they help Codex produce accurate request/response schemas.
The Prompt / Instructions for the Agent
When asked to generate API documentation, follow these steps:
- Read the route definitions. For each route, extract:
- HTTP method (GET, POST, PUT, PATCH, DELETE)
- Path, including path parameters (e.g.,
/users/:id→/users/{id}) - Router-level middleware (e.g., authentication guards — these become
securityentries) - The handler function name
- Read the handler functions. For each handler, extract:
- Path parameters (e.g.,
req.params.id) - Query parameters (e.g.,
req.query.page,req.query.limit) - Request body shape — read from validation schema (Zod, Joi, Pydantic, etc.) if present, otherwise infer from how
req.bodyfields are used - All
res.json()/return responseshapes — enumerate every response including error paths - HTTP status codes returned (
200,201,400,401,404,500, etc.)
- Path parameters (e.g.,
- Infer data types accurately:
- If a Zod/Joi/Pydantic/serializer schema exists for the body or response, use it as the source of truth
- Otherwise infer types from usage: string, number, boolean, array, object
- Mark fields as
requiredif they are destructured without a default or checked for presence - Note
nullable: trueon fields that may be null
- Write the OpenAPI 3.0 YAML with this structure:
openapi: "3.0.3"info: title, version, descriptionservers: include a localhost dev server at minimumpaths: one entry per routecomponents/schemas: reusable schema objects referenced with$refcomponents/securitySchemes: if auth middleware is detected (Bearer, API key, cookie)
- For each path entry, include:
summary: one sentence describing what the endpoint doesdescription: optional longer explanationparameters: path, query, and header params with name, in, required, schema, descriptionrequestBody: withcontent/application/json/schemaand a fully-formedexampleresponses: at minimum the success response and common error responses (400, 401, 404, 500)- Each response must have a
descriptionand acontent/application/json/schema
- Include realistic example values in request and response bodies. Do not use placeholder values like
"string"or0— use realistic data (e.g.,"john@example.com",42,"2026-03-15T12:00:00Z"). - Output the complete YAML in a single code block. Do not truncate.
Example
Input to Agent:
"Use the API Documentation Generator skill on this Express route:
router.post('/users', async (req, res) => { const { name, email, role } = req.body; if (!name || !email) return res.status(400).json({ error: 'name and email are required' }); const user = await db.users.create({ name, email, role: role ?? 'viewer' }); res.status(201).json({ id: user.id, name: user.name, email: user.email, role: user.role }); }); router.get('/users/:id', requireAuth, async (req, res) => { const user = await db.users.findById(req.params.id); if (!user) return res.status(404).json({ error: 'User not found' }); res.json({ id: user.id, name: user.name, email: user.email, role: user.role }); }); ```"
Output from Agent:
openapi: "3.0.3" info: title: Users API version: "1.0.0" description: Endpoints for managing users. servers: - url: http://localhost:3000 description: Local development components: securitySchemes: bearerAuth: type: http scheme: bearer schemas: User: type: object properties: id: type: string example: "usr_a1b2c3" name: type: string example: "Jane Smith" email: type: string format: email example: "jane@example.com" role: type: string enum: [viewer, admin] example: "viewer" Error: type: object properties: error: type: string paths: /users: post: summary: Create a new user requestBody: required: true content: application/json: schema: type: object required: [name, email] properties: name: type: string example: "Jane Smith" email: type: string format: email example: "jane@example.com" role: type: string enum: [viewer, admin] default: viewer responses: "201": description: User created successfully. content: application/json: schema: $ref: '#/components/schemas/User' "400": description: Missing required fields. content: application/json: schema: $ref: '#/components/schemas/Error' /users/{id}: get: summary: Get a user by ID security: - bearerAuth: [] parameters: - name: id in: path required: true schema: type: string example: "usr_a1b2c3" responses: "200": description: User found. content: application/json: schema: $ref: '#/components/schemas/User' "401": description: Not authenticated. "404": description: User not found. content: application/json: schema: $ref: '#/components/schemas/Error'
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

