← ClaudeAtlas

consumer-driven-contractlisted

Capture consumer expectations and turn them into provider CI gates (CDC / Pact-style). Use for multi-client APIs, contract tests, "/api-cdc", "consumer contract", "Pact", or in Chinese "消费者契约", "契约测试", "Pact". Prefer minimal consumer assertions over cloning the entire OpenAPI into a test.
Wanbinyu/api-platform-skills · ★ 1 · AI & Automation · score 67
Install: claude install-skill Wanbinyu/api-platform-skills
# Consumer-Driven Contract > Providers do not guess. Consumers assert. CI enforces. ## Overview OpenAPI is necessary; CDC records what each consumer actually requires (status, required keys, content-type) as executable checks. ## Steps 1. **Name consumers** - app/service + owner. 2. **Elicit from code** - grep clients for paths, required keys, status branches (not wish lists). 3. **Write minimal interactions** - provider state -> request -> minimum response. Prefer existing stack: Pact, Spring Cloud Contract, OpenAPI/schema tests, custom. 4. **Provider verification** - CI job, can-i-deploy / merge gate. 5. **Align OpenAPI** - spec must cover consumer-required fields; unused fields are deprecation candidates only. 6. **Process** - consumer updates contract (or paired PR) before provider breaks them. ## Exit criteria - [ ] At least one interaction with request + min response - [ ] Tooling + file paths proposed - [ ] Provider CI verification described - [ ] OpenAPI gaps listed - [ ] Ownership of contract updates clear ## Anti-patterns - Contracts that mirror entire OpenAPI (brittle, not consumer-driven) - Provider-only contracts with no consumer input - Full-body exact equality when three fields matter - Skipping provider states for auth/list flows ## Output template ```markdown ## CDC plan ### Consumers | name | repo/path | owner | |------|-----------|-------| ### Interactions | id | consumer | request | min response | provider state | |----|----------|---------|--