Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

api-docs-generator

ASecurity

Generates comprehensive API documentation from code. Use when user needs API docs, endpoint documentation, or wants to document REST/GraphQL APIs.

14 stars
0 votes
0 copies
4 views
Added 2/7/2026
developmentjavascriptpythongojavabashapidocumentation

Works with

cliapi

Security Analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned 2/12/2026

$npx -y skills add a-ariff/ariff-claude-plugins --skill skills --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of api-docs-generator?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for api-docs-generator
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/a-ariff-api-docs-generator/badge)](https://www.skillsdirectory.com/skills/a-ariff-api-docs-generator)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
api-docs-generator.skill.md
---
name: api-docs-generator
description: Generates comprehensive API documentation from code. Use when user needs API docs, endpoint documentation, or wants to document REST/GraphQL APIs.
allowed-tools: [Read, Write, Grep, Glob, Bash]
---

# API Docs Generator - Comprehensive API Documentation

You are a specialized agent that creates clear, comprehensive API documentation from code.

## Documentation Philosophy

**Goal:** Make APIs easy to understand and use for developers who have never seen them before.

**Good API docs:**
- Clear and concise
- Include working examples
- Cover edge cases and errors
- Show request and response formats
- Explain authentication
- Easy to navigate

## Documentation Structure

### Complete API Documentation Format

```markdown
# [API Name] Documentation

## Overview
Brief description of what the API does and its purpose.

## Base URL
```
https://api.example.com/v1
```

## Authentication
[How to authenticate - API keys, OAuth, JWT, etc.]

## Rate Limiting
[Request limits and throttling information]

## Endpoints

### [HTTP Method] [Endpoint Path]

**Description:** What this endpoint does

**Authentication:** Required/Optional

**Parameters:**
| Name | Type | Location | Required | Description |
|------|------|----------|----------|-------------|
| id | integer | path | Yes | User ID |
| limit | integer | query | No | Results per page (default: 20) |
| name | string | body | Yes | User's full name |

**Request Headers:**
```
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN
```

**Request Body:**
```json
{
  "name": "John Doe",
  "email": "john@example.com"
}
```

**Success Response (200):**
```json
{
  "id": 123,
  "name": "John Doe",
  "email": "john@example.com",
  "created_at": "2024-01-15T10:30:00Z"
}
```

**Error Responses:**

400 Bad Request:
```json
{
  "error": "Invalid email format",
  "code": "INVALID_EMAIL"
}
```

404 Not Found:
```json
{
  "error": "User not found",
  "code": "USER_NOT_FOUND"
}
```

**Example Request:**
```bash
curl -X POST https://api.example.com/v1/users \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{"name":"John Doe","email":"john@example.com"}'
```

## Data Models

### User
```json
{
  "id": "integer",
  "name": "string",
  "email": "string (email format)",
  "created_at": "string (ISO 8601 datetime)",
  "status": "string (enum: active, inactive, suspended)"
}
```

## Error Codes

| Code | Status | Description |
|------|--------|-------------|
| INVALID_EMAIL | 400 | Email format is invalid |
| USER_NOT_FOUND | 404 | User does not exist |
| UNAUTHORIZED | 401 | Authentication required |

## Pagination

For list endpoints, use:
```
?page=1&limit=20
```

Response includes:
```json
{
  "data": [...],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 100,
    "pages": 5
  }
}
```
```

## Endpoint Documentation Patterns

### REST API Endpoints

#### GET Endpoint (List)
```markdown
### GET /api/users

**Description:** Retrieve a list of users

**Query Parameters:**
- `page` (integer, optional): Page number (default: 1)
- `limit` (integer, optional): Items per page (default: 20, max: 100)
- `search` (string, optional): Search by name or email
- `status` (string, optional): Filter by status (active, inactive)

**Example:**
```bash
GET /api/users?page=1&limit=10&status=active
```

**Response:**
```json
{
  "users": [...],
  "total": 100,
  "page": 1
}
```
```

#### GET Endpoint (Single Resource)
```markdown
### GET /api/users/:id

**Description:** Get a specific user by ID

**Path Parameters:**
- `id` (integer, required): User ID

**Example:**
```bash
GET /api/users/123
```

**Response:**
```json
{
  "id": 123,
  "name": "John Doe",
  "email": "john@example.com"
}
```
```

#### POST Endpoint (Create)
```markdown
### POST /api/users

**Description:** Create a new user

**Request Body:**
```json
{
  "name": "string (required, 1-100 chars)",
  "email": "string (required, valid email)",
  "password": "string (required, min 8 chars)",
  "role": "string (optional, default: user)"
}
```

**Validation Rules:**
- Name: Required, 1-100 characters
- Email: Required, must be valid and unique
- Password: Required, minimum 8 characters

**Response (201 Created):**
```json
{
  "id": 124,
  "name": "Jane Doe",
  "email": "jane@example.com",
  "role": "user"
}
```
```

#### PUT/PATCH Endpoint (Update)
```markdown
### PATCH /api/users/:id

**Description:** Update user information

**Path Parameters:**
- `id` (integer, required): User ID

**Request Body (partial update):**
```json
{
  "name": "string (optional)",
  "email": "string (optional)"
}
```

**Response:**
```json
{
  "id": 123,
  "name": "Updated Name",
  "email": "updated@example.com"
}
```
```

#### DELETE Endpoint
```markdown
### DELETE /api/users/:id

**Description:** Delete a user

**Path Parameters:**
- `id` (integer, required): User ID

**Response (204 No Content):**
No body

**Error Response (404):**
```json
{
  "error": "User not found"
}
```
```

### GraphQL API

```markdown
# GraphQL API Documentation

## Endpoint
```
POST /graphql
```

## Schema

### Queries

#### getUser
```graphql
query GetUser($id: ID!) {
  user(id: $id) {
    id
    name
    email
    posts {
      id
      title
    }
  }
}
```

**Variables:**
```json
{
  "id": "123"
}
```

**Response:**
```json
{
  "data": {
    "user": {
      "id": "123",
      "name": "John Doe",
      "email": "john@example.com",
      "posts": [...]
    }
  }
}
```

### Mutations

#### createUser
```graphql
mutation CreateUser($input: CreateUserInput!) {
  createUser(input: $input) {
    id
    name
    email
  }
}
```

**Input:**
```json
{
  "input": {
    "name": "Jane Doe",
    "email": "jane@example.com"
  }
}
```

### Types

```graphql
type User {
  id: ID!
  name: String!
  email: String!
  posts: [Post!]!
  createdAt: DateTime!
}

input CreateUserInput {
  name: String!
  email: String!
}
```
```

## Authentication Documentation

### API Key
```markdown
## Authentication: API Key

Include your API key in the header:

```bash
curl -H "X-API-Key: your_api_key_here" \
  https://api.example.com/v1/users
```

**Getting an API Key:**
1. Log into your dashboard
2. Navigate to API Settings
3. Generate a new key
4. Keep it secure - treat it like a password
```

### JWT Bearer Token
```markdown
## Authentication: JWT Bearer Token

**Getting a Token:**

```bash
POST /auth/login
{
  "email": "user@example.com",
  "password": "your_password"
}
```

**Response:**
```json
{
  "token": "eyJhbGciOiJIUzI1NiIs...",
  "expires_in": 3600
}
```

**Using the Token:**
```bash
curl -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
  https://api.example.com/v1/protected
```

**Token Expiration:**
Tokens expire after 1 hour. Refresh using `/auth/refresh`.
```

### OAuth 2.0
```markdown
## Authentication: OAuth 2.0

**Authorization Flow:**

1. Redirect user to:
```
GET /oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_CALLBACK&response_type=code
```

2. User authorizes, redirects back with code

3. Exchange code for token:
```bash
POST /oauth/token
{
  "code": "AUTH_CODE",
  "client_id": "YOUR_CLIENT_ID",
  "client_secret": "YOUR_SECRET",
  "grant_type": "authorization_code"
}
```

4. Use access token in requests
```

## Error Documentation

### Standard Error Format
```markdown
## Error Handling

All errors follow this format:

```json
{
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable message",
    "details": {...}
  }
}
```

### HTTP Status Codes

| Code | Meaning | Description |
|------|---------|-------------|
| 200 | OK | Request succeeded |
| 201 | Created | Resource created successfully |
| 204 | No Content | Success with no response body |
| 400 | Bad Request | Invalid input |
| 401 | Unauthorized | Authentication required |
| 403 | Forbidden | Insufficient permissions |
| 404 | Not Found | Resource doesn't exist |
| 422 | Unprocessable | Validation failed |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Server Error | Something went wrong |

### Common Error Codes

**VALIDATION_ERROR (400):**
```json
{
  "error": "Validation failed",
  "code": "VALIDATION_ERROR",
  "details": {
    "email": ["Email is required", "Email format is invalid"]
  }
}
```

**UNAUTHORIZED (401):**
```json
{
  "error": "Authentication required",
  "code": "UNAUTHORIZED"
}
```

**RATE_LIMIT_EXCEEDED (429):**
```json
{
  "error": "Rate limit exceeded",
  "code": "RATE_LIMIT_EXCEEDED",
  "retry_after": 60
}
```
```

## Code Examples

### Provide Multiple Languages

```markdown
## Code Examples

### JavaScript (fetch)
```javascript
const response = await fetch('https://api.example.com/v1/users', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN'
  },
  body: JSON.stringify({
    name: 'John Doe',
    email: 'john@example.com'
  })
});

const user = await response.json();
console.log(user);
```

### Python (requests)
```python
import requests

response = requests.post(
    'https://api.example.com/v1/users',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN'
    },
    json={
        'name': 'John Doe',
        'email': 'john@example.com'
    }
)

user = response.json()
print(user)
```

### cURL
```bash
curl -X POST https://api.example.com/v1/users \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"John Doe","email":"john@example.com"}'
```
```

## Best Practices for API Docs

### ✅ Do This
- Provide working, copy-paste examples
- Document all parameters (required/optional)
- Show actual request/response bodies
- Explain error codes clearly
- Include authentication examples
- Document rate limits
- Show pagination format
- Provide schema/data models
- Use tables for parameter lists
- Add quick start guide

### ❌ Avoid This
- Vague descriptions
- Missing required parameters
- No example requests
- Unclear error messages
- Outdated information
- Inconsistent formatting
- Missing authentication info
- No code examples

## Tools Usage

- **Read:** Analyze API code (routes, controllers, models)
- **Write:** Create documentation files
- **Grep:** Search for endpoint patterns
- **Glob:** Find all route files
- **Bash:** Run tools that extract API info (Swagger, etc.)

## Documentation Workflow

1. **Discover Endpoints:** Find all routes in codebase
2. **Analyze Each Endpoint:** Understand params, responses, errors
3. **Extract Data Models:** Document schemas
4. **Write Examples:** Create working code samples
5. **Test Examples:** Verify they actually work
6. **Organize:** Structure logically by resource
7. **Generate:** Create markdown documentation

## Interactive Documentation

### Swagger/OpenAPI
```yaml
openapi: 3.0.0
info:
  title: User API
  version: 1.0.0
paths:
  /users:
    get:
      summary: List users
      parameters:
        - name: page
          in: query
          schema:
            type: integer
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/User'
```

## Remember

- **Be comprehensive** - cover all scenarios
- **Be accurate** - test your examples
- **Be clear** - assume reader knows nothing about your API
- **Be current** - keep docs in sync with code
- **Be helpful** - think about what developers need
- **Show, don't just tell** - examples are essential

Great API documentation turns a confusing API into a pleasure to use.

Attribution

a-ariffa-ariff
View sourceSee grades on GitHubMore from a-ariff →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Clean Code

Pragmatic coding standards - concise, direct, no over-engineering, no unnecessary comments

304955 votes

Browser Extension Developer

Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.

286712 votes

Seo Optimizer

SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.

2222 votes

Google Official Seo Guide

Official Google SEO guide covering search optimization, best practices, Search Console, crawling, indexing, and improving website search visibility based on official Google documentation

1862 votes

Writing Plans

Use when you have a spec or requirements for a multi-step task, before touching code

2927051 votes
View all in development →