Skip to content
Skills Library
Programming · Testing

contract-testing

/contract-testing

Verify a service boundary with a consumer-driven contract that records the payload the caller actually reads and that both sides check in CI. Use when two services deploy independently and an unannounced response change would silently break the consumer.

Repository
AI-SKILLS ↗
Licence
MIT
Last repository change
05.09.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 05.09.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Verify a service boundary with a consumer-driven contract that records the payload the caller actually reads and that both sides check in CI. Use when two services deploy independently and an unannounced response change would silently break the consumer.

Original author description

Verify a service boundary with a consumer-driven contract that records the payload the caller actually reads and that both sides check in CI. Use when two services deploy independently and an unannounced response change would silently break the consumer.

How it works

  1. Method
  2. Signals
  3. Boundaries
Original SKILL.md headings · 48 lines, 393 words
SKILL.md preview
---
name: contract-testing
description: Verify a service boundary with a consumer-driven contract that records the payload the caller actually reads and that both sides check in CI. Use when two services deploy independently and an unannounced response change would silently break the consumer.
---

# Contract testing

Two services on separate release trains share an agreement that lives only in
each team's memory: the shape of the request and response between them. The
provider renames a field, ships green, and the consumer breaks in production
because no test in either repo covered the seam. A consumer-driven contract
writes that agreement down from the caller's side and forces the provider to
prove it still holds before merging.

## Method

1. **Generate the contract from the consumer's own expectations.** In a Pact
   consumer test, declare each interaction the code depends on, run the real
   client against the Pact mock, and let it emit a pact JSON file naming only
   the fields the consumer reads.
2. **Match on type and structure, not literal values.** Wrap fields in
   `like()`, `eachLike()`, and `regex()` so the contract pins shape while a
   changing timestamp or generated ID does not turn every payload into a false
   failure.
3. **Publish the pact to a broker keyed by version.** Run `pact-broker publish`
   tagged with the consumer's git SHA and branch, so the provider can fetch
   exactly the contracts its live consumers rely on.
4. **Verify on the provider in CI.** The provider replays each recorded request
   against its real endpoints and fails the build if any response no longer
   matches, seeding data through a state handler per interaction.
5. **Gate deploys with can-i-deploy.** Before releasing either side, run
   `pact-broker can-i-deploy --pacticipant X --version <sha>` so you ship only
   when every dependent contract is verified against that exact version.
6. **Evolve additively.** Add response fields freely, since an unread field
   leaves contracts green; a rename or removal waits until no consumer contract
   references the old name, which the broker lets you confirm.

## Signals

- Does the contract name only fields the consumer actually reads?
- Would renaming an unconsumed field leave the provider's verification green?
- Does can-i-deploy block a release when a consumer's pact is unverified?

## Boundaries

Contracts pin message shape and semantics at one hop, not correctness across a
chain of services: use integration-testing or e2e-testing for full flows. They
pay off only when both sides run verification in CI, since an unverified
contract is just documentation. For the detailed provider-side replay setup,
defer to pact-verification. A public API with unknown consumers is better served
by schema and version discipline than by consumer pacts.

Versions

RepositoryScoreLicence
This page · Amey-Thakur/AI-SKILLS90MIT
proffesor-for-testing/agentic-qe100MIT
claude-dev-suite/claude-dev-suite100MIT
sebastiendegodez/skraft-plugin100GPL-3.0
petrkindlmann/qa-skills100MIT
thedaviddias/front-end-checklist100MIT
jacob-balslev/skill-graph100Apache-2.0
Tyler-R-Kendrick/agent-skills95MIT
RobinBeraud/claude-qa-skills90MIT

Database snapshot: 13.11.2026 · package version 6ef733c3860d (SHA-256 digest of the entire package)

Downloads in the last 30 days: 4 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 90mock-contract
    Design a consumer-driven contract testing setup — Pact configuration and CI integration. Use when asked to "set up contract testing", "configure Pact", or "add consumer-driven contracts".
  • 100contract-testing-pact-microservices
    Use this skill when verifying consumer-driven API contracts between decoupled microservices without end-to-end environment dependencies.
  • 90quality-contract-testing
    Use this skill when setting up contract testing, Pact, consumer-driven contracts, provider contract verification, API compatibility, or integration testing between services. This skill enforces: consumer-driven contracts with Pact, provider-side verification, contract publishing…
  • 100pact-contract-testing
    Authors and verifies Pact consumer-driven contract tests across the full Pact lifecycle - consumer tests producing pact files, publishing to the Pact Broker, provider verification, and `can-i-deploy` deployment gates. Use when introducing a new HTTP/JSON API contract between two…
  • 100pact
    Sets up consumer-driven contract testing with Pact JS: a consumer test that writes a pact file, a provider verification that replays it, and a Pact Broker or PactFlow with can-i-deploy in CI. Use when the user mentions "pact", "contract testing", "consumer-driven contracts",…
  • 100pact-contract-testing-configuration
    Sets up consumer-driven contract testing with Pact — writing consumer contract tests that generate a pact file, standing up and configuring a Pact Broker (or PactFlow) to publish and share contracts, and writing provider verification tests against the broker's published pacts.…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.