{"id":"aa4da5c8-0108-4825-902f-32d721883b31","shortId":"YcFX89","kind":"skill","title":"API Documentation Generator","tagline":"Generates OpenAPI-compatible documentation for REST API endpoints from code or route definitions.","description":"# API Documentation Generator\n\n## What this skill does\n\nThis 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.\n\nUse this when you have undocumented API code and need to produce accurate, usable API documentation quickly.\n\n## How to use\n\n### Claude Code / Cline\n\nCopy this file to `.agents/skills/api-docs-generator/SKILL.md` in your project root.\n\nThen point the agent at your routes file and ask:\n- *\"Use the API Documentation Generator skill on `server/routes.ts`.\"*\n- *\"Generate OpenAPI docs for all routes in `src/api/` using the API Documentation Generator skill.\"*\n\nThe agent will read the route files and any referenced handler functions to extract parameter and response shapes.\n\n### Cursor\n\nAdd the \"Prompt / Instructions\" section to your `.cursorrules` file. Open your routes file in the editor and ask Cursor to generate the OpenAPI YAML.\n\n### Codex\n\nPaste 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.\n\n## The Prompt / Instructions for the Agent\n\nWhen asked to generate API documentation, follow these steps:\n\n1. **Read the route definitions.** For each route, extract:\n   - HTTP method (GET, POST, PUT, PATCH, DELETE)\n   - Path, including path parameters (e.g., `/users/:id` → `/users/{id}`)\n   - Router-level middleware (e.g., authentication guards — these become `security` entries)\n   - The handler function name\n\n2. **Read the handler functions.** For each handler, extract:\n   - Path parameters (e.g., `req.params.id`)\n   - Query parameters (e.g., `req.query.page`, `req.query.limit`)\n   - Request body shape — read from validation schema (Zod, Joi, Pydantic, etc.) if present, otherwise infer from how `req.body` fields are used\n   - All `res.json()` / `return response` shapes — enumerate every response including error paths\n   - HTTP status codes returned (`200`, `201`, `400`, `401`, `404`, `500`, etc.)\n\n3. **Infer data types accurately:**\n   - If a Zod/Joi/Pydantic/serializer schema exists for the body or response, use it as the source of truth\n   - Otherwise infer types from usage: string, number, boolean, array, object\n   - Mark fields as `required` if they are destructured without a default or checked for presence\n   - Note `nullable: true` on fields that may be null\n\n4. **Write the OpenAPI 3.0 YAML** with this structure:\n   - `openapi: \"3.0.3\"`\n   - `info`: title, version, description\n   - `servers`: include a localhost dev server at minimum\n   - `paths`: one entry per route\n   - `components/schemas`: reusable schema objects referenced with `$ref`\n   - `components/securitySchemes`: if auth middleware is detected (Bearer, API key, cookie)\n\n5. **For each path entry, include:**\n   - `summary`: one sentence describing what the endpoint does\n   - `description`: optional longer explanation\n   - `parameters`: path, query, and header params with name, in, required, schema, description\n   - `requestBody`: with `content/application/json/schema` and a fully-formed `example`\n   - `responses`: at minimum the success response and common error responses (400, 401, 404, 500)\n   - Each response must have a `description` and a `content/application/json/schema`\n\n6. **Include realistic example values** in request and response bodies. Do not use placeholder values like `\"string\"` or `0` — use realistic data (e.g., `\"john@example.com\"`, `42`, `\"2026-03-15T12:00:00Z\"`).\n\n7. **Output the complete YAML** in a single code block. Do not truncate.\n\n## Example\n\n**Input to Agent:**\n> \"Use the API Documentation Generator skill on this Express route:\n>\n> ```ts\n> router.post('/users', async (req, res) => {\n>   const { name, email, role } = req.body;\n>   if (!name || !email) return res.status(400).json({ error: 'name and email are required' });\n>   const user = await db.users.create({ name, email, role: role ?? 'viewer' });\n>   res.status(201).json({ id: user.id, name: user.name, email: user.email, role: user.role });\n> });\n>\n> router.get('/users/:id', requireAuth, async (req, res) => {\n>   const user = await db.users.findById(req.params.id);\n>   if (!user) return res.status(404).json({ error: 'User not found' });\n>   res.json({ id: user.id, name: user.name, email: user.email, role: user.role });\n> });\n> ```\"\n\n**Output from Agent:**\n> ```yaml\n> openapi: \"3.0.3\"\n> info:\n>   title: Users API\n>   version: \"1.0.0\"\n>   description: Endpoints for managing users.\n> servers:\n>   - url: http://localhost:3000\n>     description: Local development\n> components:\n>   securitySchemes:\n>     bearerAuth:\n>       type: http\n>       scheme: bearer\n>   schemas:\n>     User:\n>       type: object\n>       properties:\n>         id:\n>           type: string\n>           example: \"usr_a1b2c3\"\n>         name:\n>           type: string\n>           example: \"Jane Smith\"\n>         email:\n>           type: string\n>           format: email\n>           example: \"jane@example.com\"\n>         role:\n>           type: string\n>           enum: [viewer, admin]\n>           example: \"viewer\"\n>     Error:\n>       type: object\n>       properties:\n>         error:\n>           type: string\n> paths:\n>   /users:\n>     post:\n>       summary: Create a new user\n>       requestBody:\n>         required: true\n>         content:\n>           application/json:\n>             schema:\n>               type: object\n>               required: [name, email]\n>               properties:\n>                 name:\n>                   type: string\n>                   example: \"Jane Smith\"\n>                 email:\n>                   type: string\n>                   format: email\n>                   example: \"jane@example.com\"\n>                 role:\n>                   type: string\n>                   enum: [viewer, admin]\n>                   default: viewer\n>       responses:\n>         \"201\":\n>           description: User created successfully.\n>           content:\n>             application/json:\n>               schema:\n>                 $ref: '#/components/schemas/User'\n>         \"400\":\n>           description: Missing required fields.\n>           content:\n>             application/json:\n>               schema:\n>                 $ref: '#/components/schemas/Error'\n>   /users/{id}:\n>     get:\n>       summary: Get a user by ID\n>       security:\n>         - bearerAuth: []\n>       parameters:\n>         - name: id\n>           in: path\n>           required: true\n>           schema:\n>             type: string\n>           example: \"usr_a1b2c3\"\n>       responses:\n>         \"200\":\n>           description: User found.\n>           content:\n>             application/json:\n>               schema:\n>                 $ref: '#/components/schemas/User'\n>         \"401\":\n>           description: Not authenticated.\n>         \"404\":\n>           description: User not found.\n>           content:\n>             application/json:\n>               schema:\n>                 $ref: '#/components/schemas/Error'\n> ```","tags":["api","docs","generator","openagentskills","notysoty","agent-skills","claude","claude-code","claude-skills","cline","cursor","llm"],"capabilities":["skill","source-notysoty","skill-api-docs-generator","topic-agent-skills","topic-claude","topic-claude-code","topic-claude-skills","topic-cline","topic-cursor","topic-llm","topic-llm-skills","topic-skills"],"categories":["openagentskills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/Notysoty/openagentskills/api-docs-generator","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add Notysoty/openagentskills","source_repo":"https://github.com/Notysoty/openagentskills","install_from":"skills.sh"}},"qualityScore":"0.454","qualityRationale":"deterministic score 0.45 from registry signals: · indexed on github topic:agent-skills · 8 github stars · SKILL.md body (7,331 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T19:13:20.113Z","embedding":null,"createdAt":"2026-05-18T13:20:40.462Z","updatedAt":"2026-05-18T19:13:20.113Z","lastSeenAt":"2026-05-18T19:13:20.113Z","tsv":"'-03':531 '-15':532 '/components/schemas/error':769,817 '/components/schemas/user':759,803 '/users':262,264,565,608,709,770 '0':523 '00':534 '00z':535 '1':241 '1.0.0':649 '2':281 '200':335,795 '201':336,597,750 '2026':530 '3':342 '3.0':45,402 '3.0.3':408,643 '3000':658 '4':398 '400':337,492,579,760 '401':338,493,804 '404':339,494,623,808 '42':529 '5':443 '500':340,495 '6':505 '7':536 'a1b2c3':679,793 'accur':99,223,346 'add':170 'admin':698,746 'agent':122,152,231,552,640 'agents/skills/api-docs-generator/skill.md':114 'along':205 'api':1,11,18,29,93,101,131,147,236,440,555,647 'application/json':720,756,766,800,814 'array':372 'ask':128,187,233 'async':566,611 'auth':435 'authent':271,807 'await':589,616 'bearer':439,668 'bearerauth':664,780 'becom':274 'block':545 'bodi':70,300,354,514 'boolean':371 'chat':204 'check':386 'claud':107 'cline':109 'code':14,59,94,108,201,333,544 'codex':194,221 'common':489 'compat':7,85 'complet':43,539 'compon':662 'components/schemas':426 'components/securityschemes':433 'const':569,587,614 'content':719,755,765,799,813 'content/application/json/schema':475,504 'cooki':442 'copi':110 'creat':712,753 'cursor':169,188 'cursorrul':177 'data':344,526 'db.users.create':590 'db.users.findbyid':617 'default':384,747 'definit':17,198,212,245 'delet':256 'describ':452 'descript':412,457,472,501,650,659,751,761,796,805,809 'destructur':381 'detect':438 'dev':417 'develop':661 'direct':76 'django':37 'doc':139 'document':2,8,19,47,102,132,148,237,556 'e.g':261,270,292,296,527 'editor':185 'email':571,576,584,592,603,634,686,690,726,734,738 'endpoint':12,455,651 'entri':276,423,447 'enum':696,744 'enumer':325 'error':58,329,490,581,625,701,705 'etc':309,341 'everi':326 'exampl':66,481,508,549,677,683,691,699,731,739,791 'exist':218,351 'explan':460 'express':32,561 'extract':49,164,249,289 'fastapi':33 'field':317,375,393,764 'file':112,126,157,178,182,215 'follow':238 'form':480 'format':689,737 'found':628,798,812 'framework':40 'fulli':479 'fully-form':478 'function':162,279,285 'generat':3,4,20,42,133,137,149,190,235,557 'get':252,772,774 'go':34 'guard':272 'handler':31,161,200,278,284,288 'header':465 'help':220 'http':51,250,331,666 'id':263,265,599,609,630,674,771,778,783 'includ':210,258,328,414,448,506 'infer':313,343,365 'info':409,644 'input':550 'instruct':173,208,228 'jane':684,732 'jane@example.com':692,740 'john@example.com':528 'joi':307 'json':580,598,624 'key':441 'level':268 'like':520 'load':75 'local':660 'localhost':416,657 'longer':459 'manag':653 'mark':374 'may':395 'method':52,251 'middlewar':269,436 'minimum':420,484 'miss':762 'must':498 'name':280,468,570,575,582,591,601,632,680,725,728,782 'need':96 'net/http':35 'new':714 'note':389 'null':397 'nullabl':390 'number':370 'object':373,429,672,703,723 'one':422,450 'open':179 'openapi':6,44,84,138,192,401,407,642 'openapi-compat':5,83 'option':458 'otherwis':312,364 'output':72,537,638 'param':466 'paramet':54,165,260,291,295,461,781 'past':195 'patch':255 'path':50,257,259,290,330,421,446,462,708,785 'path/query/body':53 'per':424 'placehold':518 'point':120 'post':253,710 'presenc':388 'present':311 'produc':98,222 'project':117 'prompt':172,227 'proper':62 'properti':673,704,727 'put':254 'pydant':308 'queri':294,463 'quick':103 'rail':36 'read':27,154,242,282,302 'realist':507,525 'redoc':80 'ref':432,758,768,802,816 'referenc':160,430 'req':567,612 'req.body':316,573 'req.params.id':293,618 'req.query.limit':298 'req.query.page':297 'request':67,299,511 'request/response':224 'requestbodi':473,716 'requir':377,470,586,717,724,763,786 'requireauth':610 'res':568,613 'res.json':321,629 'res.status':578,596,622 'respons':55,69,167,323,327,356,482,487,491,497,513,749,794 'rest':10,28 'return':322,334,577,621 'reusabl':427 'role':572,593,594,605,636,693,741 'root':118 'rout':16,30,125,142,156,181,197,244,248,425,562 'router':267 'router-level':266 'router.get':607 'router.post':564 'schema':214,225,305,350,428,471,669,721,757,767,788,801,815 'scheme':667 'section':174 'secur':275,779 'securityschem':663 'sentenc':451 'server':413,418,655 'server/routes.ts':136 'shape':56,168,301,324 'singl':543 'skill':23,26,134,150,558 'skill-api-docs-generator' 'smith':685,733 'sourc':361 'source-notysoty' 'src/api':144 'status':332 'step':240 'string':369,521,676,682,688,695,707,730,736,743,790 'structur':63,406 'success':486,754 'summari':449,711,773 'swagger':78 't12':533 'titl':410,645 'tool':86 'topic-agent-skills' 'topic-claude' 'topic-claude-code' 'topic-claude-skills' 'topic-cline' 'topic-cursor' 'topic-llm' 'topic-llm-skills' 'topic-skills' 'true':391,718,787 'truncat':548 'truth':363 'ts':563 'type':211,345,366,665,671,675,681,687,694,702,706,722,729,735,742,789 'ui':79 'undocu':92 'url':656 'usabl':100 'usag':368 'use':87,106,129,145,319,357,517,524,553 'user':588,615,620,626,646,654,670,715,752,776,797,810 'user.email':604,635 'user.id':600,631 'user.name':602,633 'user.role':606,637 'usr':678,792 'valid':304 'valu':509,519 'version':411,648 'viewer':595,697,700,745,748 'without':382 'write':61,399 'yaml':46,64,193,403,540,641 'zod':306 'zod/joi/pydantic/serializer':349","prices":[{"id":"21d73993-c9aa-4a9d-be5b-63a42822b7cb","listingId":"aa4da5c8-0108-4825-902f-32d721883b31","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"Notysoty","category":"openagentskills","install_from":"skills.sh"},"createdAt":"2026-05-18T13:20:40.462Z"}],"sources":[{"listingId":"aa4da5c8-0108-4825-902f-32d721883b31","source":"github","sourceId":"Notysoty/openagentskills/api-docs-generator","sourceUrl":"https://github.com/Notysoty/openagentskills/tree/main/skills/api-docs-generator","isPrimary":false,"firstSeenAt":"2026-05-18T13:20:40.462Z","lastSeenAt":"2026-05-18T19:13:20.113Z"}],"details":{"listingId":"aa4da5c8-0108-4825-902f-32d721883b31","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"Notysoty","slug":"api-docs-generator","github":{"repo":"Notysoty/openagentskills","stars":8,"topics":["agent-skills","claude","claude-code","claude-skills","cline","cursor","llm","llm-skills","skills"],"license":"mit","html_url":"https://github.com/Notysoty/openagentskills","pushed_at":"2026-03-28T06:50:19Z","description":"A  community-driven library of reusable AI agent skills for Claude Code, Cursor, Codex, Cline, and more.","skill_md_sha":"e0d60f965f00c9d5fbe6dacb8d7ebec86fabce10","skill_md_path":"skills/api-docs-generator/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/Notysoty/openagentskills/tree/main/skills/api-docs-generator"},"layout":"multi","source":"github","category":"openagentskills","frontmatter":{"name":"API Documentation Generator","description":"Generates OpenAPI-compatible documentation for REST API endpoints from code or route definitions."},"skills_sh_url":"https://skills.sh/Notysoty/openagentskills/api-docs-generator"},"updatedAt":"2026-05-18T19:13:20.113Z"}}