generate-openapi

A command that creates an OpenAPI 3.1 description of an API from its code or design. OpenAPI is a standard machine-readable document describing an API's routes, inputs, and outputs.

In plain words
What is it for?
Use it to discover routes and handlers, extract data models and validation rules, and build a specification with API details, parameters, schemas, errors, and authentication.
Why use it?
It replaces manual API specification work and keeps details such as field types, required values, limits, and status responses tied to the code.

Command

Part of the api-architect plugin — 2 commands, 1 agent shipped together

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/rohitg00/awesome-claude-code-toolkit/generate-openapi
Clone the repo
git clone --depth 1 https://github.com/rohitg00/awesome-claude-code-toolkit

Or install api-architect, the plugin that ships this one along with the rest of its 2 commands, 1 agent.

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 683 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.00683
Opus 5 $0.00000 $0.00342
Sonnet 5 $0.00000 $0.00137
Haiku 4.5 $0.00000 $0.00068

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

Security

Grade A, and why

generate-openapi 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 3d 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.

plugins/api-architect/commands/generate-openapi.md · 73 lines

How it starts

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

/api-architect:generate-openapi

Generate an OpenAPI 3.1 specification from the existing codebase or API design.

Process

  1. Discover existing API routes and handlers:

    • For Express/Fastify: search for app.get, app.post, router.use patterns
    • For FastAPI/Flask: search for @app.route, @router.get decorators
    • For Go: search for http.HandleFunc, r.GET, mux.Handle patterns
    • For Spring: search for @GetMapping, @PostMapping, @RestController annotations
    • Read each handler to understand request parameters, body, and response shape
  2. Extract schema information:

    • Parse TypeScript interfaces, Python dataclasses/Pydantic models, Go structs, or Java DTOs
    • Map field types to OpenAPI types (string, integer, number, boolean, array, object)
    • Identify required vs optional fields from type annotations or validation rules
    • Extract enum values from code constants or type unions
    • Document field constraints (minLength, maxLength, pattern, minimum, maximum)
  3. Build the OpenAPI specification:

Info Section

  • Set title from package.json name or project directory
  • Set version from package.json version or git tag
  • Write a concise description of the API's purpose

Servers

  • Add localhost development server
  • Add placeholder for production server URL

Paths

  • One path entry per route
  • Include all HTTP methods supported by each path
  • Define path parameters with types and descriptions
  • Define query parameters for list endpoints (pagination, filtering, sorting)
  • Reference request body schemas from components
  • Define response schemas for each status code (200, 201, 400, 401, 404, 500)

Components

  • Define reusable schemas for each domain entity
  • Create shared error response schema
  • Create pagination metadata schema
  • Define security schemes (Bearer JWT, API Key, OAuth2 as applicable)
  • Use $ref extensively to avoid duplication

Security

  • Apply security requirements globally or per-operation
  • Document which endpoints are public (override global security with empty array)

Read the full file on GitHub · 73 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. 3d ago First seen · 73 lines · 0 tokens per session scan A b9669db746a5

Subscribe to this mod's changes

generate-openapi is a command published in the GitHub repository rohitg00/awesome-claude-code-toolkit (2,578 stars, last pushed 3mo ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 683 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.