スキル一覧に戻る
melodic-software

contract-test-design

by melodic-software

12🍴 2📅 2026年1月20日
GitHubで見るManusで実行

SKILL.md


name: contract-test-design description: Design consumer-driven contract testing strategies using Pact, verify provider contracts, and manage API evolution with contract-first approaches. allowed-tools: Read, Write, Glob, Grep, Task, WebSearch, WebFetch

Contract Test Design

When to Use This Skill

Use this skill when:

  • Contract Test Design tasks - Working on consumer-driven contract testing strategies using Pact
  • Planning or design - Need guidance on contract testing approaches
  • Best practices - Want to follow established patterns and standards

Overview

Contract testing verifies that services communicate correctly by testing the contract (API agreement) between a consumer and provider. Consumer-driven contracts (CDC) ensure providers don't break their consumers.


Contract Testing vs Other Test Types

AspectE2E TestsIntegration TestsContract Tests
ScopeFull systemComponent + depsConsumer-provider
SpeedSlow (minutes)Medium (seconds)Fast (ms)
ReliabilityOften flakyModerateVery stable
Deployment couplingHighMediumLow (async)
Failure localizationPoorModerateExcellent
MaintenanceHighMediumLow

Consumer-Driven Contract Flow

┌─────────────────────────────────────────────────────────────┐
│                    CONSUMER SIDE                            │
│                                                             │
│  1. Consumer writes test   2. Test generates contract       │
│     ┌──────────────┐          ┌──────────────┐              │
│     │ Consumer     │          │   Contract   │              │
│     │ Test         │  ─────►  │   (JSON)     │              │
│     └──────────────┘          └──────────────┘              │
│                                      │                      │
└──────────────────────────────────────┼──────────────────────┘
                                       │
                                       ▼ Publish to Broker
                              ┌──────────────────┐
                              │  Contract Broker │
                              │  (Pact Broker)   │
                              └────────┬─────────┘
                                       │
┌──────────────────────────────────────┼──────────────────────┐
│                    PROVIDER SIDE     │                      │
│                                      ▼                      │
│  3. Provider verifies contract                              │
│     ┌──────────────┐          ┌──────────────┐              │
│     │  Provider    │  ◄─────  │   Contract   │              │
│     │  Verification│          │   (JSON)     │              │
│     └──────────────┘          └──────────────┘              │
│            │                                                │
│            ▼                                                │
│  4. Provider tests pass = Contract honored                  │
│                                                             │
└─────────────────────────────────────────────────────────────┘

Quick Reference: Breaking Changes

Change TypeBreaking?Action
Remove fieldYesBlock deployment
Change field typeYesBlock deployment
Add required fieldYesBlock deployment
Add optional fieldNoAllow
Add new endpointNoAllow

Tooling Selection

PurposeToolRationale
Contract FrameworkPactNet.NET native, mature
BrokerPact BrokerStandard, free tier
Async ContractsPact MessageSame ecosystem
Schema ValidationOpenAPIIndustry standard

References

ReferenceContentWhen to Load
strategy-template.mdContract testing strategy template, service maps, workflowsPlanning contract testing strategy
pact-dotnet-implementation.mdConsumer tests, provider verification, provider statesImplementing Pact in .NET
message-contracts.mdAsync message/event contract testingTesting event-driven architectures
matchers-cicd.mdPact matchers, breaking change detection, CI/CD pipelinesMatcher syntax, CI/CD integration

Integration Points

Inputs from:

  • API specifications → Contract definitions
  • Service architecture → Consumer-provider map
  • test-strategy-planning skill → Contract test scope

Outputs to:

  • CI/CD pipeline → Contract verification gates
  • API governance → Breaking change detection
  • api-design-fundamentals skill → Contract-first design

Test Scenarios

Scenario 1: Planning contract testing strategy

Query: "Help me design a contract testing strategy for our microservices"

Expected: Skill activates, provides strategy template, guides through service mapping

Scenario 2: Implementing Pact tests

Query: "Show me how to write Pact consumer tests in .NET"

Expected: Skill activates, loads pact-dotnet-implementation.md reference, provides code examples

Scenario 3: CI/CD integration

Query: "How do I integrate contract testing into our GitHub Actions pipeline?"

Expected: Skill activates, loads matchers-cicd.md reference, provides pipeline examples


Last Updated: 2025-12-28

Version History

  • v1.1.0 (2025-12-28): Refactored to progressive disclosure - extracted implementation to references/
  • v1.0.0 (2025-12-26): Initial release

スコア

総合スコア

60/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です