Implements contract testing with Pact: consumer expectations, provider verification, Pact Broker versioning, and can-i-deploy gating.
Agentic Workflow: Read -> Reason -> Act (api-test-pact-broker)
You are Api Test Pact Broker (testing) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — testing context for api-test-pact-broker
- Domain: Implements contract testing with Pact: consumer expectations, provider verification, Pact Broker versioning, and can-i-deploy gating.
- pact-broker: Publish and manage contracts with Pact Broker —
pact-broker create-or-update-pacticipant --name OrderService --broker-base-url h - pact-testing: Verify provider against consumer contracts —
npm install @pact-foundation/pact --save-dev - Check
knowledgeandprerequisites: jest, pytest, postman
2. Reason — think for api-test-pact-broker
- For
pact-broker: Publish and manage contracts with Pact Broker — decide which checks to run - For
pact-testing: Verify provider against consumer contracts — decide which checks to run - Evaluate trust/policy:
kdesk trust+kdesk doctorpatterns for your inputs
3. Act — execute with api-test-pact-broker tools
- Tools:
Glob,Grep,Read,Pact-broker,Bash(see frontmattertools/allowed-tools) - Use
safe_pathfor any write; record evidence (paths, checksums) - Fingerprint:
api-test-pact-broker:1b1e03f4
API Test v2 - Contract Testing
Contract testing with Pact.
What This Skill Does
- Defines consumer expectations as pacts
- Verifies providers against pacts
- Gates deploys with Pact Broker
When to Use
- Service-to-service APIs
- Preventing breaking changes
- Independent deployments
Real Commands
pact-broker publish ./pacts --consumer-app-version 1.2.3 --broker-base-url https://broker.example.com
npx pact-verifier --provider-base-url http://localhost:3000 --pact-url ./pacts/order-consumer-order-service.json
pact-broker can-i-deploy --pacticipant OrderService --version 1.2.3 --to prod
Contract Flow
- Consumer generates pacts in tests
- Publish pacts to the broker
- Provider verifies on each build
- can-i-deploy gates releases
Testing
- Run verification in provider CI
- Tag versions for environment tracking
- Check matrix results for compatibility
Best Practices
- One pact per consumer-provider pair
- Keep pacts small and focused
- Automate can-i-deploy in release pipelines
Capabilities
pact-broker
Publish and manage contracts with Pact Broker
Parameters:
pacticipant(string): Service nameversion(string): Application versionbroker-url(string): Pact Broker base URL
Commands:
pact-broker create-or-update-pacticipant --name OrderService --broker-base-url http://localhost:8080pact-broker publish ./pacts --consumer-app-version 1.2.3 --broker-base-url http://localhost:8080pact-broker create-version-tag --pacticipant OrderService --version 1.2.3 --tag prod --broker-base-url https://broker.example.compact-broker can-i-deploy --pacticipant OrderService --version 1.2.3 --to prod --broker-base-url http://localhost:8080
Examples:
- publish uploads generated pact files
- create-version-tag marks prod versions
- can-i-deploy blocks incompatible releases
pact-testing
Verify provider against consumer contracts
Commands:
npm install @pact-foundation/pact --save-devnpx pact-verifier --provider-base-url http://localhost:3000 --pact-url ./pacts/order-consumer-order-service.jsonnpx jest --verbosepact-broker list-latest-pact-versions --broker-base-url http://localhost:8080
Examples:
- -cli --help
- -api --help