agentleFS
peopleforresterpeopleforrester/claude-dotfiles/skills/documentation/api-docs/SKILL.md

api-docs

Skill3 starsChanged 7 months agoMITView on GitHub

Generate API documentation from code or specifications. Use when documenting REST APIs, library APIs, or generating reference documentation. Supports OpenAPI, JSDoc, and markdown formats.

  • Installs packages
  • Sends data out

We split this skill into the rules it gives an agent

1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 16 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create clear, comprehensive API documentation.

    line 20

“Common” is measured: kept by at least 6 in 10 of the 16 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

API Documentation Generator

Create clear, comprehensive API documentation.

When to Use

  • Documenting REST API endpoints
  • Writing library/SDK documentation
  • Creating OpenAPI/Swagger specs
  • Generating reference documentation

REST API Documentation

Endpoint Template

## Create User

Creates a new user account.

`POST /api/v1/users`

### Authentication

Requires Bearer token with `users:write` scope.

### Request

#### Headers

| Header | Required | Description |
|--------|----------|-------------|
| Authorization | Yes | Bearer token |
| Content-Type | Yes | `application/json` |

#### Body Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| email | string | Yes | User's email address |
| name | string | Yes | User's display name |
| role | string | No | User role. Default: `member` |

#### Example Request

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

### Response

#### Success (201 Created)

\`\`\`json
{
  "data": {
    "id": "usr_abc123",
    "email": "john@example.com",
    "name": "John Doe",
    "role": "admin",
    "createdAt": "2026-01-15T10:30:00Z"
  }
}
\`\`\`

#### Error (400 Bad Request)

\`\`\`json
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid request body",
    "details": [
      {
        "field": "email",
        "message": "Email is already registered"
      }
    ]
  }
}
\`\`\`

### Error Codes

| Code | Description |
|------|-------------|
| VALIDATION_ERROR | Request body validation failed |
| UNAUTHORIZED | Missing or invalid authentication |
| RATE_LIMITED | Too many requests |

OpenAPI Specification

openapi: 3.0.3
info:
  title: My API
  version: 1.0.0
  description: API for managing resources

servers:
  - url: https://api.example.com/v1
    description: Production

paths:
  /users:
    post:
      summary: Create user
      operationId: createUser
      tags:
        - Users
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUserRequest'
      responses:
        '201':
          description: User created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        '400':
          $ref: '#/components/responses/BadRequest'

components:
  schemas:
    User:
      type: object
      properties:
        id:
          type: string
          example: usr_abc123
        email:
          type: string
          format: email
        name:
          type: string
        createdAt:
          type: string
          format: date-time

    CreateUserRequest:
      type: object
      required:
        - email
        - name
      properties:
        email:
          type: string
          format: email
        name:
          type: string
          minLength: 1
          maxLength: 100

  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

Library Documentation

Function Documentation

/**
 * Formats a date according to the specified pattern.
 *
 * @param date - The date to format
 * @param pattern - Format pattern string
 * @param options - Formatting options
 * @returns Formatted date string
 *
 * @example
 * ```ts
 * formatDate(new Date('2026-01-15'), 'YYYY-MM-DD')
 * // => '2026-01-15'
 *
 * formatDate(new Date(), 'MMM D, YYYY', { locale: 'en-US' })
 * // => 'Jan 15, 2026'
 * ```
 *
 * @see {@link parseDate} for the inverse operation
 * @since 1.0.0
 */
export function formatDate(
  date: Date,
  pattern: string,
  options?: FormatOptions
): string;

Class Documentation

/**
 * HTTP client for making API requests.
 *
 * @example
 * ```ts
 * const client = new ApiClient({
 *   baseUrl: 'https://api.example.com',
 *   apiKey: 'sk_live_xxx'
 * });
 *
 * const users = await client.get('/users');
 * ```
 */
export class ApiClient {
  /**
   * Creates a new API client instance.
   *
   * @param config - Client configuration
   * @throws {ConfigError} If required options are missing
   */
  constructor(config: ClientConfig);

  /**
   * Makes a GET request.
   *
   * @param path - API endpoint path
   * @param params - Query parameters
   * @returns Response data
   *
   * @throws {ApiError} If the request fails
   */
  async get<T>(path: string, params?: QueryParams): Promise<T>;
}

Documentation Sections

Overview/Introduction

# My SDK

Official SDK for the Example API.

## Features

- Full API coverage
- TypeScript support
- Automatic retries
- Rate limit handling

## Installation

\`\`\`bash
npm install @example/sdk
\`\`\`

## Quick Start

\`\`\`typescript
import { Client } from '@example/sdk';

const client = new Client({ apiKey: 'sk_xxx' });
const user = await client.users.create({
  email: 'john@example.com'
});
\`\`\`

Authentication

## Authentication

All API requests require authentication via API key.

### API Keys

Generate API keys in your [dashboard](https://dashboard.example.com).

| Key Type | Prefix | Use Case |
|----------|--------|----------|
| Live | `sk_live_` | Production |
| Test | `sk_test_` | Development |

### Usage

Include your API key in the `Authorization` header:

\`\`\`
Authorization: Bearer sk_live_xxx
\`\`\`

Error Handling

## Errors

The API uses standard HTTP status codes.

### Error Response Format

\`\`\`json
{
  "error": {
    "code": "RESOURCE_NOT_FOUND",
    "message": "User not found",
    "requestId": "req_abc123"
  }
}
\`\`\`

### Error Codes

| Code | Status | Description |
|------|--------|-------------|
| VALIDATION_ERROR | 400 | Invalid input |
| UNAUTHORIZED | 401 | Invalid API key |
| FORBIDDEN | 403 | Insufficient permissions |
| NOT_FOUND | 404 | Resource not found |
| RATE_LIMITED | 429 | Too many requests |

Quality Checklist

  • All endpoints documented
  • Request/response examples included
  • Error codes explained
  • Authentication documented
  • Rate limits specified
  • Examples are runnable
  • Types/schemas defined
  • Versioning explained

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

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.