contract-testing

Verify microservice API providers against consumer-driven Pact contracts in CI/CD pipelines.

436|78|Updated Sep 11, 2025
One-click install
npx skills add https://github.com/proffesor-for-testing/agentic-qe --skill contract-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: contract-testing
Source: https://github.com/proffesor-for-testing/agentic-qe/tree/main/.claude/skills/contract-testing
Command: npx skills add https://github.com/proffesor-for-testing/agentic-qe --skill contract-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @pact-foundation/pact, ajv.

What problem does it solve?

This Skill prevents breaking changes in microservice APIs that can cause production failures in distributed systems by validating that API providers fulfill the contracts expected by their consumers.

Core Features & Use Cases

  • Consumer-Driven Contracts (Pact): Guides through defining consumer expectations and verifying provider adherence using the Pact framework.
  • Schema Validation: Ensures API responses conform to defined JSON schemas, catching structural inconsistencies early.
  • API Versioning Testing: Provides strategies for testing backward compatibility and managing deprecated fields across API versions.
  • Use Case: For a UserWebApp consuming a UserAPI, use Pact to define the expected user data structure. The UserAPI then verifies against this contract in its CI, preventing breaking changes before deployment.

Quick Start

Use the contract-testing skill to define a consumer-driven contract for the 'get user by ID' endpoint of your UserAPI, expecting specific fields and data types.

Frequently Asked Questions about contract-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent breaking changes in microservice APIs before deployment?

Contract testing validates that API providers fulfill consumer expectations before changes reach production. Define consumer-driven contracts using Pact to catch breaking changes early in CI/CD pipelines, preventing distributed system failures.

What is consumer-driven contract testing and how does it work?

Consumer-driven contract testing defines what data consumers expect from an API, then verifies providers deliver that contract. Using Pact, consumers specify expected fields and data types; providers test against these contracts to ensure compatibility across microservice ecosystems.

Can I use contract testing to manage API versioning and backward compatibility?

Yes. Contract testing with schema validation detects when API responses break expected structures. Combine Pact contracts with semantic versioning strategies to test backward compatibility, manage deprecated fields, and coordinate breaking changes across microservice teams.

How do I integrate contract testing into a CI/CD pipeline?

Add contract validation as a CI step: consumers publish Pact contracts, providers verify against them automatically on each build. This catches incompatibilities before deployment and coordinates versioning decisions across distributed teams without manual integration testing.

What schemas and tools work with contract testing for API validation?

Contract testing coordinates with JSON Schema, OpenAPI/Swagger, and GraphQL for validation. Use Pact for consumer contracts, schema validators like AJV for structural conformance, and versioning strategies to maintain consistency across microservice API changes.

When should I use contract testing instead of traditional end-to-end integration tests?

Contract testing suits distributed microservices where independent teams own providers and consumers. It's faster than full integration tests, catches breaking changes earlier in CI, and eliminates coupling between services—ideal for environments where coordinating live deployments is impractical.