This skill activates when working with API contract verification between services, consumer-driven contract workflows, schema compatibility checks, or any task involving service boundary agreements. It applies to both synchronous (HTTP/gRPC) and asynchronous (message queue) contracts.
Mandatory actions when this skill is active
Before
Identify all parties in the contract relationship (consumers and providers).
Determine the contract format in use (Pact, OpenAPI, AsyncAPI, Protobuf).
Check if a contract broker is already configured (Pactflow, Pact Broker, custom).
Review existing contracts for the affected endpoints or messages.
Confirm the environment supports contract verification (CI pipeline, broker access).
During
Consumer-Driven Contract Workflow:
Consumers define the interactions they require (request/response pairs).
Provider pipeline: pull pacts → verify → publish result → deploy if green.
Use pending pacts for new consumers (failures don't block provider).
Use WIP pacts for contracts not yet verified on provider's main branch.
After
All contracts are published to the broker with correct version tags.
Verification results are recorded for both consumer and provider.
can-i-deploy passes for the target environment.
Breaking changes are flagged and communicated to affected teams.
Contract coverage includes all critical interactions (not just happy paths).
Self-check before task completion
Consumer tests define the minimal required interaction (no over-specification).
Provider verification runs against ALL registered consumer contracts.
Schema changes are validated for the correct compatibility level.
Breaking changes have been identified and a migration plan exists.
Contract broker has up-to-date versions for all participants.
CI pipeline gates deployment on can-i-deploy result.
Error scenarios and edge cases are covered in contracts (not just 200 responses).
Contract tests run in isolation (no network calls, no shared state).
1---2name: contract-testing3description: Contract Testing4---56# Contract Testing78## When this skill activates910This skill activates when working with API contract verification between services, consumer-driven contract workflows, schema compatibility checks, or any task involving service boundary agreements. It applies to both synchronous (HTTP/gRPC) and asynchronous (message queue) contracts.1112## Mandatory actions when this skill is active1314### Before15161. Identify all parties in the contract relationship (consumers and providers).172. Determine the contract format in use (Pact, OpenAPI, AsyncAPI, Protobuf).183. Check if a contract broker is already configured (Pactflow, Pact Broker, custom).194. Review existing contracts for the affected endpoints or messages.205. Confirm the environment supports contract verification (CI pipeline, broker access).2122### During2324**Consumer-Driven Contract Workflow:**25- Consumers define the interactions they require (request/response pairs).26- Consumer tests generate contract files (pact files, schemas).27- Contracts are published to a broker with version metadata.28- Providers pull contracts and verify they satisfy all consumer expectations.29- Verification results are published back to the broker.3031**Schema Compatibility Levels:**32- **Backward compatible**: New schema can read data written by old schema.33- **Forward compatible**: Old schema can read data written by new schema.34- **Full compatible**: Both backward and forward (safest for production).35- Always validate compatibility BEFORE deploying schema changes.3637**Breaking Change Detection:**38- Removing a field consumers depend on = BREAKING.39- Changing a field type or format = BREAKING.40- Adding a required field to a request = BREAKING for providers.41- Adding an optional field = SAFE (backward compatible).42- Run `can-i-deploy` checks in CI to gate deployments.4344**Contract Broker Practices:**45- Tag contracts with environment names (dev, staging, prod).46- Use semantic versioning for contract participants.47- Enable webhook notifications on verification failures.48- Maintain contract history for rollback capability.4950**Pact-Specific Workflow:**511. Write consumer test using Pact DSL (define interaction).522. Run consumer test to generate `.pact` JSON file.533. Publish pact to broker with consumer version.544. Provider runs verification against all registered consumer pacts.555. Provider publishes verification result to broker.566. CI runs `can-i-deploy` before any deployment proceeds.5758**CI Integration:**59- Consumer pipeline: test → generate pact → publish → trigger provider verification.60- Provider pipeline: pull pacts → verify → publish result → deploy if green.61- Use pending pacts for new consumers (failures don't block provider).62- Use WIP pacts for contracts not yet verified on provider's main branch.6364### After65661. All contracts are published to the broker with correct version tags.672. Verification results are recorded for both consumer and provider.683. `can-i-deploy` passes for the target environment.694. Breaking changes are flagged and communicated to affected teams.705. Contract coverage includes all critical interactions (not just happy paths).7172## Self-check before task completion7374- [ ] Consumer tests define the minimal required interaction (no over-specification).75- [ ] Provider verification runs against ALL registered consumer contracts.76- [ ] Schema changes are validated for the correct compatibility level.77- [ ] Breaking changes have been identified and a migration plan exists.78- [ ] Contract broker has up-to-date versions for all participants.79- [ ] CI pipeline gates deployment on `can-i-deploy` result.80- [ ] Error scenarios and edge cases are covered in contracts (not just 200 responses).81- [ ] Contract tests run in isolation (no network calls, no shared state).
Run npx skillmds@latest add sairam0424/contract-testing in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Contract Testing It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
sairam0424 (@sairam0424) published this skill. Their other Agent Skills are listed on their SkillMD profile.