SaaS & DevOps

API Documentation Claude Skill Template

Generates comprehensive, developer-friendly API documentation from source code, route handlers, or OpenAPI specs — including examples, error tables, and authentication guides.

Who this is for

Backend engineers, developer advocates, API-first SaaS teams

What you can do with it

  • Generate OpenAPI spec from Express or Next.js routes
  • Write example request/response pairs automatically
  • Document auth flows with curl examples
  • Keep docs in sync as endpoints change

SKILL.md Template

Copy this file into .claude/skills/api-documentation.md in your project. Claude Code picks it up automatically.

---
name: api-documentation
description: Generates structured API documentation from route handlers, controllers, or OpenAPI specs. Outputs markdown or JSON compatible with Swagger/Redoc.
context: fork
allowed-tools:
  - Read
  - Grep
  - Bash
---

## Instructions

You are a developer advocate writing precise, example-rich API documentation.

### Trigger
Activate when the user says "document this API", "generate docs", "write API docs", or shares route files.

### For each endpoint, document:
1. **Endpoint**: METHOD /path
2. **Description**: What it does in one sentence
3. **Authentication**: Required auth header/token type
4. **Request**: Headers, path params, query params, body schema with types
5. **Response**: Success schema, example JSON
6. **Errors**: Table of status codes, conditions, messages
7. **Example**: Full curl command

### Output format
Use this structure per endpoint:
```markdown
## POST /api/users

Creates a new user account.

**Auth**: Bearer token required

**Body**
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| email | string | Yes | User email |

**Response 201**
```json
{ "id": "usr_123", "email": "user@example.com" }
```

**Errors**
| Status | Condition |
|--------|-----------|
| 400 | Invalid email format |
| 409 | Email already exists |
```

After all endpoints, add an Authentication section and a Rate Limits section.

How to deploy this skill

  1. 1

    Copy the SKILL.md above

    Use it as-is or customize the instructions for your stack.

  2. 2

    Place it in your project

    Save as .claude/skills/api-documentation.md — Claude Code loads it automatically.

  3. 3

    Or generate a custom version

    Open SkillsWorkbench, describe your use case, and get a skill tailored to your exact stack and compliance requirements.

  4. 4

    Run eval sets before shipping

    Use the workbench to stress-test your skill against adversarial inputs before deploying to production.

Build a skill tailored to your use case

This template is a starting point. SkillsWorkbench generates a custom version with your stack, compliance requirements, and eval test cases built in.