api-docs-generator
Skill340 starsChanged 7 months agoMITView on GitHub
Audits and enhances FastAPI and REST API documentation: missing descriptions, response codes, examples, docstrings, Pydantic models, OpenAPI spec. Triggers on: "generate API docs", "document this API", "OpenAPI for", "FastAPI docs", "document endpoints", "swagger docs".
We split this skill into the rules it gives an agent
3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 141
Document every error code: If the endpoint can return 404, document it.
- Distinctive: line 143
Consistent style: All endpoints in the same API should use the same documentation patterns — same tag naming, same description style, same …
- Very specific: line 145
Don't duplicate the type system: If the parameter type is int, don't write "An integer" as the description.
“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
API Docs Generator
Audits API endpoint documentation for completeness, generates enhanced docstrings with proper parameter descriptions and examples, documents all response codes, and produces Pydantic model examples — bridging the gap between auto-generated OpenAPI specs and genuinely useful API documentation.
Reference Files
| File | Contents | Load When |
references/fastapi-patterns.md | FastAPI-specific documentation patterns, Path/Query/Body parameter docs | FastAPI endpoint |
references/example-generation.md | Creating realistic field examples, model_config patterns | Example values needed |
references/response-codes.md | Standard HTTP response documentation, error response schemas | Response documentation needed |
references/openapi-enhancement.md | OpenAPI spec enrichment, tag organization, schema documentation | OpenAPI spec review |
Prerequisites
- Access to the API source code (route definitions, models)
- Framework identification (FastAPI, Flask, Django REST, Express)
Workflow
Phase 1: Analyze Endpoints
- Inventory endpoints — List all routes with HTTP method, path, handler function.
- Identify models — Request bodies (Pydantic models, dataclasses), response models, query parameters, path parameters.
- Map dependencies — Authentication requirements, middleware, shared dependencies.
- Read existing docs — Current docstrings, OpenAPI metadata, inline documentation.
Phase 2: Audit Documentation
For each endpoint, check:
| Check | What to Verify | Common Gap |
| Endpoint description | Handler has a docstring | Missing or "TODO" |
| Parameter descriptions | Each param has description= | Path params undocumented |
| Request example | Body model has example= or json_schema_extra | No request example |
| Response model | response_model= specified | Returns raw dict |
| Error responses | 4xx/5xx documented with responses= | Only 200 documented |
| Tags | Endpoint assigned to a tag group | Untagged endpoints |
Phase 3: Generate Enhancements
- Docstrings — Write clear endpoint descriptions that explain purpose, not implementation. Include Raises section for documented errors.
- Parameter metadata — Add
description,example,ge/le/regexto Path, Query, Body parameters. - Model examples — Add
Field(example=...)andmodel_configwithjson_schema_extra. - Error responses — Document every possible error status code with response schema.
- Tags — Group endpoints by resource or feature area.
Phase 4: Output
Produce a coverage report and enhanced code.
Output Format
## API Documentation Audit
### Coverage Summary
| Metric | Count | Documented | Coverage |
|--------|-------|------------|----------|
| Endpoints | {N} | {M} | {%} |
| Parameters | {N} | {M} | {%} |
| Response codes | {N} | {M} | {%} |
| Models with examples | {N} | {M} | {%} |
### Gaps Identified
| # | Endpoint | Issue | Severity |
|---|----------|-------|----------|
| 1 | `{METHOD} {path}` | {issue} | {High/Medium/Low} |
### Enhanced Code
#### `{METHOD} {path}`
```python
@router.{method}(
"{path}",
response_model={ResponseModel},
summary="{Short summary}",
responses={{
404: {{"description": "{Not found description}"}},
422: {{"description": "Validation error"}},
}},
tags=["{tag}"],
)
async def {handler}(
{param}: {type} = Path(..., description="{description}", example={example}),
) -> {ResponseModel}:
"""
{Full description of what this endpoint does.}
{Additional context about behavior, side effects, or important notes.}
Raises:
404: {Entity} not found
403: Insufficient permissions
"""Model: {ModelName}
class {ModelName}(BaseModel):
{field}: {type} = Field(..., description="{description}", example={example})
model_config = ConfigDict(
json_schema_extra={{
"example": {{
"{field}": {example_value},
}}
}}
)
## Calibration Rules
1. **Describe behavior, not implementation.** "Retrieves the user's profile" is good.
"Calls `db.query(User).filter_by(id=id).first()`" is implementation leakage.
2. **Realistic examples.** `"alice@example.com"` not `"string"`. `42` not `0`.
Examples serve as documentation — they should look like real data.
3. **Document every error code.** If the endpoint can return 404, document it. Users
should never encounter an undocumented error response.
4. **Consistent style.** All endpoints in the same API should use the same documentation
patterns — same tag naming, same description style, same example format.
5. **Don't duplicate the type system.** If the parameter type is `int`, don't write
"An integer" as the description. Write what the integer represents: "Unique user
identifier."
## Error Handling
| Problem | Resolution |
|---------|------------|
| Non-FastAPI framework | Adapt patterns. Document the HTTP contract regardless of framework. |
| No type hints on handlers | Infer types from usage, document uncertainty, suggest adding type hints. |
| Massive API (50+ endpoints) | Prioritize undocumented and public endpoints. Batch output by resource. |
| Generated API (OpenAPI → code) | Document at the spec level, not the generated code level. |
| Authentication varies by endpoint | Document auth requirements per endpoint group. |
## When NOT to Generate
Push back if:
- The API design itself is wrong (bad URL patterns, wrong HTTP methods) — fix the API first
- The user wants SDK generation from OpenAPI — different tool
- The code is a prototype that will change significantly — document after stabilizationOther versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- tomique34/claude-skill-creator★ 8same name
- Sagargupta16/agent-recipes★ 4same name
- vercel-labs/cooking-school-feedback★ 4same name
- Nembie/claude-code-skills★ 3same name
- dcs-soni/skills★ 1same name
- vercel/academy-starters★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository94 other files it gives its agents.
- AGENTS.mdAGENTS.md
- adr-writerSkill
- agent-builderSkill
- animateSkill
- appraiseSkill
- architecture-diagramSkill
- architecture-reviewerSkill
- arxiv-figuresSkill
- arxiv-packageSkill
- arxiv-preflightSkill
- benchmark-runnerSkill
- changelog-composerSkill
- chart-claritySkill
- citation-auditSkill
- codebase-advisorSkill
- code-refinerSkill
- competitive-analyzerSkill
- concept-to-imageSkill
- debug-investigatorSkill
- decision-mapSkill
- dependency-auditSkill
- devils-advocateSkill
- domain-modelingSkill
- engineering-retroSkill
- env-validatorSkill
- estimate-calibratorSkill
- feasibility-assessorSkill
- figure-rhetoricSkill
- figure-table-qualitySkill
- filesystemSkill
- githubSkill
- gpu-optimizerSkill
- handoffSkill
- html-presentationSkill
- html-videoSkill
- humanizeSkill
- idea-validatorSkill
- immuneSkill
- intakeSkill
- kg-builderSkill
- launch-videoSkill
- learning-workspaceSkill
- lightpanda-browserSkill
- linkedin-post-styleSkill
- literature-reviewSkill
- manuscript-provenanceSkill
- manuscript-reviewSkill
- manuscript-typographySkill
- market-analyzerSkill
- marp-slidesSkill
- mcp-to-skillSkill
- md-to-pdfSkill
- migration-risk-analyzerSkill
- milestone-runnerSkill
- module-deepeningSkill
- notebooklmSkill
- package-evaluatorSkill
- package-optimizerSkill
- paper-to-skillSkill
- plan-promptsSkill
- The first 60 shown.
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.

