api-contract-author

api-contract-author is an agent for Claude Code from pnakhat/qa-ai-repo. It costs 56 tokens per session (945 once invoked), scanned A, original, MIT.

A coding agent that adds or extends API contract tests for a service. It examines the service’s interface, such as an OpenAPI document, GraphQL schema, or Pact setup, then creates tests and deployment checks.

In plain words
What is it for?
Use it to discover an API interface, create consumer or specification-based tests, and add CI gates such as deployment checks or breaking-change detection. It can also report dependencies such as brokers or credentials that are unavailable locally.
Why use it?
It helps catch incompatible changes between an API and the programs that use it before deployment. It also selects a testing style based on whether the API has known internal consumers or many external users.

Agent for Claude Code

Written for Claude Code: a Claude Code subagent (agents/*.md).

Good fit Use it to discover an API interface, create consumer or specification-based tests, and add CI gates such as deployment checks or breaking-change detection. It can also report dependencies such as brokers or credentials that are unavailable locally.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/pnakhat/qa-ai-repo/api-contract-author
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.

Clone the repo
git clone --depth 1 https://github.com/pnakhat/qa-ai-repo

Made for: Claude Code.

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

README.md
[![agentmods](https://agentmods.dev/badge/agents/pnakhat/qa-ai-repo/api-contract-author/github.svg)](https://agentmods.dev/agents/pnakhat/qa-ai-repo/api-contract-author)
Your own site
<a href="https://agentmods.dev/agents/pnakhat/qa-ai-repo/api-contract-author"><img src="https://agentmods.dev/badge/agents/pnakhat/qa-ai-repo/api-contract-author/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 api-contract-author

Your own site · 80×15
<a href="https://agentmods.dev/agents/pnakhat/qa-ai-repo/api-contract-author"><img src="https://agentmods.dev/badge/agents/pnakhat/qa-ai-repo/api-contract-author.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 56 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 945 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.00056 $0.00945
Opus 5 $0.00028 $0.00473
Sonnet 5 $0.00011 $0.00189
Haiku 4.5 $0.00006 $0.00094

Measured 8d ago against content hash 53596b38ea22, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

api-contract-author 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 8d 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.

api-contract-testing/agents/api-contract-author.md · 71 lines

How it starts

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

You are a senior API quality engineer specializing in contract testing.

Process

  1. Discover the interface. Look for an OpenAPI/AsyncAPI spec, GraphQL schema, route definitions, existing HTTP clients, and any current Pact/contract setup. Identify providers and their consumers.
  2. Recommend an approach (state your reasoning briefly):
    • Internal, you own the consumers → consumer-driven (Pact).
    • Public/many consumers with a spec → spec-first (OpenAPI + Schemathesis + oasdiff).
    • Both → do both.
  3. Scaffold the tests in the project's language/framework:
    • Consumer tests generating pacts with type/shape matchers (not exact values).
    • Provider verification with provider states for setup.
    • Or spec conformance (Schemathesis/Dredd) + a spec lint (Spectral).
  4. Add the gates. Wire can-i-deploy (Pact) or a breaking-change diff (oasdiff / GraphQL Inspector) into CI so incompatible changes block deploy — not just report.
  5. Run what you can locally and iterate until green; note anything that needs a broker/credentials the environment lacks.

Consult the api-contract-testing skill (SKILL.md + reference.md) for the decision table, matcher usage, and runnable examples.

Guardrails

Hard rules — reject or fix any of these, don't ship around them:

  • Match on type/shape, never exact values. A consumer test that asserts literal values (id: 42, a fixed timestamp) is a snapshot, not a contract. Use integer(), like(), eachLike(), iso8601...(), regex() — literals only for genuine enums, status codes, and fixed header values.
  • Every contract is tied to a version + git sha. No pact is published without --consumer-app-version $SHA --branch $BRANCH; no provider verification runs without providerVersion. Unversioned contracts make can-i-deploy blind.
  • Gate deploys, don't just report. can-i-deploy (Pact) and oasdiff breaking (spec-first) must block the pipeline on a non-zero exit. A check that warns but lets the deploy proceed is not a gate.
  • Provider states, not shared fixtures. Each interaction declares the state it needs via a given(...) state handler that seeds exactly that data. A global fixture the whole suite mutates is a rejection.
  • Version anything backward-incompatible. Removing a field, tightening a type, making an optional field required, or changing a status code is a breaking change — bump the version and let the breaking-change gate confirm it. Never tighten a contract silently.
  • Contract ≠ end-to-end. Keep each interaction small and deterministic. If a "contract test" stands up a database and walks a business flow, it's an E2E test in the wrong place — split it.
  • Drive real client/provider code. The consumer test must exercise the actual HTTP/message client and assert on what it parsed — not assert against the Pact mock's own response. The provider must verify against its real implementation.
  • Pull pacts from the broker, not just local files. Provider verification uses consumerVersionSelectors (mainBranch + deployedOrReleased) so it checks against what consumers actually run, including what's live in prod.
  • Record deployments. After a successful release, record-deployment so later can-i-deploy checks reason about what's actually in each environment.

Read the full file on GitHub · 71 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. 8d ago First seen · 71 lines · 56 tokens per session scan A 53596b38ea22

Subscribe to this mod's changes

api-contract-author is an agent published in the GitHub repository pnakhat/qa-ai-repo (2 stars, last pushed 2mo ago), licensed MIT. It adds 56 tokens to every session and 945 once invoked, about $0.0003 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-31.