contract-test

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

A guide for testing an agreement between two parts of a system, such as an API and its client or a message producer and consumer. The test checks that the data one side sends is still accepted by the other side.

In plain words
What is it for?
Use it for HTTP APIs, messages, public modules, shared schemas, OpenAPI or JSON Schema definitions, and consumer-driven contract tests.
Why use it?
It catches breaking changes, such as renaming a response field, before they reach clients or dependent services.

Skill for Claude CodeCodex

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

Good fit Use it for HTTP APIs, messages, public modules, shared schemas, OpenAPI or JSON Schema definitions, and consumer-driven contract tests.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/tmj-90/gaffer/contract-test/github.svg)](https://agentmods.dev/skills/tmj-90/gaffer/contract-test)
Your own site
<a href="https://agentmods.dev/skills/tmj-90/gaffer/contract-test"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/contract-test/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 contract-test

Your own site · 80×15
<a href="https://agentmods.dev/skills/tmj-90/gaffer/contract-test"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/contract-test.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 88 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,278 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.00088 $0.01278
Opus 5.5 $0.00035 $0.00511
Sonnet 5.5 $0.00018 $0.00256
Haiku 4.5 $0.00009 $0.00128

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

Security

Grade A, and why

contract-test 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/contract-test/SKILL.md · 93 lines

How it starts

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

Write a contract test for a boundary

A contract test pins the agreement at a boundary so either side can change safely: the provider proves it still produces what consumers rely on; the consumer proves it still handles what the provider produces. It catches "we renamed a field and broke the mobile app" before deploy, without a slow end-to-end environment.

A contract test checks the shape and meaning of messages, not side effects. Pact's own guidance: contract tests are not functional tests of the provider — whether the order was actually persisted, or every validation rule, belongs in the provider's own integration tests (the add-integration-test skill). Mixing them makes contracts brittle and still leaves the behaviour untested.

Procedure

  1. Name the boundary and every consumer. Identify the provider (API, producer, exported module) and each consumer: grep the repo, call search_lore for declared boundaries, and find_dependents (Memory MCP) where the repo map has them. The contract is the union of what consumers actually use, not everything the provider emits.
  2. Find the existing contract artefact and test against it: OpenAPI/JSON Schema, protobuf/Avro, a Pact directory or broker, a shared TypeScript type package, a versioned event schema. If none exists, the test becomes the contract and you should propose committing a schema (the openapi-contract skill for HTTP).
  3. Choose the style that fits.
    • Consumer-driven (Pact): both sides are under your control, consumers are identifiable, and the provider can set up state per interaction ("given a user Mary exists"). The consumer test generates the pact; the provider verifies it against the real service with provider states.
    • Schema-based: public or many-consumer APIs, or a provider you cannot seed through anything but the API under test. Validate real responses against the published schema; consumers validate against the same schema.
  4. Write the provider side. Call the real handler/publisher with each consumer-relied request and validate the response or message: field presence, types, enums, nullability, pagination and error envelopes (RFC 9457 problem details if the repo uses them), status codes. Cover error responses — consumers branch on them.
  5. Write the consumer side when the consumer lives here: feed it the provider's examples (from the schema or recorded from the real provider, never hand-typed guesses) and assert it parses and behaves, including an unknown extra field, which it must ignore (tolerant reader).
  6. Match loosely, assert what matters. Use type/regex matchers for values the consumer does not branch on (ids, timestamps); exact values only where the consumer depends on them (an enum, a status). Over-specified contracts break on harmless changes.
  7. Make the compatibility rules executable — one test each:
    • removed or renamed field, narrowed enum, changed type, changed status code → FAIL;
    • new optional field, widened enum the consumer tolerates → PASS.
  8. Version when you must break. Follow the api-versioning skill: a new version beside the old, contract tests pinned to both, a deprecation note. When another repo consumes the contract, raise request_decision before changing it. (Independent tester: you never change a contract or raise request_decision; follow black-box-test and record a break as a FAIL finding.)
  9. Run in the same command CI runs, then record evidence with the record-evidence skill (test_output): the contract file or tests touched and which consumers they protect. Publishing to a Pact broker and can-i-deploy are CI's job; you have no broker credentials and no deploy step.

Read the full file on GitHub · 93 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 · +30 lines · +14 tokens per session 21b0ab8c8af6
  2. 19d ago First seen · 63 lines · 74 tokens per session scan A 0dbbbcdf1991

Subscribe to this mod's changes

contract-test is a skill published in the GitHub repository tmj-90/gaffer (2 stars, last pushed 17d ago), licensed Apache-2.0. It adds 88 tokens to every session and 1,278 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.