api-docs.template

A workflow that generates OpenAPI documentation, a standard description of an API's endpoints, inputs, and outputs.

In plain words
What is it for?
Use it to detect a supported API framework, create an OpenAPI specification, add examples, export a Postman collection, or serve Swagger UI documentation.
Why use it?
It removes much of the manual work of documenting an API and preparing it for testing or browsing.

Command

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/evan043/claude-cli-advanced-starter-pack/api-docs.template
Clone the repo
git clone --depth 1 https://github.com/evan043/claude-cli-advanced-starter-pack
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 3,663 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.03663
Opus 5 $0.00000 $0.01832
Sonnet 5 $0.00000 $0.00733
Haiku 4.5 $0.00000 $0.00366

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

Security

Grade A, and why

api-docs.template 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.

templates/commands/api-docs.template.md · 660 lines

How it starts

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

Codex Runtime Compatibility

This prompt was authored for Claude-style slash workflows. In Codex runtime, adapt tool calls as follows:

  • AskUserQuestion => ask the user directly in chat.
  • WebSearch/WebFetch => use available web tools (search_query, open, find) and cite links.
  • Read/Write => use shell/filesystem tools in this workspace.
  • Claude-only MCP calls (for example Playwright MCP names) => use available equivalents or clearly state fallback.
  • Keep intent and output format identical; only adapt execution mechanics.

description: Generate comprehensive API documentation type: project complexity: medium allowed-tools: Bash, Read, Write, Grep, Glob category: documentation

/api-docs

Auto-generate OpenAPI/Swagger documentation for your API.

Usage

/api-docs
/api-docs --generate
/api-docs --serve
/api-docs --postman

What It Does

  1. Detect API Framework - Identify Express, FastAPI, etc.
  2. Generate OpenAPI Spec - Create OpenAPI 3.0 specification
  3. Add Documentation - Document all endpoints
  4. Request/Response Examples - Add example payloads
  5. Generate Postman Collection - Export for testing
  6. Host Documentation - Set up Swagger UI or Redoc

Step 1: Detect API Framework

{{#if backend.framework}}

Detected Backend: {{backend.framework}}

{{#if (eq backend.framework "express")}} Strategy: Install swagger-jsdoc + swagger-ui-express {{/if}}

{{#if (eq backend.framework "fastapi")}} Strategy: Use built-in OpenAPI generator {{/if}}

{{#if (eq backend.framework "nest")}} Strategy: Use @nestjs/swagger {{/if}}

{{else}}

No backend framework detected. Will analyze routes manually.

{{/if}}


Step 2: Installation & Setup

Express.js

npm install swagger-jsdoc swagger-ui-express
npm install --save-dev @types/swagger-jsdoc @types/swagger-ui-express

Create src/swagger.js:

const swaggerJsdoc = require('swagger-jsdoc');
const swaggerUi = require('swagger-ui-express');

const options = {
  definition: {
    openapi: '3.0.0',
    info: {
      title: '{{projectName}} API',
      version: '1.0.0',
      description: 'API documentation for {{projectName}}',
      contact: {
        name: 'API Support',
        email: '[email protected]',
      },
    },
    servers: [
      {
        url: '{{deployment.backend.productionUrl}}',
        description: 'Production server',
      },
      {
        url: 'http://localhost:{{backend.devServerPort || 8001}}',
        description: 'Development server',
      },
    ],
    components: {
      securitySchemes: {
        bearerAuth: {
          type: 'http',
          scheme: 'bearer',
          bearerFormat: 'JWT',
        },
      },
    },
    security: [
      {
        bearerAuth: [],
      },
    ],
  },
  apis: ['./src/routes/*.js', './src/routes/*.ts'], // Path to route files
};

const specs = swaggerJsdoc(options);

module.exports = { specs, swaggerUi };

Read the full file on GitHub · 660 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 · 660 lines · 0 tokens per session scan A eba26e824e3a

Subscribe to this mod's changes

api-docs.template is a command published in the GitHub repository evan043/claude-cli-advanced-starter-pack (61 stars, last pushed 1mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,663 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-30.