plugins/testing-api-contracts/skills/testing-api-contracts/SKILL.md
Validates API responses against OpenAPI or JSON Schema, detects breaking changes between spec versions, and builds consumer-driven contract checks. Use when an API has a published spec, when a backend change might break a client, when API tests assert only status codes, or when mocked fixtures need a guard against drifting from the real service.
npx skillsauth add jaktestowac/awesome-copilot-for-testers testing-api-contractsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill when the question is not "does the endpoint work" but "does the endpoint still promise what its consumers were built against".
A contract test checks shape and compatibility, not business behaviour. It answers: did a field disappear, did a type change, did an enum gain a value the client cannot handle, did a required field become optional. Functional API tests answer whether the value is correct. Both are needed and they fail for different reasons, which is the point of keeping them separate.
status === 200 and nothing about the bodyFind the authoritative artifact and record which it is:
/openapi.json, /swagger.json, /v3/api-docs)If the spec is hand-written and the implementation is not generated from it, say so. Hand-written specs drift, and the drift is exactly what this skill exists to surface.
| Side | Question | Typical artifact | | --- | --- | --- | | Provider | Does our service return what our spec promises? | Schema validation over live responses | | Consumer | Do we still work against what the provider promises? | Fixture validation plus a live sample check | | Both | Are these two versions of the spec compatible? | Spec diff and breaking-change report |
Choose one per run. A single output that mixes provider defects with consumer risks is unreadable to either team.
The cheapest contract coverage is a validator attached to the existing API test suite. Every request the suite already sends gets its response validated for free.
Recipes for ajv, zod, openapi-response-validator, and a Playwright expect extension are in ./resources/schema-validation-recipes.md.
Rules for the validator:
additionalProperties: false when the spec allows it, so undocumented fields surface instead of passing silently./items/0/price: expected number, got string is actionable; schema validation failed is not.For each endpoint in scope, check the cases in ./resources/contract-coverage-checklist.md. The ones that catch real defects:
items: [] with the pagination envelope intactWhen a spec has changed, produce a compatibility verdict rather than a list of edits. Classify every change using ./resources/breaking-change-checklist.md:
| Class | Examples | Verdict | | --- | --- | --- | | Safe | New optional response field, new endpoint, new optional request parameter, widened response enum a client treats as opaque | Ship | | Risky | New enum value in a field clients branch on, tightened validation, changed default, changed ordering, changed pagination size | Ship with a consumer check | | Breaking | Removed or renamed field, narrowed type, required field added to a request, optional response field made absent, status code change, auth requirement change | Version it or coordinate |
For every Risky and Breaking item, name the affected consumers if they are knowable, and say what evidence supports the claim. "Unknown consumers" is a valid finding and raises the severity.
If the codebase mocks this API anywhere, the spec is also the guard for those fixtures. Validate the fixtures against the same schema:
This is the handoff point with mocking-network-and-time.
Use ./resources/contract-report-template.md. A useful report contains:
additionalProperties left permissive, so a leaked internal field passes forever./resources/schema-validation-recipes.md - ajv, zod, openapi-response-validator, and a reusable Playwright matcher./resources/breaking-change-checklist.md - full classification of spec changes into safe, risky, and breaking, for requests and responses./resources/contract-coverage-checklist.md - the response shapes to force per endpoint./resources/contract-report-template.md - report structure with a worked exampleapi-playwright-test-developer - when the functional API tests these validators attach to are being writtenmocking-network-and-time - when the spec is being used to guard mocked fixtures against driftanalyzing-regression-scope - when a breaking change needs its retest blast radius mappedverifying-acceptance-criteria - when the question is whether behaviour meets its stated contract rather than its shapeassessing-release-readiness - when a breaking change feeds a go/no-go decisiondocumenting-test-suites - when the spec gaps found here need writing upThis skill is complete when:
testing
Tests the customization assets themselves - skills, prompts, custom agents, instructions - the way a product is tested: activation cases that check an asset fires when it should and stays quiet when it should not, output-contract cases, safety cases, collision cases between assets competing for the same trigger, a weighted rubric scored blind, and a baseline-versus-candidate gate before an edit ships. Use when a skill is edited and nobody knows whether behaviour changed, when two skills fight over the same request, when a description is being tuned for discoverability, when a collection has grown past manual spot-checking, or when the request mentions skill evals, prompt regression, or "does this skill actually work".
development
Shapes QA output for the person who has to act on it: result and blocker in the first two lines, one decision per report, findings ordered by what they cost, the long artifact in a file and the decisions in the message, and magnitude stated in units the reader can count. Use when a report is accurate but nobody acts on it, when a finding set is too long to read under time pressure, when the same findings must be retold for a developer, a release manager, and an on-call engineer, or when the request mentions "too long", "make this readable", "just tell me what to do", "so what", or "summarize this for stakeholders". Pairs with unslop-answers, which makes the same report honest.
testing
Verifies that the lines and branches a change actually touched are executed by tests, using LCOV or Cobertura diff coverage instead of whole-repo percentages, and escalates uncovered high-risk changes into a blocking finding. Use when a pull request needs a coverage gate that unrelated tests cannot satisfy, when total coverage looks healthy but the diff is untested, when wiring diff coverage into CI, or when someone claims a change is covered because the suite is green.
development
Cuts AI tells from test code: tests that pass without proving anything, tautological assertions, mock-only tests, hardcoded waits, coverage theater, vague names, swallowed errors, retries used as fixes. Use whenever test code is written, changed, or reviewed, including tests produced as a side effect of a feature task, and when the request mentions "review these tests", "are these tests any good", "this test always passes", "this suite is flaky", or "clean up these tests". Must always apply to test code.