Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Generate and validate API contract tests using Pact, Spring Cloud Contract, or OpenAPI with consumer-driven contracts and schema drift detection.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 92% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 30% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 19% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 47% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 42% | 0% |
Trigger conditions:
Use this skill when you need to establish or validate API contracts between consumers and providers, detect schema drift, prevent breaking changes, and integrate contract testing into CI/CD pipelines.
Before execution, verify:
NOW_ET = 2025-10-26T06:31:34-04:00 (NIST/time.gov semantics, America/New_York)api_spec is valid OpenAPI 3.x JSON/YAML, service description, or contract DSLrole is exactly "consumer" or "provider"framework is exactly "pact", "spring-contract", or "openapi"language (if provided) is supported by chosen frameworkNOW_ET; verify links resolveAbort conditions:
api_spec is invalid JSON/YAML or missing required fields (paths, operations)framework and language combination not supported (e.g., Pact with COBOL)Scope: Generate minimal consumer or provider contract test for single endpoint.
Steps:
api_spec: Extract endpoint path, method, request/response schemaExample output: Pact consumer test for GET /users/:id endpoint (JavaScript).
Scope: Generate comprehensive contract tests for 3-5 endpoints with CI pipeline integration.
Steps:
api_specapi_spec against existing contract (if available)Sources (accessed 2025-10-26T06:31:34-04:00):
Scope: Deep analysis of schema evolution, versioning strategies, and contract governance.
Steps:
Additional sources (accessed 2025-10-26T06:31:34-04:00):
Framework selection:
Test generation depth:
Breaking change severity:
Ambiguity thresholds:
api_spec has >20 endpoints, request focus on specific consumer-provider pairRequired fields (all tiers):
json{ "contract_tests": { "type": "code", "language": "javascript|java|python|go", "framework": "pact|spring-contract|openapi", "file_path": "path/to/test/file", "content": "// Full test code..." }, "contract_spec": { "type": "json|yaml", "format": "pact_v3|spring_contract_dsl|openapi_3.1", "content": "{ ... contract JSON ... }" } }
T2+ additional fields:
json{ "ci_integration": { "type": "yaml", "pipeline": "github_actions|gitlab_ci|jenkins", "content": "# Pipeline config..." }, "validation_report": { "type": "markdown", "breaking_changes": [ { "severity": "critical|warning|safe", "description": "Removed endpoint /users/:id", "affected_consumers": ["mobile-app", "web-ui"] } ], "compatibility_matrix": "table of consumer/provider version compatibility" } }
T3 additional fields:
json{ "versioning_plan": { "type": "markdown", "strategy": "url|header|content_negotiation", "migration_steps": ["step 1", "step 2"] }, "governance_workflow": { "type": "markdown", "approval_process": "description", "pact_broker_config": "webhook and notification setup" } }
Example 1: Pact Consumer Test (JavaScript, ≤30 lines)
javascriptconst { PactV3, MatchersV3 } = require('@pact-foundation/pact'); const { getUserById } = require('./api-client'); const provider = new PactV3({ consumer: 'mobile-app', provider: 'user-service' }); describe('User API Contract', () => { it('gets user by ID', () => { provider .given('user 123 exists') .uponReceiving('a request for user 123') .withRequest({ method: 'GET', path: '/users/123', headers: { Accept: 'application/json' }, }) .willRespondWith({ status: 200, headers: { 'Content-Type': 'application/json' }, body: { id: MatchersV3.like(123), name: MatchersV3.like('Alice'), email: MatchersV3.email('alice@example.com'), }, }); return provider.executeTest(async (mockServer) => { const user = await getUserById(mockServer.url, 123); expect(user.name).toBe('Alice'); }); }); });
See /skills/api-contract-testing/resources/ for Spring Cloud Contract and OpenAPI examples.
Token budgets (strict):
Safety requirements:
Auditability:
Determinism:
api_spec + role + framework must generate identical contract testsValidation:
Official Documentation (accessed 2025-10-26T06:31:34-04:00):
Tools and Libraries:
Best Practices:
Example Repositories:
Other measured skills in the registry, with their headline benchmark lift.