api-doc

A command that scans a web application’s source code and creates documentation for its APIs, the interfaces other software uses to communicate with it.

In plain words
What is it for?
Use it to find routes in supported frameworks and produce structured documentation describing the application’s API endpoints.
Why use it?
It gathers endpoint details from route definitions instead of requiring someone to document every route manually. This makes the available methods and inputs easier to understand.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/fatihkan/badi/api-doc
Clone the repo
git clone --depth 1 https://github.com/fatihkan/badi

Made for: Claude Code.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 884 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00884
Opus 5 $0.00000 $0.00442
Sonnet 5 $0.00000 $0.00177
Haiku 4.5 $0.00000 $0.00088

Measured 2d ago against content hash 50b75cb848f7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

api-doc scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/api-doc.md · 98 lines

How it starts

The opening of the file, as written. The whole thing — 98 lines — stays where its author put it; the contents beside it link to each section on GitHub.

API documentation generation. Scans route definitions and produces structured API docs.

Required Tools

  • Bash (filesystem) -- Read (source code) -- Grep (routes/endpoints) -- Glob (file detection) -- Write (doc file) -- Agent (api-designer: detailed API analysis)

Agent Delegation

The main work is delegated to the api-designer agent. If the agent is unavailable, apply the steps below directly.

1. Framework Detection

1a — Project structure: package.json framework dependency -- supported: Express (express, app.get/post/put/delete), Fastify (fastify, fastify.route), NestJS (@nestjs/core, @Controller, @Get/@Post), Koa (koa-router, router.get/post), Next.js API (pages/api/ or app/api/), Django/Flask/FastAPI

1b — Route files: typical locations per framework -- routes/, controllers/, api/, endpoints/ -- middleware files

2. Endpoint Extraction

2a — Route scan (grep):

  • Express: router\.(get|post|put|patch|delete)\(
  • NestJS: @(Get|Post|Put|Patch|Delete)\(
  • Next.js: export (async )?function (GET|POST|PUT|DELETE)
  • Per match: file path + line number + the full route expression

2b — Endpoint info: HTTP method (GET/POST/PUT/PATCH/DELETE) -- URL path (including path params) -- middleware chain (auth, validation, rate-limit) -- controller function name

2c — Parameters: URL (:id, [slug]) -- query (extract from code) -- body (TS types, Zod, Joi) -- headers (Authorization, Content-Type, etc.)

3. Response Shapes

3a — Type detection: TS interfaces/types -- DTO classes -- sample response objects -- error response format

3b — Status codes: the HTTP codes each endpoint returns -- success (200, 201, 204) -- errors (400, 401, 403, 404, 500) -- custom error responses

4. OpenAPI/Swagger Skeleton

4a — OpenAPI 3.0:

openapi: "3.0.0"
info:
  title: "[Project Name] API"
  version: "[version]"
  description: "[description]"
paths:
  /api/[resource]:
    get:
      summary: "[description]"
      parameters: [...]
      responses:
        "200":
          description: "[description]"
          content:
            application/json:
              schema: [...]

Read the full file on GitHub · 98 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 98 lines · 0 tokens per session scan A 50b75cb848f7

Subscribe to this mod's changes

api-doc is a command published in the GitHub repository fatihkan/badi (7 stars, last pushed 16d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 884 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.