Guides contract testing strategy selection, setup, and verification for APIs and microservices using Pact (consumer-driven) and OpenAPI/Prism (provider-driven).
npx claudepluginhub joshuarweaver/cascade-code-general-misc-3 --plugin asiaostrich-universal-dev-standardsThis skill is limited to using the following tools:
> **Language**: English | [繁體中文](../../locales/zh-TW/skills/contract-test-assistant/SKILL.md)
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
Language: English | 繁體中文
Guide contract testing strategy selection, setup, and verification for APIs and microservices.
引導 API 和微服務的合約測試策略選擇、設定和驗證。
Contract testing verifies that services can communicate correctly by testing the agreements (contracts) between consumers and providers — without requiring all services to be running.
合約測試透過測試消費者和提供者之間的協議(合約)來驗證服務間的通訊正確性,不需要所有服務同時運行。
| Strategy | Best For | Tool | 適用場景 |
|---|---|---|---|
| Consumer-Driven | Internal microservices, team owns both sides | Pact | 內部微服務,團隊同時擁有兩端 |
| Provider-Driven | Public APIs, OpenAPI-first design | OpenAPI + Prism | 公開 API,OpenAPI 優先設計 |
| Bi-Directional | Mixed ownership, gradual adoption | Pact + OpenAPI | 混合所有權,漸進採用 |
ASSESS ──► CHOOSE ──► DEFINE ──► IMPLEMENT ──► VERIFY
評估架構 選擇策略 定義合約 實作測試 驗證合約
| Command | Action | 說明 |
|---|---|---|
/contract-test | Interactive strategy selection | 互動式策略選擇 |
/contract-test consumer | Guide consumer test setup | 引導消費者測試設定 |
/contract-test provider | Guide provider test setup | 引導提供者測試設定 |
/contract-test verify | Check contract coverage | 檢查合約覆蓋率 |
## Contract Coverage Report
| Consumer | Provider | Endpoint | Status |
|----------|----------|----------|--------|
| web-app | user-api | GET /users/:id | ✅ Verified |
| web-app | user-api | POST /users | ✅ Verified |
| mobile-app | auth-api | POST /login | ⚠️ Consumer only |
| admin-ui | report-api | GET /reports | ❌ No contract |
**Coverage**: 50% (2/4 endpoints verified both sides)
| Skill | Integration | 整合方式 |
|---|---|---|
/api-design | Define API contracts during design | 設計時定義 API 合約 |
/ci-cd | Add contract verification to pipeline | 管線中加入合約驗證 |
/testing | Contract tests as part of test strategy | 合約測試作為測試策略一部分 |
After /contract-test completes:
合約測試引導完成。建議下一步:
- 執行
/ci-cd將合約驗證加入 CI 管線- 執行
/api-design完善 API 設計- 執行
/testing整合到整體測試策略
When /contract-test is invoked:
verify subcommand, scan for contracts and report coverage