api-contract-testing
Skill1 starsChanged 2 months agoMITView on GitHub
Test HTTP/GraphQL APIs and the contracts between services — status codes, schema shape, authz, idempotency, pagination, error bodies — with Supertest, httpx, RestAssured, or Pact. Use when asked to test an endpoint, a backend route, a webhook, or an integration between services.
6 other projects use a version of this.
Adopted by
Most recently taken up by
- itsryanarmani/skillstheir own version, first seen Nov 8, 2026
- pfangueiro/claude-code-agentstheir own version, first seen Nov 8, 2026
- pooriaarab/skillstheir own version, first seen Nov 7, 2026
- bestdeejay-design/agent-skillstheir own version, first seen Aug 9, 2026
- agent-packs/registrytheir own version, first seen Jun 15, 2026
- an8079/take-skillstheir own version, first seen Mar 30, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- pfangueiro/claude-code-agents★ 7same name
- bestdeejay-design/agent-skills★ 6same name
- an8079/take-skills★ 4same name
- itsryanarmani/skills★ 1same name
- pooriaarab/skills★ 1same name
- agent-packs/registry★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository34 other files it gives its agents.
- a11y-auditSkill
- autonomous-explorationSkill
- bug-reproSkill
- chaos-resilienceSkill
- ci-wiringSkill
- contract-testing-pactSkill
- coverage-ratchetSkill
- database-testingSkill
- e2e-authoringSkill
- environment-paritySkill
- exploratory-chartersSkill
- false-positive-hunterSkill
- flake-forensicsSkill
- i18n-l10n-testingSkill
- load-and-stressSkill
- mutation-proofSkill
- never-break-prodSkill
- payment-testingSkill
- perf-budgetSkill
- qa-triageSkill
- regression-curationSkill
- release-gateSkill
- responsive-mobile-testingSkill
- risk-mapSkill
- root-cause-protocolSkill
- security-regressionSkill
- smoke-and-sanitySkill
- state-machine-testingSkill
- test-data-managementSkill
- test-strategySkill
- tracking-testingSkill
- transactional-email-testingSkill
- unit-test-authoringSkill
- visual-regressionSkill
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 5 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Write one test per row. An endpoint without rows 3, 4 and 5 is untested, whatever the coverage report says.
- Distinctive: line 26
Add pagination (first page, last page, beyond-last, bad cursor), rate limiting, and content negotiation when they exist.
- Distinctive: line 49
Use when two services deploy independently:
- Very specific: line 65
Never assert only the status code.
- Distinctive: line 66
Never share auth state across tests without proving the scoping test still isolates users.
- Distinctive: line 68
Every test creates its own data and cleans up, or runs inside a rolled-back transaction.
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
API & Contract Testing
The integration level is where most real bugs live and where tests are cheapest per bug caught. Spend here before spending on E2E.
The seven questions every endpoint must answer
Write one test per row. An endpoint without rows 3, 4 and 5 is untested, whatever the coverage report says.
| # | Question | Typical assertion |
| 1 | Happy path shape | 200 + schema match (not just a status code) |
| 2 | Validation | 400 with a field-level error body, not a 500 |
| 3 | Authentication | no token / expired token / token for a deleted user -> 401 |
| 4 | Authorization | valid token of user B against user A's resource -> 404 or 403, never 200 |
| 5 | Tenant scoping | list endpoints return only the caller's tenant rows |
| 6 | Idempotency & retries | same request twice -> one side effect (charges, emails, rows) |
| 7 | Not-found & conflict | unknown id -> 404; duplicate create -> 409, not 500 |
Add pagination (first page, last page, beyond-last, bad cursor), rate limiting, and content negotiation when they exist.
Schema over field-picking
Assert the whole response shape, not two fields — a silently added password_hash in the
payload is a leak your expect(res.body.id) will never catch.
// zod / ajv / pydantic — pick the project's validator
expect(() => UserResponse.parse(res.body)).not.toThrow()
expect(Object.keys(res.body).sort()).toEqual(['createdAt', 'email', 'id', 'name'])Real data path
Hit a real database (containerized, migrated, seeded per test) — mocking your own repository turns an integration test into a slow unit test. Mock only third parties, and mock them with a recorded contract (MSW, WireMock, VCR), never an ad-hoc stub that returns a shape the vendor never sends.
Consumer-driven contracts (Pact)
Use when two services deploy independently:
- Consumer test declares the interaction and generates a pact file.
- Provider verifies the pact in its own CI against a real provider state.
- Broker gates deploy: provider cannot ship while a consumer pact is unverified.
Without step 3 the contract is decoration. Say so explicitly if the broker is missing.
Webhooks
- Signature verification: valid, tampered body, replayed timestamp, wrong secret.
- Idempotency: same event id twice -> one effect. This is a P0 in every payment system.
- Out-of-order delivery:
updatedbeforecreated.
Hard rules
- Never assert only the status code.
200with a wrong body is the most common silent bug. - Never share auth state across tests without proving the scoping test still isolates users.
- Time-sensitive endpoints: control the clock server-side (test seam), do not
sleep. - Every test creates its own data and cleans up, or runs inside a rolled-back transaction.
Done means
Runner output pasted, the seven questions answered per endpoint (or explicitly marked N/A),
and every authz test proven to fail when the guard is removed (mutation-proof).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

