api-spec

A command that creates OpenAPI 3.1 documents, which describe how software APIs work, for each bounded context—a separate area of a larger domain model—and can publish them to SwaggerHub.

In plain words
What is it for?
Use it to generate, lint, reconcile, and optionally publish API specifications, including standard naming, pagination, and error formats.
Why use it?
It helps keep API documentation aligned with the code's domain structure and reveals differences between locally modelled APIs and those already published.

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/fmflurry/settings-opencode/api-spec
Clone the repo
git clone --depth 1 https://github.com/fmflurry/settings-opencode
Per session 25 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,579 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.00025 $0.02579
Opus 5 $0.00013 $0.01290
Sonnet 5 $0.00005 $0.00516
Haiku 4.5 $0.00003 $0.00258

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

Security

Grade A, and why

api-spec 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.

commands/api-spec.md · 230 lines

How it starts

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

API Spec Command

Routing to the api-spec-architect subagent is handled by the agent: field on this command in opencode.jsonc — no manual delegation needed.

Generate and publish OpenAPI 3.1 specifications for: $ARGUMENTS


Workflow at a Glance

  1. Discover bounded contexts from your domain model (code-memory).
  2. Discover published APIs on SwaggerHub (if MCP connected): List existing published APIs and check for drift (APIs on SwaggerHub not in your domain model).
  3. Reconcile: Cross-map domain BCs against published APIs (identify new, update, and orphan APIs).
  4. Generate one <bc>.openapi.yaml per BC in api-specs/ folder, following Zalando conventions (kebab-case, snake_case, cursor pagination, RFC 9457 errors).
  5. Validate with Spectral or Redocly linting.
  6. Confirmation gate (if MCP connected): Review reconciliation summary (new / update / orphan) before publishing.
  7. Publish/update each API to SwaggerHub (optional; requires MCP + credentials + user confirmation).
  8. Report spec locations, URLs, and reconciliation summary.

Arguments

/api-spec [options] [bounded-contexts-or-path]

Options:
  --output-dir <path>       Output directory for specs (default: api-specs/)
  --generate-only           Generate specs only; skip SwaggerHub push
  --bc-list <list>          Explicit comma-separated BC names (e.g., "user-management,order-fulfillment,payment-processing")
  --swagger-org <name>      SwaggerHub organization name
  --swagger-owner <email>   SwaggerHub owner email
  --swagger-base-url <url>  SwaggerHub base URL (default: https://app.swaggerhub.com)

Examples:
  /api-spec                                  # Discover BCs and generate specs
  /api-spec --generate-only                  # Generate only (skip push)
  /api-spec --bc-list "users,orders,payments"  # Explicit BC names
  /api-spec --output-dir docs/api-specs/    # Custom output directory
  /api-spec --swagger-org acme-corp          # Set SwaggerHub org

Read the full file on GitHub · 230 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 · 230 lines · 25 tokens per session scan A e05583cf84f7

Subscribe to this mod's changes

api-spec is a command published in the GitHub repository fmflurry/settings-opencode (172 stars, last pushed 20d ago), licensed MIT. It adds 25 tokens to every session and 2,579 once invoked, about $0.0001 per session on Opus 5. 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.