api-first

api-first is a skill for Claude Code, Codex from bishopZ/2026-Boilerplate. It costs 32 tokens per session (555 once invoked), scanned A, original, MIT.

A workflow for keeping an OpenAPI file—the documented description of an HTTP API—in sync with the code that uses it, including generated TypeScript types.

In plain words
What is it for?
Use it when adding or changing HTTP API behavior, updating the OpenAPI specification, or regenerating shared API types.
Why use it?
It reduces mismatches between documented endpoints, server responses, and client code.

Skill for Claude CodeCodex

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 skills/bishopz/2026-boilerplate/api-first
Any agent
npx skills add bishopZ/2026-Boilerplate --skill api-first
Clone the repo
git clone --depth 1 https://github.com/bishopZ/2026-Boilerplate

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for api-first

README.md
[![agentmods](https://agentmods.dev/badge/skills/bishopz/2026-boilerplate/api-first.svg)](https://agentmods.dev/skills/bishopz/2026-boilerplate/api-first)
Your own site
<a href="https://agentmods.dev/skills/bishopz/2026-boilerplate/api-first"><img src="https://agentmods.dev/badge/skills/bishopz/2026-boilerplate/api-first.svg" alt="Measured on agentmods" height="20"></a>
Per session 32 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 555 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.00032 $0.00555
Opus 5 $0.00016 $0.00278
Sonnet 5 $0.00006 $0.00111
Haiku 4.5 $0.00003 $0.00056

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

Security

Grade A, and why

api-first 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 5d 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.

skills/api-first/SKILL.md · 52 lines

How it starts

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

API-first OpenAPI workflow

Use this skill when a task adds or changes HTTP API behavior, updates docs/openapi.yaml, or adjusts how API types are generated and consumed.

Contract documentation (source of truth)

  • OpenAPI spec: docs/openapi.yaml — human-reviewed contract; keep in sync with Express routes and response shapes.
  • Narrative and conventions: docs/API.md — endpoint inventory, REST rules, migration guidance.

Do not treat generated TypeScript as documentation; treat the YAML + docs/API.md as the contract story.

Generated artifacts (pipeline)

  • Command: npm run gen:api-types
  • Input: docs/openapi.yaml
  • Output: src/generated/api/openapi.generated.ts (openapi-typescript; do not edit)
  • Hand-maintained aliases: src/generated/api/api-types.ts — re-exports friendly names from components['schemas'] for client and server imports.

After any YAML change, run gen:api-types and commit the updated openapi.generated.ts. Update api-types.ts when new schemas need stable export names.

Import paths

  • Prefer @/generated/api/api-types for shared DTOs (path alias @/*src/*).
  • Never import openapi.generated.ts directly from feature code unless you need path-level types; prefer api-types.ts for schemas.

Tooling

  • Generator: openapi-typescript (devDependency)
  • Lint: openapi.generated.ts is ESLint-ignored (generated noise)

CI / pre-commit

  • Optional: add a CI step that runs npm run gen:api-types and fails if git diff --exit-code shows drift (stops committed spec from diverging from generated output). This boilerplate does not enforce that by default; add when the team wants strict parity checks.

Validation checklist

  • docs/openapi.yaml matches actual routes and status codes
  • npm run gen:api-types succeeds
  • npm run type-check passes
  • docs/API.md and docs/SCRIPTS.md still describe correct paths if you moved files

Done criteria

  • Contract changes are reflected in YAML and regenerated TS.
  • Client/server imports use @/generated/api/api-types (or documented exceptions).
  • No manual edits inside openapi.generated.ts.

Read the full file on GitHub · 52 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. 5d ago First seen · 52 lines · 32 tokens per session scan A 6725ba927593

Subscribe to this mod's changes

api-first is a skill published in the GitHub repository bishopZ/2026-Boilerplate (24 stars, last pushed 1mo ago), licensed MIT. It adds 32 tokens to every session and 555 once invoked, about $0.0002 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.