# Document API

> Generates standardized API documentation (OpenAPI/Markdown) for backend endpoints.

- Skill: `krishnakanthb13/document-api` (Agent Skill)
- Install (CLI): `npx skillmds@latest add krishnakanthb13/document-api`
- Raw SKILL.md: https://api.skillmd.com/api/skills/krishnakanthb13/document-api/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Docs & Writing
- Author: krishnakanthb13 (https://skillmd.com/u/krishnakanthb13)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/krishnakanthb13/document-api

---


# Document API

Use this skill to automatically map out and document your server's API surface area.

## Inputs
*   **Source Code**: The directory or entry point (e.g., `server.js`).
*   **Format**: Preferred output (Markdown vs Swagger/OpenAPI).

## Tooling Strategy
*   Use `grep_search` to find route definitions (e.g., `.get(`, `@app.route`).
*   Use `view_file` to understand request/response schemas.

## Workflow

### 1. Analysis
*   **Scan**: Identify the server entry point (e.g., `server.js`, `app.py`).
*   **Route Discovery**: Trace route definitions (Express `.get()`, Flask `@app.route`, FastAPI decorators).
*   **Parameters**: specific inputs (Body, Query Params, Path Variables).

### 2. Documentation Generation
*   **Format**: Create/Update `API_DOCUMENTATION.md` (or generate an OpenAPI/Swagger spec).
*   **Structure**:
    *   **Endpoint Details**: `METHOD /path`, description, rate limiting limits, and Auth requirements.
    *   **Request Specification**: Path/Query params, headers, and precise body schemas (with types & validation rules).
    *   **Response Specification**: 
        *   200 Success: Include a full JSON example.
        *   Error Responses: Document ALL possible error codes (e.g., 400 Bad Request, 401 Unauthorized, 409 Conflict), their message formats, and troubleshooting tips.
    *   **Code Examples**: Include a `cURL` command example and a JavaScript/Python snippet if applicable.
    *   **Usage Guidelines**: Provide a getting started guide, pagination patterns, and filtering/sorting options.

### 3. Output
*   Make the documentation clear and consistent.
*   Ensure every identified route is listed.

