.cursor/skills/qa-pact-writer/SKILL.md
Generate consumer-driven contract tests using Pact for JavaScript and Python to verify microservice API compatibility between consumer and provider.
npx skillsauth add AZANIR/qa-skills qa-pact-writerInstall 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.
Write consumer-driven contract tests for microservice API compatibility. Transform API contracts (from qa-api-contract-curator) into Pact consumer tests and provider verification tests. Ensure consumer and provider services remain compatible without brittle end-to-end integration tests.
| Concept | Description | | ------- | ----------- | | Consumer | Service that makes requests (e.g., frontend, API gateway, another microservice) | | Provider | Service that serves requests (e.g., REST API, backend service) | | Pact | Contract/agreement describing expected request/response between consumer and provider | | Pact Broker | Central repository for publishing, versioning, and sharing pacts | | Consumer-driven | Consumer defines expectations; provider verifies it meets them |
| Language | Library | Notes |
| -------- | ------- | ----- |
| JavaScript/TypeScript | @pact-foundation/pact | PactV4 (default), HTTP + async/sync messages |
| Python | pact-python | pytest integration, functional state handlers (v2.3+) |
pacts/ or published to brokergiven (provider state), uponReceiving (scenario name), request (method, path, headers, body), expected response (status, headers, body)like, eachLike, term, regex for flexible matchinggiven state| Pattern | JavaScript | Python |
| ------- | ---------- | ------ |
| Consumer setup | new PactV4() / new Pact() | pact.Consumer(...).has_pact_with(...) |
| Provider verification | Verifier.verifyProvider() | Verifier(provider=...).verify_pacts() |
| Provider states | given() in interaction | state_handler / set_state |
| Matchers | like(), eachLike(), term() | Like, EachLike, Term |
| Pending pacts | pending: true | pending: True |
| WIP pacts | wip: true | wip: True |
See references/patterns.md for consumer tests, provider verification, matchers, provider states.
{consumer}-{provider}.json in pacts/ or brokerCan do (autonomous):
Cannot do (requires confirmation):
Will not do (out of scope):
npm test or pytest)Before delivering Pact tests:
given clauses| Symptom | Likely Cause | Fix |
| ------- | ------------ | --- |
| Pact mock server port conflict | Port already in use | Change port in Pact config; use random port |
| Provider verification fails | State handler not matching given | Ensure state handler name matches consumer given exactly |
| Pact not published to broker | Wrong URL, auth, or version | Verify PACT_BROKER_BASE_URL, PACT_BROKER_TOKEN; check version in publish |
| Matcher mismatch on provider | Provider returns different shape | Align consumer matchers with provider response; or fix provider |
| Consumer test passes, pact empty | Pact not written before teardown | Ensure executeTest() / verify() completes; check output path |
| Python state handler not called | Wrong state name or handler signature | Match given string; use state_handler with correct params (v2.3+) |
references/patterns.md — Consumer tests, provider verification, matchers, provider statesreferences/config.md — Pact Broker setup, CI integration, can-i-deployreferences/best-practices.md — Consumer-driven workflow, versioning, broker managementtools
Analyze OpenAPI/Swagger spec (JSON or YAML) against existing test files and generate an HTML coverage report with QA automation tasks. Use when user provides an OpenAPI spec file and wants to know test coverage status.
testing
Universal QA plan generator supporting 10 plan types including test plans, sprint plans, regression plans, release plans, UAT plans, performance plans, migration plans, onboarding plans, and custom plans.
development
Master skill coordinating all QA skills through pipeline modes (full-cycle, docs-only, testcases-only, write-tests, report), formalized handoff chains, scheduler rules, and framework/language selection based on project context.
testing
Dedicated non-functional requirements analysis per ISO/IEC 25010 quality model covering performance, security, usability, reliability, maintainability, and portability.