Skip to main content
skill CX Codex

adding-api-docs — Claude Code skill: OpenAPI docs for your API

This skill writes OpenAPI/Swagger documentation for an API: endpoint schemas, request and response types, and an interactive docs page.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add spencerpauly/awesome-cursor-skills --skill adding-api-docs -a claude-code
Open on GitHub

What adding-api-docs does

The skill triggers when you ask for API docs, Swagger, an OpenAPI spec, or endpoint documentation. It starts by detecting the framework: Express, Fastify, Next.js API routes, Hono, Django REST Framework, FastAPI and others.

What happens next depends on the stack. On Node.js/Express it installs swagger-jsdoc and swagger-ui-express, then builds the spec from JSDoc annotations above your route handlers. For Next.js API routes it creates an openapi.json file or generates one from handlers with next-swagger-doc, served at /api/docs. FastAPI already ships docs at /docs and /redoc, so the skill makes sure Pydantic models cover request and response types and the schemas come out on their own.

Separate steps cover the interactive UI (Swagger UI, Scalar or Redoc), request and response schemas via Zod or JSON Schema, and the auth scheme in securitySchemes. The skill tells you to generate the spec from code rather than hand-maintaining a YAML file — drift from the real API is what breaks these docs most often.

What it helps with

  • generate an OpenAPI spec from Express route handlers
  • serve Swagger UI at a /docs route
  • define request and response schemas with Zod
  • document Bearer token and OAuth2 in securitySchemes
  • wire next-swagger-doc into Next.js API routes

Example prompts for the agent

  • add API docs for my Express routes
  • generate an OpenAPI spec and serve Swagger UI at /docs
  • document the request and response schemas and the auth scheme

How to install adding-api-docs

1Skills CLI (Vercel)

npx skills add spencerpauly/awesome-cursor-skills --skill adding-api-docs -a claude-code

2Manually: put the files in place

~/.claude/skills/adding-api-docs/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/adding-api-docs/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about adding-api-docs

How do I install adding-api-docs in Claude?

Run npx skills add spencerpauly/awesome-cursor-skills --skill adding-api-docs -a claude-code. The skill lands in ~/.claude/skills/adding-api-docs/SKILL.md.

What does adding-api-docs do?

It generates OpenAPI/Swagger documentation for an API: endpoint schemas, request and response types, and an interactive UI. It handles Express, Fastify, Next.js API routes, Hono, Django REST Framework and FastAPI.

Do I still need a separate YAML spec file?

The skill recommends generating the spec from code where possible so it stays in sync with the actual API. A separate YAML file has to be updated by hand.

Source text

SKILL.md · CC0-1.0
---
name: adding-api-docs
description: Generate OpenAPI/Swagger documentation for an API, including endpoint schemas, request/response types, and interactive docs UI.
---

# Add API Documentation (OpenAPI)

Use this skill when the user asks to add API docs, Swagger, OpenAPI spec, or generate endpoint documentation.

## Steps

1. **Detect the API framework** — check for Express, Fastify, Next.js API routes, Hono, Django REST Framework, FastAPI, etc.

2. **For Node.js/Express** — install `swagger-jsdoc` and `swagger-ui-express`:

   ```bash
   npm install swagger-jsdoc swagger-ui-express
   npm install -D @types/swagger-jsdoc @types/swagger-ui-express
   ```

   Create the OpenAPI spec from JSDoc annotations on route handlers:

   ```ts
   /**
    * @openapi
    * /api/users:
    *   get:
    *     summary: List all users
    *     responses:
    *       200:
    *         description: A list of users
    */
   ```

3. **For Next.js API routes** — create an `openapi.json` file manually or use `next-swagger-doc` to generate from route handlers. Serve the spec at `/api/docs`.

4. **For FastAPI (Python)** — docs are built-in at `/docs` (Swagger UI) and `/redoc`. Ensure Pydantic models are used for request/response types so schemas are auto-generated.

5. **Add interactive docs UI** — serve Swagger UI at a `/docs` route, or use Scalar/Redoc for a modern alternative:

   ```bash
   npm install @scalar/express-api-reference
   ```

6. **Define schemas** — create Zod schemas (or JSON Schema) for request bodies and responses, then reference them in the OpenAPI spec. For TypeScript projects, use `zod-to-openapi` to generate schemas from existing Zod validators.

7. **Add authentication documentation** — document the auth scheme (Bearer token, API key, OAuth2) in the OpenAPI `securitySchemes` section.

## Notes

- Keep the spec in sync with the actual API — generate from code when possible rather than maintaining a separate YAML file.
- Add example values to schemas for better developer experience.
- Version the API docs alongside the code.

© spencerpauly · CC0-1.0 · spencerpauly/awesome-cursor-skills

Similar skills

Everything for Backend and APIs →

From the same set59

best-of-n-solving Runs two or three approaches to a hard problem at once, each in its own git worktree, then helps you pick the winner. CX Codex +1 425installs converting-css-to-tailwind This skill walks a plain CSS file and rewrites its rules as Tailwind utility classes in your markup. Handy when a project moves off hand-written CSS. CX Codex +1 423installs detecting-port-conflicts Detects EADDRINUSE and port conflicts in terminal output, identifies blocking processes with lsof, and kills them or picks an open port for your dev server. CX Codex +1 418installs setting-up-ci A skill that writes a GitHub Actions pipeline with linting, tests, type-checking and a deploy step. Useful when the repo has no CI yet. CX Codex +1 415installs parallel-test-fixing The skill runs your test suite and assigns each failing test file to a separate subagent for parallel fixes. It helps when multiple test files break simultaneously across a codebase. CX Codex +1 412installs profiling-performance This skill profiles web application CPU performance using browser MCP tools. It captures call stacks and pinpoints slow functions causing interface lag. CX Codex +1 410installs python-tdd-with-uv Runs your agent through red-green-refactor in Python and sets the project up on uv. Useful when tests come before the code. CX Codex +1 409installs recording-browser-flow-as-test Walks through browser interactions step by step via MCP and outputs a clean Playwright test based on accessibility tree selectors. CX Codex +1 406installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor