openapi-contract

openapi-contract is a skill for Claude Code, Codex from tmj-90/gaffer. It costs 90 tokens per session (1,412 once invoked), scanned A, original, Apache-2.0.

A workflow for keeping an OpenAPI document accurate alongside an HTTP API. OpenAPI is a machine-readable description of an API's requests, responses, fields, and errors that tools can use to make clients and checks.

In plain words
What is it for?
It helps define request and response schemas, describe errors, generate or check the API document, and fail CI when the contract is out of date.
Why use it?
It prevents documentation, generated client code, tests, and actual routes from disagreeing.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It helps define request and response schemas, describe errors, generate or check the API document, and fail CI when the contract is out of date.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tmj-90/gaffer/openapi-contract
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.

Any agent
npx skills add tmj-90/gaffer --skill openapi-contract
Clone the repo
git clone --depth 1 https://github.com/tmj-90/gaffer

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 openapi-contract

README.md
[![agentmods](https://agentmods.dev/badge/skills/tmj-90/gaffer/openapi-contract/github.svg)](https://agentmods.dev/skills/tmj-90/gaffer/openapi-contract)
Your own site
<a href="https://agentmods.dev/skills/tmj-90/gaffer/openapi-contract"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/openapi-contract/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for openapi-contract

Your own site · 80×15
<a href="https://agentmods.dev/skills/tmj-90/gaffer/openapi-contract"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/openapi-contract.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 90 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,412 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00090 $0.01412
Opus 5.5 $0.00036 $0.00565
Sonnet 5.5 $0.00018 $0.00282
Haiku 4.5 $0.00009 $0.00141

Measured 16d ago against content hash 9d8fbae90ec6, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

openapi-contract 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 16d 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.

runner/skills/openapi-contract/SKILL.md · 89 lines

How it starts

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

Keep the OpenAPI contract true

An API document that is not generated from, or checked against, the running code is fiction within a month. Keep it precise, prove the implementation matches it in tests, and treat drift or an unannounced breaking change as a failing build. Sources: OpenAPI Specification 3.1.x (3.2.0 published September 2025), JSON Schema 2020-12, RFC 9457 (problem details), RFC 9110 (HTTP semantics).

Steps

  1. Find how the repo produces its contract. Generated from route schemas (best: zod/pydantic/JSON Schema rendered to OpenAPI), hand-maintained and checked by a test, or absent. Call search_lore for the convention and the check command (in the factory itself: node scripts/openapi.mjs --check). Never hand-edit a generated document; fix the source and regenerate.
  2. Respect the document's version. Write for the openapi: version the repo declares; do not bump it unless every consumer tool supports the new one. In 3.1, schemas are full JSON Schema 2020-12: use type: [string, "null"] not nullable, numeric exclusiveMinimum, examples (array) in schemas, and the top-level webhooks map for outbound events. 3.0 documents keep 3.0 idioms.
  3. Define the schemas where the route validates. The same schema object validates input at the boundary and renders the contract, so they cannot disagree. Every field typed; required stated; formats declared (uuid, date-time, email); enums closed; string lengths and array sizes bounded; readOnly/writeOnly for server-set and secret fields. Request bodies reject unknown properties (additionalProperties: false) where the repo validates strictly; response schemas document every field the server emits.
  4. Document every response, errors included. Success status and body; each error status with the repo's error envelope (RFC 9457 application/problem+json if the repo uses it) and its machine codes; 401/403 where auth applies; 422/400 for validation; 429 with rate-limit headers when limited (the rate-limiting skill); the pagination envelope and parameters for lists (the pagination-and-filtering skill); Idempotency-Key where accepted.
  5. Name, tag and secure operations. Unique operationId consistent with siblings (listTickets, createTicket), a one-sentence summary, tags, and a security requirement per operation (or the global default, stated) so a reviewer can audit authorisation from the document alone. In the factory's own API every endpoint in packages/dispatch/src/api/openapi/spec.ts declares its capability tier (public / read / full); set it for each new route.
  6. Regenerate, lint, and diff for breaks. Run the generator; lint with the repo's linter only if it is already installed (npx --no-install @redocly/cli lint, npx --no-install @stoplight/spectral-cli lint); never fetch one. Compare with the base branch without writing a file outside the worktree (the safety hook blocks that): oasdiff breaking <(git show <base>:<path>) <path> if oasdiff is installed, otherwise read git diff <base> -- <path>. Breaking: removing a path, operation, field or enum value from a response; adding a required request field; narrowing a type or constraint; changing a status code or auth. Any break is a versioning event (the api-versioning skill), not a doc update.
  7. Prove the code matches the document. Run the repo's freshness check and its two-way route test (every documented path is routed; every routed path is documented). Validate real responses against the schema in integration tests (a response validator, or Schemathesis-style property tests if the repo has them), so a handler that returns an undocumented field or status fails. If the repo has no check, add the smallest one and name it in the evidence.
  8. Regenerate derived clients and types in the same change and run their consumers' tests; a stale generated client is the same bug as a stale document.

Read the full file on GitHub · 89 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. 16d ago Changed · +28 lines 9d8fbae90ec6
  2. 19d ago First seen · 61 lines · 90 tokens per session scan A c4c6c0bdf154

Subscribe to this mod's changes

openapi-contract is a skill published in the GitHub repository tmj-90/gaffer (2 stars, last pushed 17d ago), licensed Apache-2.0. It adds 90 tokens to every session and 1,412 once invoked, about $0.0004 per session on Opus 5.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-09-28.

Related

Other skills, from other repositories

bulwark-brainstorm

Role-based brainstorming with dual modes: --scoped (sequential Task tool, 5 roles) and --exploratory (Agent Teams peer debate, 4 roles). Use for feasibility assessment and idea validation.

QBall-Inc/the-bulwark · 50 tokens

plan-creation

Create structured implementation plans via a 4-role scrum team (Product Owner, Architect, Eng/Delivery Lead, QA/Critic) with optional Agent Teams peer debate mode.

QBall-Inc/the-bulwark · 38 tokens

anthropic-validator

Validates Claude Code assets (skills, hooks, agents, commands, MCP servers, plugins) against official Anthropic standards. Fetches latest docs dynamically and produces structured validation reports.

QBall-Inc/the-bulwark · 40 tokens

create-subagent

Generates single-purpose Claude Code sub-agents for use via the Task tool. Use when creating dedicated sub-agents, scaffolding agent definitions, or generating agents with diagnostics and permissions setup.

QBall-Inc/the-bulwark · 42 tokens

test-audit

Audit test suites for T1-T4 violations using AST analysis, mock detection, and multi-stage synthesis. Invoke when user asks to audit tests, check test quality, find mock violations, review test effectiveness, or inspect test suites for over-mocking. Triggers automatic rewrites when quality gates fail.

QBall-Inc/the-bulwark · 0 tokens

code-review

Comprehensive code review with distinct aspect based sections. Use when reviewing code, checking for security issues, finding type safety problems, auditing code quality, or when user asks to review code, PRs or changes. Three-phase workflow runs static tools, LLM judgment, and writes diagnostic log.

QBall-Inc/the-bulwark · 61 tokens