api-documentation-generator

Generates OpenAPI/Swagger documentation from API route files. Use when working with REST APIs, Express routes, FastAPI endpoints, or when user requests API documentation.

242 stars

Best use case

api-documentation-generator is best used when you need a repeatable AI agent workflow instead of a one-off prompt. It is especially useful for teams working in multi. Generates OpenAPI/Swagger documentation from API route files. Use when working with REST APIs, Express routes, FastAPI endpoints, or when user requests API documentation.

Generates OpenAPI/Swagger documentation from API route files. Use when working with REST APIs, Express routes, FastAPI endpoints, or when user requests API documentation.

Users should expect a more consistent workflow output, faster repeated execution, and less time spent rewriting prompts from scratch.

Practical example

Example input

Use the "api-documentation-generator" skill to help with this workflow task. Context: Generates OpenAPI/Swagger documentation from API route files. Use when working with REST APIs, Express routes, FastAPI endpoints, or when user requests API documentation.

Example output

A structured workflow result with clearer steps, more consistent formatting, and an output that is easier to reuse in the next run.

When to use this skill

  • Use this skill when you want a reusable workflow rather than writing the same prompt again and again.

When not to use this skill

  • Do not use this when you only need a one-off answer and do not need a reusable workflow.
  • Do not use it if you cannot install or maintain the related files, repository context, or supporting tools.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/api-documentation-generator/SKILL.md --create-dirs "https://raw.githubusercontent.com/aiskillstore/marketplace/main/skills/crazydubya/api-documentation-generator/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/api-documentation-generator/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How api-documentation-generator Compares

Feature / Agentapi-documentation-generatorStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Generates OpenAPI/Swagger documentation from API route files. Use when working with REST APIs, Express routes, FastAPI endpoints, or when user requests API documentation.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# API Documentation Generator

This skill automatically generates OpenAPI 3.0 (Swagger) documentation from API route files in your codebase.

## When to Use This Skill

- User asks to generate API documentation
- Working with REST API endpoints
- Need to create or update OpenAPI/Swagger specs
- Setting up API documentation for Express, FastAPI, Flask, NestJS, or similar frameworks

## Instructions

### 1. Discover API Routes

Search the codebase for API route definitions:

- **Express/Node.js**: Look for `app.get()`, `app.post()`, `router.get()`, etc.
- **FastAPI/Python**: Look for `@app.get()`, `@router.post()`, decorators
- **Flask**: Look for `@app.route()` decorators
- **NestJS**: Look for `@Get()`, `@Post()`, `@Controller()` decorators
- **Rails**: Look for routes in `config/routes.rb`

Use Glob to find route files (e.g., `**/*routes*.{js,ts,py}`, `**/controllers/**/*.{js,ts}`)

### 2. Analyze Route Patterns

For each discovered route, extract:

- **HTTP Method**: GET, POST, PUT, PATCH, DELETE
- **Path**: The endpoint URL (e.g., `/api/users/:id`)
- **Parameters**: Path params, query params, request body
- **Response**: Expected response structure
- **Authentication**: Whether auth is required
- **Description**: Comments or docstrings near the route

### 3. Generate OpenAPI Specification

Create or update an OpenAPI 3.0 specification file (typically `openapi.yaml` or `swagger.json`):

- Start with the template from `templates/openapi-3.0.yaml`
- Map each route to an OpenAPI path object
- Define request/response schemas using JSON Schema
- Include parameter definitions (path, query, body)
- Add authentication schemes if detected (Bearer, API Key, OAuth2)
- Group endpoints by tags (e.g., "Users", "Products", "Auth")

### 4. Validate Completeness

Check that the generated documentation includes:

- All discovered endpoints
- Accurate HTTP methods and paths
- Request/response examples where possible
- Error responses (400, 401, 404, 500, etc.)
- Security requirements

### 5. Output Location

- Save as `openapi.yaml` in the project root, or
- Place in `docs/` or `api/` directory if those exist
- Ask user for preferred location if unclear

## Framework-Specific Notes

### Express/Node.js
- Check for route middleware that might affect auth/validation
- Look for request validators (Joi, express-validator, etc.)
- Extract JSDoc comments for endpoint descriptions

### FastAPI
- FastAPI auto-generates OpenAPI docs, but this skill can enhance them
- Extract Pydantic models for request/response schemas
- Check for `response_model` and `status_code` parameters

### NestJS
- Look for DTOs (Data Transfer Objects) for schemas
- Check for Swagger decorators (`@ApiOperation`, `@ApiResponse`)
- Extract metadata from controller and method decorators

## Best Practices

1. **Use existing schemas**: If the codebase has TypeScript interfaces, Pydantic models, or similar, use them for accurate schemas
2. **Include examples**: Add request/response examples from tests if available
3. **Group logically**: Organize endpoints by resource or feature area using tags
4. **Version appropriately**: Use the API version from the codebase (e.g., "1.0.0")
5. **Add descriptions**: Use code comments/docstrings for endpoint descriptions

## Supporting Files

- `templates/openapi-3.0.yaml`: Base OpenAPI template
- `examples.md`: Framework-specific examples

Related Skills

game-test-case-generator

242
from aiskillstore/marketplace

基于需求文档(xls/csv)生成专业游戏测试用例,支持完整用例和快速测试点两种模式。当用户提到"游戏测试"、"测试用例生成"、"需求转测试用例"、上传需求文档或原型时使用此技能。

viral-generator-builder

242
from aiskillstore/marketplace

Expert in building shareable generator tools that go viral - name generators, quiz makers, avatar creators, personality tests, and calculator tools. Covers the psychology of sharing, viral mechanics, and building tools people can't resist sharing with friends. Use when: generator tool, quiz maker, name generator, avatar creator, viral tool.

k8s-manifest-generator

242
from aiskillstore/marketplace

Create production-ready Kubernetes manifests for Deployments, Services, ConfigMaps, and Secrets following best practices and security standards. Use when generating Kubernetes YAML manifests, creating K8s resources, or implementing production-grade Kubernetes configurations.

documentation-templates

242
from aiskillstore/marketplace

Documentation templates and structure guidelines. README, API docs, code comments, and AI-friendly documentation.

documentation-generation-doc-generate

242
from aiskillstore/marketplace

You are a documentation expert specializing in creating comprehensive, maintainable documentation from code. Generate API docs, architecture diagrams, user guides, and technical references using AI-powered analysis and industry best practices.

code-documentation-doc-generate

242
from aiskillstore/marketplace

You are a documentation expert specializing in creating comprehensive, maintainable documentation from code. Generate API docs, architecture diagrams, user guides, and technical references using AI-powered analysis and industry best practices.

code-documentation-code-explain

242
from aiskillstore/marketplace

You are a code education expert specializing in explaining complex code through clear narratives, visual diagrams, and step-by-step breakdowns. Transform difficult concepts into understandable explanations.

run-nx-generator

242
from aiskillstore/marketplace

Run Nx generators with prioritization for workspace-plugin generators. Use this when generating code, scaffolding new features, or automating repetitive tasks in the monorepo.

pptx-generator

242
from aiskillstore/marketplace

Generate, edit, and read PowerPoint presentations. Create from scratch with PptxGenJS (cover, TOC, content, section divider, summary slides), edit existing PPTX via XML workflows, or extract text with markitdown. Triggers: PPT, PPTX, PowerPoint, presentation, slide, deck, slides.

nano-image-generator

242
from aiskillstore/marketplace

Generate images using Nano Banana Pro (Gemini 3 Pro Preview). Use when creating app icons, logos, UI graphics, marketing banners, social media images, illustrations, diagrams, or any visual assets. Supports reference images for style transfer and character consistency. Triggers include phrases like 'generate an image', 'create a graphic', 'make an icon', 'design a logo', 'create a banner', 'same style as', 'keep the style', or any request needing visual content.

excalidraw-diagram-generator

242
from aiskillstore/marketplace

Generate Excalidraw diagrams from natural language descriptions. Use when asked to "create a diagram", "make a flowchart", "visualize a process", "draw a system architecture", "create a mind map", or "generate an Excalidraw file". Supports flowcharts, relationship diagrams, mind maps, and system architecture diagrams. Outputs .excalidraw JSON files that can be opened directly in Excalidraw.

tasks-generator

242
from aiskillstore/marketplace

Generate structured task roadmaps from project specifications. Use when the user asks to create tasks, sprint plans, roadmaps, or work breakdowns based on PRD (Product Requirements Document), Tech Specs, or UI/UX specs. Triggers include requests like "generate tasks from PRD", "create sprint plan", "break down this spec into tasks", "create a roadmap", or "plan the implementation".