[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7D89V1QDMHNXFD25XPTVK7B":3,"skill-same:01M7D89V1QDMHNXFD25XPTVK7B":78},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":56,"commitSha":57,"skillDirectory":58,"forksCount":14,"repositoryHtmlUrl":59,"repositoryHomepageUrl":6,"ownerHtmlUrl":60,"ownerBlogUrl":61,"ownerDescription":62,"updatedAt":63,"install":64,"resources":77},"01M7D89V1QDMHNXFD25XPTVK7B","Contract Test Generator",null,"Generate consumer-driven contract tests using Pact framework to verify API provider-consumer compatibility and prevent integration breaking changes","GrupoANDevelopment-m\u002Falberto-ai","GrupoANDevelopment-m","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F257455179?v=4","01M7D69X2N2KEVN0SJF6WGM6SH","Antônio  Ndombe","01M7D69X3P5JTT8H8S904N3888",0,"MIT","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fskills\u002Fqa\u002Fcontract-test-generator\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: Contract Test Generator\ndescription: Generate consumer-driven contract tests using Pact framework to verify API provider-consumer compatibility and prevent integration breaking changes\nversion: 1.0.0\nauthor: Pramod\nlicense: MIT\ntags: [contract-testing, pact, consumer-driven, provider-verification, api-compatibility, pact-broker, integration-testing]\ntestingTypes: [contract, api]\nframeworks: [pact]\nlanguages: [typescript, javascript, java]\ndomains: [api]\nagents: [claude-code, cursor, github-copilot, windsurf, codex, aider, continue, cline, zed, bolt, gemini-cli, amp]\n---\n\n# Contract Test Generator\n\nContract testing bridges the gap between unit tests and full integration tests by verifying that services can communicate correctly without requiring all services to be running simultaneously. Consumer-driven contract testing, pioneered by the Pact framework, inverts the traditional approach: consumers define what they expect from providers, and providers verify they can satisfy those expectations. This skill guides AI coding agents through generating robust contract tests that catch integration breaking changes before they reach production.\n\n## Core Principles\n\n1. **Consumer-Driven Design**: Consumers define the contract based on what they actually use, not what the provider offers. This ensures contracts are minimal, focused, and reflect real usage patterns rather than hypothetical API surfaces.\n\n2. **Provider Verification Independence**: Provider tests verify contracts independently without needing the consumer running. This decouples deployment schedules and enables teams to work autonomously while maintaining integration guarantees.\n\n3. **Contract as Shared Artifact**: The contract (pact file) serves as a living specification between consumer and provider. It is versioned, stored centrally, and referenced by both sides during their respective CI pipelines.\n\n4. **Minimal Assertion Surface**: Contracts should assert only what the consumer needs, not the full provider response. Testing for specific fields rather than entire response bodies prevents brittle contracts that break on harmless provider changes.\n\n5. **Versioning Alignment with Deployability**: Every contract must be associated with a specific consumer version and verified against a specific provider version. The combination of these versions determines whether a deployment is safe.\n\n6. **Fail-Fast in CI**: Contract verification failures must block deployments. The can-i-deploy tool provides a definitive answer about deployment safety based on the latest verification matrix.\n\n7. **Incremental Adoption**: Contract tests can be introduced for the most critical interactions first, then expanded. There is no requirement to cover every endpoint immediately; focus on high-risk integration points.\n\n## Project Structure\n\n```\nproject-root\u002F\n├── consumer\u002F\n│   ├── src\u002F\n│   │   ├── api-client.ts\n│   │   └── types.ts\n│   ├── tests\u002F\n│   │   └── contract\u002F\n│   │       ├── user-service.consumer.pact.ts\n│   │       ├── order-service.consumer.pact.ts\n│   │       └── helpers\u002F\n│   │           ├── pact-setup.ts\n│   │           └── matchers.ts\n│   ├── pacts\u002F                          # Generated pact files (JSON)\n│   │   └── consumer-user_service.json\n│   └── pact-config.ts\n├── provider\u002F\n│   ├── src\u002F\n│   │   └── controllers\u002F\n│   ├── tests\u002F\n│   │   └── contract\u002F\n│   │       ├── provider-verification.pact.ts\n│   │       └── state-handlers\u002F\n│   │           ├── user-states.ts\n│   │           └── order-states.ts\n│   └── pact-config.ts\n├── pact-broker\u002F\n│   └── docker-compose.yml\n└── ci\u002F\n    ├── publish-pacts.sh\n    ├── verify-provider.sh\n    └── can-i-deploy.sh\n```\n\n## Consumer Test Generation\n\n### Basic Consumer Test in TypeScript\n\nConsumer tests define the expectations a consumer has of a provider API. The Pact mock server simulates the provider during consumer tests.\n\n```typescript\n\u002F\u002F consumer\u002Ftests\u002Fcontract\u002Fuser-service.consumer.pact.ts\nimport { PactV4, MatchersV3 } from '@pact-foundation\u002Fpact';\nimport { resolve } from 'path';\nimport { UserApiClient } from '..\u002F..\u002Fsrc\u002Fapi-client';\n\nconst { like, eachLike, regex, integer, string, timestamp } = MatchersV3;\n\nconst provider = new PactV4({\n  consumer: 'frontend-app',\n  provider: 'user-service',\n  dir: resolve(__dirname, '..\u002F..\u002Fpacts'),\n  logLevel: 'warn',\n});\n\ndescribe('User Service Contract', () => {\n  describe('GET \u002Fapi\u002Fusers\u002F:id', () => {\n    it('returns a user when one exists', async () => {\n      await provider\n        .addInteraction()\n        .given('a user with ID 42 exists')\n        .uponReceiving('a request for user 42')\n        .withRequest('GET', '\u002Fapi\u002Fusers\u002F42', (builder) => {\n          builder.headers({\n            Accept: 'application\u002Fjson',\n            Authorization: regex(\u002F^Bearer\\s[\\w-]+\\.[\\w-]+\\.[\\w-]+$\u002F, 'Bearer eyJ.test.token'),\n          });\n        })\n        .willRespondWith(200, (builder) => {\n          builder.headers({ 'Content-Type': 'application\u002Fjson' });\n          builder.jsonBody({\n            id: integer(42),\n            name: string('Jane Doe'),\n            email: regex(\u002F^[\\w.]+@[\\w.]+\\.\\w+$\u002F, 'jane@example.com'),\n            role: regex(\u002F^(admin|user|moderator)$\u002F, 'user'),\n            createdAt: timestamp(\"yyyy-MM-dd'T'HH:mm:ss.SSSX\", '2024-01-15T10:30:00.000Z'),\n            preferences: like({\n              theme: string('dark'),\n              notifications: like(true),\n            }),\n          });\n        })\n        .executeTest(async (mockServer) => {\n          const client = new UserApiClient(mockServer.url);\n          const user = await client.getUser(42);\n\n          expect(user.id).toBe(42);\n          expect(user.name).toBeDefined();\n          expect(user.email).toContain('@');\n        });\n    });\n\n    it('returns 404 when user does not exist', async () => {\n      await provider\n        .addInteraction()\n        .given('no user with ID 999 exists')\n        .uponReceiving('a request for non-existent user 999')\n        .withRequest('GET', '\u002Fapi\u002Fusers\u002F999', (builder) => {\n          builder.headers({\n            Accept: 'application\u002Fjson',\n            Authorization: regex(\u002F^Bearer\\s[\\w-]+\\.[\\w-]+\\.[\\w-]+$\u002F, 'Bearer eyJ.test.token'),\n          });\n        })\n        .willRespondWith(404, (builder) => {\n          builder.headers({ 'Content-Type': 'application\u002Fjson' });\n          builder.jsonBody({\n            error: string('Not Found'),\n            message: string('User with ID 999 not found'),\n          });\n        })\n        .executeTest(async (mockServer) => {\n          const client = new UserApiClient(mockServer.url);\n          await expect(client.getUser(999)).rejects.toThrow('User not found');\n        });\n    });\n  });\n\n  describe('POST \u002Fapi\u002Fusers', () => {\n    it('creates a new user', async () => {\n      await provider\n        .addInteraction()\n        .given('the user creation endpoint is available')\n        .uponReceiving('a request to create a user')\n        .withRequest('POST', '\u002Fapi\u002Fusers', (builder) => {\n          builder.headers({\n            'Content-Type': 'application\u002Fjson',\n            Authorization: regex(\u002F^Bearer\\s.+$\u002F, 'Bearer eyJ.admin.token'),\n          });\n          builder.jsonBody({\n            name: string('John Smith'),\n            email: regex(\u002F^[\\w.]+@[\\w.]+\\.\\w+$\u002F, 'john@example.com'),\n            role: regex(\u002F^(admin|user|moderator)$\u002F, 'user'),\n          });\n        })\n        .willRespondWith(201, (builder) => {\n          builder.headers({ 'Content-Type': 'application\u002Fjson' });\n          builder.jsonBody({\n            id: integer(1),\n            name: string('John Smith'),\n            email: string('john@example.com'),\n            role: string('user'),\n            createdAt: timestamp(\"yyyy-MM-dd'T'HH:mm:ss.SSSX\", '2024-06-01T12:00:00.000Z'),\n          });\n        })\n        .executeTest(async (mockServer) => {\n          const client = new UserApiClient(mockServer.url);\n          const created = await client.createUser({\n            name: 'John Smith',\n            email: 'john@example.com',\n            role: 'user',\n          });\n\n          expect(created.id).toBeDefined();\n          expect(created.name).toBe('John Smith');\n        });\n    });\n  });\n});\n```\n\n### Consumer Test in Java\n\n```java\n\u002F\u002F consumer\u002Fsrc\u002Ftest\u002Fjava\u002Fcom\u002Fexample\u002Fcontract\u002FUserServiceConsumerPactTest.java\npackage com.example.contract;\n\nimport au.com.dius.pact.consumer.dsl.PactDslWithProvider;\nimport au.com.dius.pact.consumer.dsl.PactDslJsonBody;\nimport au.com.dius.pact.consumer.junit5.PactConsumerTestExt;\nimport au.com.dius.pact.consumer.junit5.PactTestFor;\nimport au.com.dius.pact.consumer.MockServer;\nimport au.com.dius.pact.core.model.V4Pact;\nimport au.com.dius.pact.core.model.annotations.Pact;\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.api.extension.ExtendWith;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\n@ExtendWith(PactConsumerTestExt.class)\n@PactTestFor(providerName = \"user-service\", port = \"8080\")\npublic class UserServiceConsumerPactTest {\n\n    @Pact(consumer = \"order-service\")\n    public V4Pact getUserPact(PactDslWithProvider builder) {\n        return builder\n            .given(\"a user with ID 42 exists\")\n            .uponReceiving(\"a request for user 42\")\n                .path(\"\u002Fapi\u002Fusers\u002F42\")\n                .method(\"GET\")\n                .headers(\"Accept\", \"application\u002Fjson\")\n            .willRespondWith()\n                .status(200)\n                .headers(Map.of(\"Content-Type\", \"application\u002Fjson\"))\n                .body(new PactDslJsonBody()\n                    .integerType(\"id\", 42)\n                    .stringType(\"name\", \"Jane Doe\")\n                    .stringMatcher(\"email\", \"^[\\\\w.]+@[\\\\w.]+\\\\.\\\\w+$\", \"jane@example.com\")\n                    .stringType(\"role\", \"user\")\n                    .object(\"address\")\n                        .stringType(\"city\", \"Portland\")\n                        .stringType(\"state\", \"OR\")\n                    .closeObject()\n                )\n            .toPact(V4Pact.class);\n    }\n\n    @Test\n    @PactTestFor(pactMethod = \"getUserPact\")\n    void testGetUser(MockServer mockServer) {\n        UserApiClient client = new UserApiClient(mockServer.getUrl());\n        User user = client.getUser(42);\n\n        assertThat(user.getId()).isEqualTo(42);\n        assertThat(user.getName()).isNotBlank();\n        assertThat(user.getEmail()).contains(\"@\");\n    }\n}\n```\n\n## Provider Verification Setup\n\n### TypeScript Provider Verification\n\n```typescript\n\u002F\u002F provider\u002Ftests\u002Fcontract\u002Fprovider-verification.pact.ts\nimport { Verifier } from '@pact-foundation\u002Fpact';\nimport { resolve } from 'path';\nimport { app } from '..\u002F..\u002Fsrc\u002Fapp';\nimport { Server } from 'http';\n\nlet server: Server;\nconst PORT = 8081;\n\nbeforeAll(async () => {\n  server = app.listen(PORT);\n});\n\nafterAll(async () => {\n  server.close();\n});\n\ndescribe('Provider Verification', () => {\n  it('validates the expectations of all consumers', async () => {\n    const verifier = new Verifier({\n      providerBaseUrl: `http:\u002F\u002Flocalhost:${PORT}`,\n      provider: 'user-service',\n\n      \u002F\u002F Option A: Verify from Pact Broker\n      pactBrokerUrl: process.env.PACT_BROKER_BASE_URL,\n      pactBrokerToken: process.env.PACT_BROKER_TOKEN,\n      publishVerificationResult: process.env.CI === 'true',\n      providerVersion: process.env.GIT_COMMIT_SHA,\n      providerVersionBranch: process.env.GIT_BRANCH,\n\n      \u002F\u002F Enable pending pacts (new contracts won't break provider builds)\n      enablePending: true,\n      includeWipPactsSince: '2024-01-01',\n\n      \u002F\u002F State handlers set up test data for each provider state\n      stateHandlers: {\n        'a user with ID 42 exists': async () => {\n          await seedDatabase({\n            users: [{ id: 42, name: 'Jane Doe', email: 'jane@example.com', role: 'user' }],\n          });\n        },\n        'no user with ID 999 exists': async () => {\n          await clearDatabase('users');\n        },\n        'the user creation endpoint is available': async () => {\n          await clearDatabase('users');\n          await resetSequences('users');\n        },\n      },\n\n      \u002F\u002F Request filter to add auth headers the provider requires\n      requestFilter: (req, _res, next) => {\n        req.headers['Authorization'] = `Bearer ${generateTestToken()}`;\n        next();\n      },\n    });\n\n    await verifier.verifyProvider();\n  });\n});\n```\n\n### Java Provider Verification\n\n```java\n@Provider(\"user-service\")\n@PactBroker(\n    url = \"${PACT_BROKER_BASE_URL}\",\n    authentication = @PactBrokerAuth(token = \"${PACT_BROKER_TOKEN}\")\n)\n@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)\npublic class UserServiceProviderPactTest {\n\n    @LocalServerPort\n    private int port;\n\n    @TestTemplate\n    @ExtendWith(PactVerificationInvocationContextProvider.class)\n    void verifyPact(PactVerificationContext context) {\n        context.verifyInteraction();\n    }\n\n    @BeforeEach\n    void setUp(PactVerificationContext context) {\n        context.setTarget(new HttpTestTarget(\"localhost\", port));\n    }\n\n    @State(\"a user with ID 42 exists\")\n    void userExists() {\n        userRepository.save(new User(42L, \"Jane Doe\", \"jane@example.com\", \"user\"));\n    }\n\n    @State(\"no user with ID 999 exists\")\n    void userDoesNotExist() {\n        userRepository.deleteAll();\n    }\n}\n```\n\n## Pact Broker Integration\n\n### Docker Compose Setup\n\n```yaml\n# pact-broker\u002Fdocker-compose.yml\nversion: '3.8'\nservices:\n  postgres:\n    image: postgres:16-alpine\n    environment:\n      POSTGRES_DB: pact_broker\n      POSTGRES_USER: pact_broker\n      POSTGRES_PASSWORD: pact_broker_password\n    volumes:\n      - pact-db:\u002Fvar\u002Flib\u002Fpostgresql\u002Fdata\n\n  pact-broker:\n    image: pactfoundation\u002Fpact-broker:latest\n    ports:\n      - \"9292:9292\"\n    environment:\n      PACT_BROKER_DATABASE_URL: postgres:\u002F\u002Fpact_broker:pact_broker_password@postgres\u002Fpact_broker\n      PACT_BROKER_BASIC_AUTH_USERNAME: admin\n      PACT_BROKER_BASIC_AUTH_PASSWORD: admin\n      PACT_BROKER_ALLOW_PUBLIC_READ: \"true\"\n      PACT_BROKER_WEBHOOK_SCHEME_WHITELIST: https\n      PACT_BROKER_CHECK_FOR_POTENTIAL_DUPLICATE_PACTICIPANT_NAMES: \"true\"\n    depends_on:\n      - postgres\n\nvolumes:\n  pact-db:\n```\n\n### Publishing Pacts to Broker\n\n```typescript\n\u002F\u002F scripts\u002Fpublish-pacts.ts\nimport { Publisher } from '@pact-foundation\u002Fpact';\nimport { resolve } from 'path';\nimport { execSync } from 'child_process';\n\nconst gitCommitSha = execSync('git rev-parse HEAD').toString().trim();\nconst gitBranch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim();\n\nasync function publishPacts() {\n  const publisher = new Publisher({\n    pactBroker: process.env.PACT_BROKER_BASE_URL || 'http:\u002F\u002Flocalhost:9292',\n    pactBrokerToken: process.env.PACT_BROKER_TOKEN,\n    pactFilesOrDirs: [resolve(__dirname, '..\u002Fpacts')],\n    consumerVersion: gitCommitSha,\n    branch: gitBranch,\n    tags: [gitBranch],\n    buildUrl: process.env.CI_BUILD_URL,\n  });\n\n  await publisher.publishPacts();\n  console.log('Pacts published successfully');\n}\n\npublishPacts().catch((err) => {\n  console.error('Failed to publish pacts:', err);\n  process.exit(1);\n});\n```\n\n## Can-I-Deploy Workflow\n\nThe can-i-deploy tool queries the Pact Broker to determine whether it is safe to deploy a particular version of an application.\n\n```bash\n#!\u002Fbin\u002Fbash\n# ci\u002Fcan-i-deploy.sh\n\nPACTICIPANT=$1\nVERSION=$(git rev-parse HEAD)\nENVIRONMENT=${2:-production}\n\necho \"Checking if $PACTICIPANT version $VERSION can be deployed to $ENVIRONMENT...\"\n\npact-broker can-i-deploy \\\n  --pacticipant \"$PACTICIPANT\" \\\n  --version \"$VERSION\" \\\n  --to-environment \"$ENVIRONMENT\" \\\n  --broker-base-url \"$PACT_BROKER_BASE_URL\" \\\n  --broker-token \"$PACT_BROKER_TOKEN\" \\\n  --retry-while-unknown 30 \\\n  --retry-interval 10\n\nif [ $? -eq 0 ]; then\n  echo \"Safe to deploy. Recording deployment...\"\n  pact-broker record-deployment \\\n    --pacticipant \"$PACTICIPANT\" \\\n    --version \"$VERSION\" \\\n    --environment \"$ENVIRONMENT\" \\\n    --broker-base-url \"$PACT_BROKER_BASE_URL\" \\\n    --broker-token \"$PACT_BROKER_TOKEN\"\nelse\n  echo \"BLOCKED: Cannot deploy $PACTICIPANT to $ENVIRONMENT\"\n  exit 1\nfi\n```\n\n### GitHub Actions CI Pipeline\n\n```yaml\n# .github\u002Fworkflows\u002Fcontract-tests.yml\nname: Contract Tests\non:\n  push:\n    branches: [main, develop]\n  pull_request:\n\njobs:\n  consumer-tests:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v4\n      - uses: actions\u002Fsetup-node@v4\n        with:\n          node-version: 20\n      - run: npm ci\n      - run: npm run test:contract:consumer\n      - name: Publish pacts\n        if: github.ref == 'refs\u002Fheads\u002Fmain' || github.event_name == 'pull_request'\n        run: npx ts-node scripts\u002Fpublish-pacts.ts\n        env:\n          PACT_BROKER_BASE_URL: ${{ secrets.PACT_BROKER_BASE_URL }}\n          PACT_BROKER_TOKEN: ${{ secrets.PACT_BROKER_TOKEN }}\n\n  provider-verification:\n    runs-on: ubuntu-latest\n    needs: consumer-tests\n    steps:\n      - uses: actions\u002Fcheckout@v4\n      - uses: actions\u002Fsetup-node@v4\n        with:\n          node-version: 20\n      - run: npm ci\n      - run: npm run test:contract:provider\n        env:\n          PACT_BROKER_BASE_URL: ${{ secrets.PACT_BROKER_BASE_URL }}\n          PACT_BROKER_TOKEN: ${{ secrets.PACT_BROKER_TOKEN }}\n          GIT_COMMIT_SHA: ${{ github.sha }}\n          GIT_BRANCH: ${{ github.ref_name }}\n\n  can-i-deploy:\n    runs-on: ubuntu-latest\n    needs: [consumer-tests, provider-verification]\n    if: github.ref == 'refs\u002Fheads\u002Fmain'\n    steps:\n      - uses: actions\u002Fcheckout@v4\n      - run: |\n          docker run --rm \\\n            pactfoundation\u002Fpact-cli:latest \\\n            pact-broker can-i-deploy \\\n            --pacticipant frontend-app \\\n            --version ${{ github.sha }} \\\n            --to-environment production \\\n            --broker-base-url ${{ secrets.PACT_BROKER_BASE_URL }} \\\n            --broker-token ${{ secrets.PACT_BROKER_TOKEN }}\n```\n\n## Webhook-Triggered Verification\n\nConfigure Pact Broker webhooks to trigger provider verification whenever a consumer publishes a new pact.\n\n```typescript\n\u002F\u002F scripts\u002Fsetup-webhooks.ts\nimport axios from 'axios';\n\nconst BROKER_URL = process.env.PACT_BROKER_BASE_URL;\nconst BROKER_TOKEN = process.env.PACT_BROKER_TOKEN;\n\nasync function createWebhook() {\n  await axios.post(\n    `${BROKER_URL}\u002Fwebhooks`,\n    {\n      description: 'Trigger provider verification on new pact',\n      events: [\n        { name: 'contract_content_changed' },\n        { name: 'contract_requiring_verification_published' },\n      ],\n      request: {\n        method: 'POST',\n        url: 'https:\u002F\u002Fapi.github.com\u002Frepos\u002FOWNER\u002FREPO\u002Fdispatches',\n        headers: {\n          'Content-Type': 'application\u002Fjson',\n          Accept: 'application\u002Fvnd.github.v3+json',\n          Authorization: 'Bearer ${user.githubToken}',\n        },\n        body: {\n          event_type: 'pact_changed',\n          client_payload: {\n            pact_url: '${pactbroker.pactUrl}',\n            consumer: '${pactbroker.consumerName}',\n            provider: '${pactbroker.providerName}',\n            consumer_version: '${pactbroker.consumerVersionNumber}',\n          },\n        },\n      },\n    },\n    {\n      headers: {\n        Authorization: `Bearer ${BROKER_TOKEN}`,\n        'Content-Type': 'application\u002Fjson',\n      },\n    }\n  );\n}\n```\n\n## Pending Pacts and WIP Pacts\n\nPending pacts prevent new consumers from breaking existing provider builds. WIP (Work in Progress) pacts allow verification of contracts from feature branches.\n\n```typescript\n\u002F\u002F provider\u002Fpact-config.ts\nexport const providerVerificationConfig = {\n  \u002F\u002F Pending pacts: new contracts won't fail the provider build\n  \u002F\u002F Once a pact is successfully verified, it transitions out of pending\n  enablePending: true,\n\n  \u002F\u002F WIP pacts: include pacts from consumer feature branches\n  \u002F\u002F Only pacts published after this date are considered\n  includeWipPactsSince: '2024-01-01',\n\n  \u002F\u002F Consumer version selectors determine which pacts to verify\n  consumerVersionSelectors: [\n    { mainBranch: true },                    \u002F\u002F Pacts from consumers' main branch\n    { deployedOrReleased: true },            \u002F\u002F Pacts from currently deployed consumers\n    { matchingBranch: true },                \u002F\u002F Pacts from same-named feature branch\n    { branch: 'develop' },                   \u002F\u002F Always verify develop branch pacts\n  ],\n};\n```\n\n## Bi-Directional Contract Testing\n\nBi-directional contract testing allows providers to publish their own OpenAPI specification rather than running consumer pact tests directly. The Pact Broker compares the consumer pact with the provider specification.\n\n```typescript\n\u002F\u002F provider\u002Fscripts\u002Fpublish-provider-contract.ts\nimport { execSync } from 'child_process';\n\nconst gitSha = execSync('git rev-parse HEAD').toString().trim();\nconst branch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim();\n\n\u002F\u002F Publish the provider's OpenAPI spec as its contract\nexecSync(`\n  pactflow publish-provider-contract \\\n    .\u002Fopenapi\u002Fuser-service.yaml \\\n    --provider user-service \\\n    --provider-app-version ${gitSha} \\\n    --branch ${branch} \\\n    --content-type application\u002Fyaml \\\n    --verification-exit-code 0 \\\n    --verification-results .\u002Ftest-results\u002Fprovider-tests.json \\\n    --verification-results-content-type application\u002Fjson \\\n    --verifier pactflow-self-verification \\\n    --broker-base-url ${process.env.PACT_BROKER_BASE_URL} \\\n    --broker-token ${process.env.PACT_BROKER_TOKEN}\n`);\n```\n\n## GraphQL Contract Testing\n\n```typescript\n\u002F\u002F consumer\u002Ftests\u002Fcontract\u002Fgraphql.consumer.pact.ts\nimport { PactV4, MatchersV3 } from '@pact-foundation\u002Fpact';\nconst { like, eachLike, string, integer } = MatchersV3;\n\nconst provider = new PactV4({\n  consumer: 'graphql-client',\n  provider: 'graphql-gateway',\n});\n\ndescribe('GraphQL Contract', () => {\n  it('fetches user with orders via GraphQL', async () => {\n    await provider\n      .addInteraction()\n      .given('user 42 has orders')\n      .uponReceiving('a GraphQL query for user with orders')\n      .withRequest('POST', '\u002Fgraphql', (builder) => {\n        builder.headers({ 'Content-Type': 'application\u002Fjson' });\n        builder.jsonBody({\n          query: string(`\n            query GetUser($id: ID!) {\n              user(id: $id) {\n                id\n                name\n                orders {\n                  id\n                  total\n                  status\n                }\n              }\n            }\n          `),\n          variables: like({ id: '42' }),\n        });\n      })\n      .willRespondWith(200, (builder) => {\n        builder.jsonBody({\n          data: {\n            user: {\n              id: string('42'),\n              name: string('Jane Doe'),\n              orders: eachLike({\n                id: string('order-1'),\n                total: like(99.99),\n                status: string('SHIPPED'),\n              }),\n            },\n          },\n        });\n      })\n      .executeTest(async (mockServer) => {\n        const client = new GraphQLClient(mockServer.url + '\u002Fgraphql');\n        const result = await client.query(GET_USER_WITH_ORDERS, { id: '42' });\n        expect(result.data.user.orders.length).toBeGreaterThan(0);\n      });\n  });\n});\n```\n\n## Message-Based Contract Testing\n\nFor asynchronous event-driven systems, message pact testing validates the structure of messages published to queues or topics.\n\n```typescript\n\u002F\u002F consumer\u002Ftests\u002Fcontract\u002Forder-events.consumer.pact.ts\nimport { PactV4, MatchersV3 } from '@pact-foundation\u002Fpact';\nconst { like, string, integer, timestamp, regex } = MatchersV3;\n\nconst provider = new PactV4({\n  consumer: 'notification-service',\n  provider: 'order-service',\n});\n\ndescribe('Order Event Contract', () => {\n  it('handles order.completed events', async () => {\n    await provider\n      .addInteraction()\n      .given('an order has been completed')\n      .expectsToReceive('an order.completed event')\n      .withContentV4((builder) => {\n        builder.jsonBody({\n          eventType: string('order.completed'),\n          timestamp: timestamp(\"yyyy-MM-dd'T'HH:mm:ss.SSSX\", '2024-06-01T12:00:00.000Z'),\n          payload: {\n            orderId: string('ord-12345'),\n            customerId: integer(42),\n            total: like(149.99),\n            currency: regex(\u002F^[A-Z]{3}$\u002F, 'USD'),\n            items: [\n              {\n                productId: string('prod-001'),\n                quantity: integer(2),\n                price: like(74.99),\n              },\n            ],\n            shippingAddress: {\n              street: string('123 Main St'),\n              city: string('Portland'),\n              state: regex(\u002F^[A-Z]{2}$\u002F, 'OR'),\n              zip: regex(\u002F^\\d{5}(-\\d{4})?$\u002F, '97201'),\n            },\n          },\n        });\n      })\n      .executeTest(async (message) => {\n        const handler = new OrderCompletedHandler();\n        const result = await handler.handle(JSON.parse(message.contents.toString()));\n\n        expect(result.notificationSent).toBe(true);\n        expect(result.recipientId).toBe(42);\n      });\n  });\n});\n\n\u002F\u002F provider\u002Ftests\u002Fcontract\u002Fmessage-provider-verification.ts\nimport { MessageProviderPact } from '@pact-foundation\u002Fpact';\n\ndescribe('Message Provider Verification', () => {\n  it('verifies order event messages', async () => {\n    const messageProvider = new MessageProviderPact({\n      provider: 'order-service',\n      pactBrokerUrl: process.env.PACT_BROKER_BASE_URL,\n      pactBrokerToken: process.env.PACT_BROKER_TOKEN,\n      publishVerificationResult: process.env.CI === 'true',\n      providerVersion: process.env.GIT_COMMIT_SHA,\n\n      messageProviders: {\n        'an order.completed event': async () => {\n          \u002F\u002F Return the actual message your service would produce\n          return {\n            eventType: 'order.completed',\n            timestamp: new Date().toISOString(),\n            payload: {\n              orderId: 'ord-12345',\n              customerId: 42,\n              total: 149.99,\n              currency: 'USD',\n              items: [{ productId: 'prod-001', quantity: 2, price: 74.99 }],\n              shippingAddress: {\n                street: '123 Main St',\n                city: 'Portland',\n                state: 'OR',\n                zip: '97201',\n              },\n            },\n          };\n        },\n      },\n\n      stateHandlers: {\n        'an order has been completed': async () => {\n          \u002F\u002F Set up state as needed\n        },\n      },\n    });\n\n    await messageProvider.verify();\n  });\n});\n```\n\n## Configuration\n\n### Consumer Pact Configuration\n\n```typescript\n\u002F\u002F consumer\u002Fpact-config.ts\nimport { LogLevel } from '@pact-foundation\u002Fpact';\nimport { resolve } from 'path';\n\nexport const pactConfig = {\n  \u002F\u002F Pact file output directory\n  dir: resolve(__dirname, 'pacts'),\n\n  \u002F\u002F Logging level: trace, debug, info, warn, error\n  logLevel: (process.env.PACT_LOG_LEVEL as LogLevel) || 'warn',\n\n  \u002F\u002F Pact specification version\n  spec: 4,\n\n  \u002F\u002F Timeout for pact mock server (milliseconds)\n  timeout: 30000,\n};\n```\n\n### Provider Verification Configuration\n\n```typescript\n\u002F\u002F provider\u002Fpact-config.ts\nexport const providerConfig = {\n  providerBaseUrl: process.env.PROVIDER_BASE_URL || 'http:\u002F\u002Flocalhost:3000',\n  provider: 'user-service',\n\n  pactBrokerUrl: process.env.PACT_BROKER_BASE_URL,\n  pactBrokerToken: process.env.PACT_BROKER_TOKEN,\n\n  publishVerificationResult: process.env.CI === 'true',\n  providerVersion: process.env.GIT_COMMIT_SHA || 'local',\n  providerVersionBranch: process.env.GIT_BRANCH || 'local',\n\n  enablePending: true,\n  includeWipPactsSince: '2024-01-01',\n\n  consumerVersionSelectors: [\n    { mainBranch: true },\n    { deployedOrReleased: true },\n    { matchingBranch: true },\n  ],\n\n  \u002F\u002F Timeout for provider state setup (milliseconds)\n  stateHandlerTimeout: 10000,\n\n  \u002F\u002F Request timeout for each interaction verification\n  requestTimeout: 15000,\n};\n```\n\n### Package.json Scripts\n\n```json\n{\n  \"scripts\": {\n    \"test:contract:consumer\": \"jest --testPathPattern=consumer.pact\",\n    \"test:contract:provider\": \"jest --testPathPattern=provider-verification\",\n    \"pact:publish\": \"ts-node scripts\u002Fpublish-pacts.ts\",\n    \"pact:can-i-deploy\": \"bash ci\u002Fcan-i-deploy.sh\",\n    \"pact:broker\": \"docker compose -f pact-broker\u002Fdocker-compose.yml up -d\"\n  }\n}\n```\n\n## Best Practices\n\n1. **Use Pact matchers instead of exact values.** Matchers like `like()`, `regex()`, and `eachLike()` validate structure and type rather than specific values, making contracts resilient to data changes.\n\n2. **Keep provider states minimal and descriptive.** Each `given()` state should describe a precondition clearly (e.g., \"a user with ID 42 exists\") and the state handler should set up only what is needed.\n\n3. **Version pacts with git commit SHA.** Using the git commit SHA as the consumer version ensures traceability and enables the can-i-deploy tool to accurately determine deployment safety.\n\n4. **Enable pending pacts in provider verification.** This prevents new consumers or new interactions from immediately breaking the provider build while still tracking verification status.\n\n5. **Run can-i-deploy before every deployment.** This is the single most important practice for preventing integration breakages; it should gate every production deployment.\n\n6. **Test only what the consumer uses.** If the consumer only reads the `id` and `name` fields from a 20-field response, the contract should only assert on those two fields.\n\n7. **Use consumer version selectors wisely.** Always verify pacts from `mainBranch` and `deployedOrReleased`; add `matchingBranch` for feature branch coordination between teams.\n\n8. **Publish verification results from CI only.** Set `publishVerificationResult: true` only when running in CI to avoid polluting the broker with local verification results.\n\n9. **Implement proper state handlers.** Provider state handlers should seed the database or configure mocks to satisfy each consumer expectation reproducibly.\n\n10. **Tag environments with record-deployment.** After successful deployment, record the deployment in the broker so can-i-deploy knows which versions are in which environments.\n\n11. **Include request headers in contracts when they affect behavior.** If the provider returns different responses based on Accept headers or API versions, include those in the contract.\n\n12. **Use separate CI jobs for consumer and provider.** Consumer tests and provider verification should run independently, connected only through the Pact Broker.\n\n## Anti-Patterns to Avoid\n\n1. **Asserting on entire response bodies.** Never match every field in a provider response. This creates brittle contracts that break when the provider adds a new field, which should be a non-breaking change.\n\n2. **Using exact matchers for dynamic data.** Dates, IDs, and timestamps should use type matchers or regex matchers, not exact values. Using `like(42)` is correct; using the literal `42` is fragile.\n\n3. **Sharing a single provider state across unrelated tests.** Each test should declare its own provider state. Reusing states like \"default state\" leads to hidden coupling and test fragility.\n\n4. **Running provider verification against a shared staging environment.** Provider verification must run against a locally started provider instance to ensure reproducibility and speed.\n\n5. **Skipping can-i-deploy because it is slow.** If can-i-deploy is too slow, configure retry parameters rather than bypassing it. The `--retry-while-unknown` flag handles asynchronous verification gracefully.\n\n6. **Coupling consumer and provider test suites.** Consumer and provider tests must live in their respective repositories. The pact file (or broker) is the only connection between them.\n\n7. **Using contract tests as functional tests.** Contract tests verify the shape and structure of interactions, not business logic. Do not test complex business scenarios through contracts.\n\n## Debugging Tips\n\n1. **Enable verbose logging.** Set `logLevel: 'debug'` in the Pact configuration or use the environment variable `PACT_LOG_LEVEL=debug` to see detailed request\u002Fresponse matching output.\n\n2. **Inspect generated pact files.** The JSON pact files in the output directory contain the exact interactions defined. Reviewing these files helps identify matcher misconfigurations before publishing.\n\n3. **Use the Pact Broker UI.** The broker provides a visual matrix showing which consumer versions are verified against which provider versions. This is invaluable for diagnosing can-i-deploy failures.\n\n4. **Check provider state handler execution.** If verification fails with unexpected data, add logging to state handlers to confirm they execute and set up data correctly.\n\n5. **Verify the mock server URL.** A common failure is the consumer test using a hardcoded URL instead of `mockServer.url`. Always construct the API client with the dynamic mock server URL.\n\n6. **Compare pact specification versions.** If consumer and provider use different Pact specification versions (v2 vs v3 vs v4), certain matchers may not be supported. Align on the same specification version.\n\n7. **Check for port conflicts.** When running multiple Pact tests in parallel, ensure each test uses a unique port or let Pact assign random ports automatically.\n\n8. **Validate webhook configuration.** If provider verification does not trigger after pact publication, check the broker webhook configuration and review the webhook execution logs in the broker UI.\n\n9. **Review the verification output diff.** When provider verification fails, the output shows an expected vs actual diff. Focus on the specific field or header that mismatched rather than the entire interaction.\n\n10. **Test state handlers in isolation.** Before running full verification, run state handler functions independently to confirm they produce the expected database state or mock configuration.\n","# Contract Test Generator\n\nContract testing bridges the gap between unit tests and full integration tests by verifying that services can communicate correctly without requiring all services to be running simultaneously. Consumer-driven contract testing, pioneered by the Pact framework, inverts the traditional approach: consumers define what they expect from providers, and providers verify they can satisfy those expectations. This skill guides AI coding agents through generating robust contract tests that catch integration breaking changes before they reach production.\n\n## Core Principles\n\n1. **Consumer-Driven Design**: Consumers define the contract based on what they actually use, not what the provider offers. This ensures contracts are minimal, focused, and reflect real usage patterns rather than hypothetical API surfaces.\n\n2. **Provider Verification Independence**: Provider tests verify contracts independently without needing the consumer running. This decouples deployment schedules and enables teams to work autonomously while maintaining integration guarantees.\n\n3. **Contract as Shared Artifact**: The contract (pact file) serves as a living specification between consumer and provider. It is versioned, stored centrally, and referenced by both sides during their respective CI pipelines.\n\n4. **Minimal Assertion Surface**: Contracts should assert only what the consumer needs, not the full provider response. Testing for specific fields rather than entire response bodies prevents brittle contracts that break on harmless provider changes.\n\n5. **Versioning Alignment with Deployability**: Every contract must be associated with a specific consumer version and verified against a specific provider version. The combination of these versions determines whether a deployment is safe.\n\n6. **Fail-Fast in CI**: Contract verification failures must block deployments. The can-i-deploy tool provides a definitive answer about deployment safety based on the latest verification matrix.\n\n7. **Incremental Adoption**: Contract tests can be introduced for the most critical interactions first, then expanded. There is no requirement to cover every endpoint immediately; focus on high-risk integration points.\n\n## Project Structure\n\n```\nproject-root\u002F\n├── consumer\u002F\n│   ├── src\u002F\n│   │   ├── api-client.ts\n│   │   └── types.ts\n│   ├── tests\u002F\n│   │   └── contract\u002F\n│   │       ├── user-service.consumer.pact.ts\n│   │       ├── order-service.consumer.pact.ts\n│   │       └── helpers\u002F\n│   │           ├── pact-setup.ts\n│   │           └── matchers.ts\n│   ├── pacts\u002F                          # Generated pact files (JSON)\n│   │   └── consumer-user_service.json\n│   └── pact-config.ts\n├── provider\u002F\n│   ├── src\u002F\n│   │   └── controllers\u002F\n│   ├── tests\u002F\n│   │   └── contract\u002F\n│   │       ├── provider-verification.pact.ts\n│   │       └── state-handlers\u002F\n│   │           ├── user-states.ts\n│   │           └── order-states.ts\n│   └── pact-config.ts\n├── pact-broker\u002F\n│   └── docker-compose.yml\n└── ci\u002F\n    ├── publish-pacts.sh\n    ├── verify-provider.sh\n    └── can-i-deploy.sh\n```\n\n## Consumer Test Generation\n\n### Basic Consumer Test in TypeScript\n\nConsumer tests define the expectations a consumer has of a provider API. The Pact mock server simulates the provider during consumer tests.\n\n```typescript\n\u002F\u002F consumer\u002Ftests\u002Fcontract\u002Fuser-service.consumer.pact.ts\nimport { PactV4, MatchersV3 } from '@pact-foundation\u002Fpact';\nimport { resolve } from 'path';\nimport { UserApiClient } from '..\u002F..\u002Fsrc\u002Fapi-client';\n\nconst { like, eachLike, regex, integer, string, timestamp } = MatchersV3;\n\nconst provider = new PactV4({\n  consumer: 'frontend-app',\n  provider: 'user-service',\n  dir: resolve(__dirname, '..\u002F..\u002Fpacts'),\n  logLevel: 'warn',\n});\n\ndescribe('User Service Contract', () => {\n  describe('GET \u002Fapi\u002Fusers\u002F:id', () => {\n    it('returns a user when one exists', async () => {\n      await provider\n        .addInteraction()\n        .given('a user with ID 42 exists')\n        .uponReceiving('a request for user 42')\n        .withRequest('GET', '\u002Fapi\u002Fusers\u002F42', (builder) => {\n          builder.headers({\n            Accept: 'application\u002Fjson',\n            Authorization: regex(\u002F^Bearer\\s[\\w-]+\\.[\\w-]+\\.[\\w-]+$\u002F, 'Bearer eyJ.test.token'),\n          });\n        })\n        .willRespondWith(200, (builder) => {\n          builder.headers({ 'Content-Type': 'application\u002Fjson' });\n          builder.jsonBody({\n            id: integer(42),\n            name: string('Jane Doe'),\n            email: regex(\u002F^[\\w.]+@[\\w.]+\\.\\w+$\u002F, 'jane@example.com'),\n            role: regex(\u002F^(admin|user|moderator)$\u002F, 'user'),\n            createdAt: timestamp(\"yyyy-MM-dd'T'HH:mm:ss.SSSX\", '2024-01-15T10:30:00.000Z'),\n            preferences: like({\n              theme: string('dark'),\n              notifications: like(true),\n            }),\n          });\n        })\n        .executeTest(async (mockServer) => {\n          const client = new UserApiClient(mockServer.url);\n          const user = await client.getUser(42);\n\n          expect(user.id).toBe(42);\n          expect(user.name).toBeDefined();\n          expect(user.email).toContain('@');\n        });\n    });\n\n    it('returns 404 when user does not exist', async () => {\n      await provider\n        .addInteraction()\n        .given('no user with ID 999 exists')\n        .uponReceiving('a request for non-existent user 999')\n        .withRequest('GET', '\u002Fapi\u002Fusers\u002F999', (builder) => {\n          builder.headers({\n            Accept: 'application\u002Fjson',\n            Authorization: regex(\u002F^Bearer\\s[\\w-]+\\.[\\w-]+\\.[\\w-]+$\u002F, 'Bearer eyJ.test.token'),\n          });\n        })\n        .willRespondWith(404, (builder) => {\n          builder.headers({ 'Content-Type': 'application\u002Fjson' });\n          builder.jsonBody({\n            error: string('Not Found'),\n            message: string('User with ID 999 not found'),\n          });\n        })\n        .executeTest(async (mockServer) => {\n          const client = new UserApiClient(mockServer.url);\n          await expect(client.getUser(999)).rejects.toThrow('User not found');\n        });\n    });\n  });\n\n  describe('POST \u002Fapi\u002Fusers', () => {\n    it('creates a new user', async () => {\n      await provider\n        .addInteraction()\n        .given('the user creation endpoint is available')\n        .uponReceiving('a request to create a user')\n        .withRequest('POST', '\u002Fapi\u002Fusers', (builder) => {\n          builder.headers({\n            'Content-Type': 'application\u002Fjson',\n            Authorization: regex(\u002F^Bearer\\s.+$\u002F, 'Bearer eyJ.admin.token'),\n          });\n          builder.jsonBody({\n            name: string('John Smith'),\n            email: regex(\u002F^[\\w.]+@[\\w.]+\\.\\w+$\u002F, 'john@example.com'),\n            role: regex(\u002F^(admin|user|moderator)$\u002F, 'user'),\n          });\n        })\n        .willRespondWith(201, (builder) => {\n          builder.headers({ 'Content-Type': 'application\u002Fjson' });\n          builder.jsonBody({\n            id: integer(1),\n            name: string('John Smith'),\n            email: string('john@example.com'),\n            role: string('user'),\n            createdAt: timestamp(\"yyyy-MM-dd'T'HH:mm:ss.SSSX\", '2024-06-01T12:00:00.000Z'),\n          });\n        })\n        .executeTest(async (mockServer) => {\n          const client = new UserApiClient(mockServer.url);\n          const created = await client.createUser({\n            name: 'John Smith',\n            email: 'john@example.com',\n            role: 'user',\n          });\n\n          expect(created.id).toBeDefined();\n          expect(created.name).toBe('John Smith');\n        });\n    });\n  });\n});\n```\n\n### Consumer Test in Java\n\n```java\n\u002F\u002F consumer\u002Fsrc\u002Ftest\u002Fjava\u002Fcom\u002Fexample\u002Fcontract\u002FUserServiceConsumerPactTest.java\npackage com.example.contract;\n\nimport au.com.dius.pact.consumer.dsl.PactDslWithProvider;\nimport au.com.dius.pact.consumer.dsl.PactDslJsonBody;\nimport au.com.dius.pact.consumer.junit5.PactConsumerTestExt;\nimport au.com.dius.pact.consumer.junit5.PactTestFor;\nimport au.com.dius.pact.consumer.MockServer;\nimport au.com.dius.pact.core.model.V4Pact;\nimport au.com.dius.pact.core.model.annotations.Pact;\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.api.extension.ExtendWith;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\n@ExtendWith(PactConsumerTestExt.class)\n@PactTestFor(providerName = \"user-service\", port = \"8080\")\npublic class UserServiceConsumerPactTest {\n\n    @Pact(consumer = \"order-service\")\n    public V4Pact getUserPact(PactDslWithProvider builder) {\n        return builder\n            .given(\"a user with ID 42 exists\")\n            .uponReceiving(\"a request for user 42\")\n                .path(\"\u002Fapi\u002Fusers\u002F42\")\n                .method(\"GET\")\n                .headers(\"Accept\", \"application\u002Fjson\")\n            .willRespondWith()\n                .status(200)\n                .headers(Map.of(\"Content-Type\", \"application\u002Fjson\"))\n                .body(new PactDslJsonBody()\n                    .integerType(\"id\", 42)\n                    .stringType(\"name\", \"Jane Doe\")\n                    .stringMatcher(\"email\", \"^[\\\\w.]+@[\\\\w.]+\\\\.\\\\w+$\", \"jane@example.com\")\n                    .stringType(\"role\", \"user\")\n                    .object(\"address\")\n                        .stringType(\"city\", \"Portland\")\n                        .stringType(\"state\", \"OR\")\n                    .closeObject()\n                )\n            .toPact(V4Pact.class);\n    }\n\n    @Test\n    @PactTestFor(pactMethod = \"getUserPact\")\n    void testGetUser(MockServer mockServer) {\n        UserApiClient client = new UserApiClient(mockServer.getUrl());\n        User user = client.getUser(42);\n\n        assertThat(user.getId()).isEqualTo(42);\n        assertThat(user.getName()).isNotBlank();\n        assertThat(user.getEmail()).contains(\"@\");\n    }\n}\n```\n\n## Provider Verification Setup\n\n### TypeScript Provider Verification\n\n```typescript\n\u002F\u002F provider\u002Ftests\u002Fcontract\u002Fprovider-verification.pact.ts\nimport { Verifier } from '@pact-foundation\u002Fpact';\nimport { resolve } from 'path';\nimport { app } from '..\u002F..\u002Fsrc\u002Fapp';\nimport { Server } from 'http';\n\nlet server: Server;\nconst PORT = 8081;\n\nbeforeAll(async () => {\n  server = app.listen(PORT);\n});\n\nafterAll(async () => {\n  server.close();\n});\n\ndescribe('Provider Verification', () => {\n  it('validates the expectations of all consumers', async () => {\n    const verifier = new Verifier({\n      providerBaseUrl: `http:\u002F\u002Flocalhost:${PORT}`,\n      provider: 'user-service',\n\n      \u002F\u002F Option A: Verify from Pact Broker\n      pactBrokerUrl: process.env.PACT_BROKER_BASE_URL,\n      pactBrokerToken: process.env.PACT_BROKER_TOKEN,\n      publishVerificationResult: process.env.CI === 'true',\n      providerVersion: process.env.GIT_COMMIT_SHA,\n      providerVersionBranch: process.env.GIT_BRANCH,\n\n      \u002F\u002F Enable pending pacts (new contracts won't break provider builds)\n      enablePending: true,\n      includeWipPactsSince: '2024-01-01',\n\n      \u002F\u002F State handlers set up test data for each provider state\n      stateHandlers: {\n        'a user with ID 42 exists': async () => {\n          await seedDatabase({\n            users: [{ id: 42, name: 'Jane Doe', email: 'jane@example.com', role: 'user' }],\n          });\n        },\n        'no user with ID 999 exists': async () => {\n          await clearDatabase('users');\n        },\n        'the user creation endpoint is available': async () => {\n          await clearDatabase('users');\n          await resetSequences('users');\n        },\n      },\n\n      \u002F\u002F Request filter to add auth headers the provider requires\n      requestFilter: (req, _res, next) => {\n        req.headers['Authorization'] = `Bearer ${generateTestToken()}`;\n        next();\n      },\n    });\n\n    await verifier.verifyProvider();\n  });\n});\n```\n\n### Java Provider Verification\n\n```java\n@Provider(\"user-service\")\n@PactBroker(\n    url = \"${PACT_BROKER_BASE_URL}\",\n    authentication = @PactBrokerAuth(token = \"${PACT_BROKER_TOKEN}\")\n)\n@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)\npublic class UserServiceProviderPactTest {\n\n    @LocalServerPort\n    private int port;\n\n    @TestTemplate\n    @ExtendWith(PactVerificationInvocationContextProvider.class)\n    void verifyPact(PactVerificationContext context) {\n        context.verifyInteraction();\n    }\n\n    @BeforeEach\n    void setUp(PactVerificationContext context) {\n        context.setTarget(new HttpTestTarget(\"localhost\", port));\n    }\n\n    @State(\"a user with ID 42 exists\")\n    void userExists() {\n        userRepository.save(new User(42L, \"Jane Doe\", \"jane@example.com\", \"user\"));\n    }\n\n    @State(\"no user with ID 999 exists\")\n    void userDoesNotExist() {\n        userRepository.deleteAll();\n    }\n}\n```\n\n## Pact Broker Integration\n\n### Docker Compose Setup\n\n```yaml\n# pact-broker\u002Fdocker-compose.yml\nversion: '3.8'\nservices:\n  postgres:\n    image: postgres:16-alpine\n    environment:\n      POSTGRES_DB: pact_broker\n      POSTGRES_USER: pact_broker\n      POSTGRES_PASSWORD: pact_broker_password\n    volumes:\n      - pact-db:\u002Fvar\u002Flib\u002Fpostgresql\u002Fdata\n\n  pact-broker:\n    image: pactfoundation\u002Fpact-broker:latest\n    ports:\n      - \"9292:9292\"\n    environment:\n      PACT_BROKER_DATABASE_URL: postgres:\u002F\u002Fpact_broker:pact_broker_password@postgres\u002Fpact_broker\n      PACT_BROKER_BASIC_AUTH_USERNAME: admin\n      PACT_BROKER_BASIC_AUTH_PASSWORD: admin\n      PACT_BROKER_ALLOW_PUBLIC_READ: \"true\"\n      PACT_BROKER_WEBHOOK_SCHEME_WHITELIST: https\n      PACT_BROKER_CHECK_FOR_POTENTIAL_DUPLICATE_PACTICIPANT_NAMES: \"true\"\n    depends_on:\n      - postgres\n\nvolumes:\n  pact-db:\n```\n\n### Publishing Pacts to Broker\n\n```typescript\n\u002F\u002F scripts\u002Fpublish-pacts.ts\nimport { Publisher } from '@pact-foundation\u002Fpact';\nimport { resolve } from 'path';\nimport { execSync } from 'child_process';\n\nconst gitCommitSha = execSync('git rev-parse HEAD').toString().trim();\nconst gitBranch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim();\n\nasync function publishPacts() {\n  const publisher = new Publisher({\n    pactBroker: process.env.PACT_BROKER_BASE_URL || 'http:\u002F\u002Flocalhost:9292',\n    pactBrokerToken: process.env.PACT_BROKER_TOKEN,\n    pactFilesOrDirs: [resolve(__dirname, '..\u002Fpacts')],\n    consumerVersion: gitCommitSha,\n    branch: gitBranch,\n    tags: [gitBranch],\n    buildUrl: process.env.CI_BUILD_URL,\n  });\n\n  await publisher.publishPacts();\n  console.log('Pacts published successfully');\n}\n\npublishPacts().catch((err) => {\n  console.error('Failed to publish pacts:', err);\n  process.exit(1);\n});\n```\n\n## Can-I-Deploy Workflow\n\nThe can-i-deploy tool queries the Pact Broker to determine whether it is safe to deploy a particular version of an application.\n\n```bash\n#!\u002Fbin\u002Fbash\n# ci\u002Fcan-i-deploy.sh\n\nPACTICIPANT=$1\nVERSION=$(git rev-parse HEAD)\nENVIRONMENT=${2:-production}\n\necho \"Checking if $PACTICIPANT version $VERSION can be deployed to $ENVIRONMENT...\"\n\npact-broker can-i-deploy \\\n  --pacticipant \"$PACTICIPANT\" \\\n  --version \"$VERSION\" \\\n  --to-environment \"$ENVIRONMENT\" \\\n  --broker-base-url \"$PACT_BROKER_BASE_URL\" \\\n  --broker-token \"$PACT_BROKER_TOKEN\" \\\n  --retry-while-unknown 30 \\\n  --retry-interval 10\n\nif [ $? -eq 0 ]; then\n  echo \"Safe to deploy. Recording deployment...\"\n  pact-broker record-deployment \\\n    --pacticipant \"$PACTICIPANT\" \\\n    --version \"$VERSION\" \\\n    --environment \"$ENVIRONMENT\" \\\n    --broker-base-url \"$PACT_BROKER_BASE_URL\" \\\n    --broker-token \"$PACT_BROKER_TOKEN\"\nelse\n  echo \"BLOCKED: Cannot deploy $PACTICIPANT to $ENVIRONMENT\"\n  exit 1\nfi\n```\n\n### GitHub Actions CI Pipeline\n\n```yaml\n# .github\u002Fworkflows\u002Fcontract-tests.yml\nname: Contract Tests\non:\n  push:\n    branches: [main, develop]\n  pull_request:\n\njobs:\n  consumer-tests:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v4\n      - uses: actions\u002Fsetup-node@v4\n        with:\n          node-version: 20\n      - run: npm ci\n      - run: npm run test:contract:consumer\n      - name: Publish pacts\n        if: github.ref == 'refs\u002Fheads\u002Fmain' || github.event_name == 'pull_request'\n        run: npx ts-node scripts\u002Fpublish-pacts.ts\n        env:\n          PACT_BROKER_BASE_URL: ${{ secrets.PACT_BROKER_BASE_URL }}\n          PACT_BROKER_TOKEN: ${{ secrets.PACT_BROKER_TOKEN }}\n\n  provider-verification:\n    runs-on: ubuntu-latest\n    needs: consumer-tests\n    steps:\n      - uses: actions\u002Fcheckout@v4\n      - uses: actions\u002Fsetup-node@v4\n        with:\n          node-version: 20\n      - run: npm ci\n      - run: npm run test:contract:provider\n        env:\n          PACT_BROKER_BASE_URL: ${{ secrets.PACT_BROKER_BASE_URL }}\n          PACT_BROKER_TOKEN: ${{ secrets.PACT_BROKER_TOKEN }}\n          GIT_COMMIT_SHA: ${{ github.sha }}\n          GIT_BRANCH: ${{ github.ref_name }}\n\n  can-i-deploy:\n    runs-on: ubuntu-latest\n    needs: [consumer-tests, provider-verification]\n    if: github.ref == 'refs\u002Fheads\u002Fmain'\n    steps:\n      - uses: actions\u002Fcheckout@v4\n      - run: |\n          docker run --rm \\\n            pactfoundation\u002Fpact-cli:latest \\\n            pact-broker can-i-deploy \\\n            --pacticipant frontend-app \\\n            --version ${{ github.sha }} \\\n            --to-environment production \\\n            --broker-base-url ${{ secrets.PACT_BROKER_BASE_URL }} \\\n            --broker-token ${{ secrets.PACT_BROKER_TOKEN }}\n```\n\n## Webhook-Triggered Verification\n\nConfigure Pact Broker webhooks to trigger provider verification whenever a consumer publishes a new pact.\n\n```typescript\n\u002F\u002F scripts\u002Fsetup-webhooks.ts\nimport axios from 'axios';\n\nconst BROKER_URL = process.env.PACT_BROKER_BASE_URL;\nconst BROKER_TOKEN = process.env.PACT_BROKER_TOKEN;\n\nasync function createWebhook() {\n  await axios.post(\n    `${BROKER_URL}\u002Fwebhooks`,\n    {\n      description: 'Trigger provider verification on new pact',\n      events: [\n        { name: 'contract_content_changed' },\n        { name: 'contract_requiring_verification_published' },\n      ],\n      request: {\n        method: 'POST',\n        url: 'https:\u002F\u002Fapi.github.com\u002Frepos\u002FOWNER\u002FREPO\u002Fdispatches',\n        headers: {\n          'Content-Type': 'application\u002Fjson',\n          Accept: 'application\u002Fvnd.github.v3+json',\n          Authorization: 'Bearer ${user.githubToken}',\n        },\n        body: {\n          event_type: 'pact_changed',\n          client_payload: {\n            pact_url: '${pactbroker.pactUrl}',\n            consumer: '${pactbroker.consumerName}',\n            provider: '${pactbroker.providerName}',\n            consumer_version: '${pactbroker.consumerVersionNumber}',\n          },\n        },\n      },\n    },\n    {\n      headers: {\n        Authorization: `Bearer ${BROKER_TOKEN}`,\n        'Content-Type': 'application\u002Fjson',\n      },\n    }\n  );\n}\n```\n\n## Pending Pacts and WIP Pacts\n\nPending pacts prevent new consumers from breaking existing provider builds. WIP (Work in Progress) pacts allow verification of contracts from feature branches.\n\n```typescript\n\u002F\u002F provider\u002Fpact-config.ts\nexport const providerVerificationConfig = {\n  \u002F\u002F Pending pacts: new contracts won't fail the provider build\n  \u002F\u002F Once a pact is successfully verified, it transitions out of pending\n  enablePending: true,\n\n  \u002F\u002F WIP pacts: include pacts from consumer feature branches\n  \u002F\u002F Only pacts published after this date are considered\n  includeWipPactsSince: '2024-01-01',\n\n  \u002F\u002F Consumer version selectors determine which pacts to verify\n  consumerVersionSelectors: [\n    { mainBranch: true },                    \u002F\u002F Pacts from consumers' main branch\n    { deployedOrReleased: true },            \u002F\u002F Pacts from currently deployed consumers\n    { matchingBranch: true },                \u002F\u002F Pacts from same-named feature branch\n    { branch: 'develop' },                   \u002F\u002F Always verify develop branch pacts\n  ],\n};\n```\n\n## Bi-Directional Contract Testing\n\nBi-directional contract testing allows providers to publish their own OpenAPI specification rather than running consumer pact tests directly. The Pact Broker compares the consumer pact with the provider specification.\n\n```typescript\n\u002F\u002F provider\u002Fscripts\u002Fpublish-provider-contract.ts\nimport { execSync } from 'child_process';\n\nconst gitSha = execSync('git rev-parse HEAD').toString().trim();\nconst branch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim();\n\n\u002F\u002F Publish the provider's OpenAPI spec as its contract\nexecSync(`\n  pactflow publish-provider-contract \\\n    .\u002Fopenapi\u002Fuser-service.yaml \\\n    --provider user-service \\\n    --provider-app-version ${gitSha} \\\n    --branch ${branch} \\\n    --content-type application\u002Fyaml \\\n    --verification-exit-code 0 \\\n    --verification-results .\u002Ftest-results\u002Fprovider-tests.json \\\n    --verification-results-content-type application\u002Fjson \\\n    --verifier pactflow-self-verification \\\n    --broker-base-url ${process.env.PACT_BROKER_BASE_URL} \\\n    --broker-token ${process.env.PACT_BROKER_TOKEN}\n`);\n```\n\n## GraphQL Contract Testing\n\n```typescript\n\u002F\u002F consumer\u002Ftests\u002Fcontract\u002Fgraphql.consumer.pact.ts\nimport { PactV4, MatchersV3 } from '@pact-foundation\u002Fpact';\nconst { like, eachLike, string, integer } = MatchersV3;\n\nconst provider = new PactV4({\n  consumer: 'graphql-client',\n  provider: 'graphql-gateway',\n});\n\ndescribe('GraphQL Contract', () => {\n  it('fetches user with orders via GraphQL', async () => {\n    await provider\n      .addInteraction()\n      .given('user 42 has orders')\n      .uponReceiving('a GraphQL query for user with orders')\n      .withRequest('POST', '\u002Fgraphql', (builder) => {\n        builder.headers({ 'Content-Type': 'application\u002Fjson' });\n        builder.jsonBody({\n          query: string(`\n            query GetUser($id: ID!) {\n              user(id: $id) {\n                id\n                name\n                orders {\n                  id\n                  total\n                  status\n                }\n              }\n            }\n          `),\n          variables: like({ id: '42' }),\n        });\n      })\n      .willRespondWith(200, (builder) => {\n        builder.jsonBody({\n          data: {\n            user: {\n              id: string('42'),\n              name: string('Jane Doe'),\n              orders: eachLike({\n                id: string('order-1'),\n                total: like(99.99),\n                status: string('SHIPPED'),\n              }),\n            },\n          },\n        });\n      })\n      .executeTest(async (mockServer) => {\n        const client = new GraphQLClient(mockServer.url + '\u002Fgraphql');\n        const result = await client.query(GET_USER_WITH_ORDERS, { id: '42' });\n        expect(result.data.user.orders.length).toBeGreaterThan(0);\n      });\n  });\n});\n```\n\n## Message-Based Contract Testing\n\nFor asynchronous event-driven systems, message pact testing validates the structure of messages published to queues or topics.\n\n```typescript\n\u002F\u002F consumer\u002Ftests\u002Fcontract\u002Forder-events.consumer.pact.ts\nimport { PactV4, MatchersV3 } from '@pact-foundation\u002Fpact';\nconst { like, string, integer, timestamp, regex } = MatchersV3;\n\nconst provider = new PactV4({\n  consumer: 'notification-service',\n  provider: 'order-service',\n});\n\ndescribe('Order Event Contract', () => {\n  it('handles order.completed events', async () => {\n    await provider\n      .addInteraction()\n      .given('an order has been completed')\n      .expectsToReceive('an order.completed event')\n      .withContentV4((builder) => {\n        builder.jsonBody({\n          eventType: string('order.completed'),\n          timestamp: timestamp(\"yyyy-MM-dd'T'HH:mm:ss.SSSX\", '2024-06-01T12:00:00.000Z'),\n          payload: {\n            orderId: string('ord-12345'),\n            customerId: integer(42),\n            total: like(149.99),\n            currency: regex(\u002F^[A-Z]{3}$\u002F, 'USD'),\n            items: [\n              {\n                productId: string('prod-001'),\n                quantity: integer(2),\n                price: like(74.99),\n              },\n            ],\n            shippingAddress: {\n              street: string('123 Main St'),\n              city: string('Portland'),\n              state: regex(\u002F^[A-Z]{2}$\u002F, 'OR'),\n              zip: regex(\u002F^\\d{5}(-\\d{4})?$\u002F, '97201'),\n            },\n          },\n        });\n      })\n      .executeTest(async (message) => {\n        const handler = new OrderCompletedHandler();\n        const result = await handler.handle(JSON.parse(message.contents.toString()));\n\n        expect(result.notificationSent).toBe(true);\n        expect(result.recipientId).toBe(42);\n      });\n  });\n});\n\n\u002F\u002F provider\u002Ftests\u002Fcontract\u002Fmessage-provider-verification.ts\nimport { MessageProviderPact } from '@pact-foundation\u002Fpact';\n\ndescribe('Message Provider Verification', () => {\n  it('verifies order event messages', async () => {\n    const messageProvider = new MessageProviderPact({\n      provider: 'order-service',\n      pactBrokerUrl: process.env.PACT_BROKER_BASE_URL,\n      pactBrokerToken: process.env.PACT_BROKER_TOKEN,\n      publishVerificationResult: process.env.CI === 'true',\n      providerVersion: process.env.GIT_COMMIT_SHA,\n\n      messageProviders: {\n        'an order.completed event': async () => {\n          \u002F\u002F Return the actual message your service would produce\n          return {\n            eventType: 'order.completed',\n            timestamp: new Date().toISOString(),\n            payload: {\n              orderId: 'ord-12345',\n              customerId: 42,\n              total: 149.99,\n              currency: 'USD',\n              items: [{ productId: 'prod-001', quantity: 2, price: 74.99 }],\n              shippingAddress: {\n                street: '123 Main St',\n                city: 'Portland',\n                state: 'OR',\n                zip: '97201',\n              },\n            },\n          };\n        },\n      },\n\n      stateHandlers: {\n        'an order has been completed': async () => {\n          \u002F\u002F Set up state as needed\n        },\n      },\n    });\n\n    await messageProvider.verify();\n  });\n});\n```\n\n## Configuration\n\n### Consumer Pact Configuration\n\n```typescript\n\u002F\u002F consumer\u002Fpact-config.ts\nimport { LogLevel } from '@pact-foundation\u002Fpact';\nimport { resolve } from 'path';\n\nexport const pactConfig = {\n  \u002F\u002F Pact file output directory\n  dir: resolve(__dirname, 'pacts'),\n\n  \u002F\u002F Logging level: trace, debug, info, warn, error\n  logLevel: (process.env.PACT_LOG_LEVEL as LogLevel) || 'warn',\n\n  \u002F\u002F Pact specification version\n  spec: 4,\n\n  \u002F\u002F Timeout for pact mock server (milliseconds)\n  timeout: 30000,\n};\n```\n\n### Provider Verification Configuration\n\n```typescript\n\u002F\u002F provider\u002Fpact-config.ts\nexport const providerConfig = {\n  providerBaseUrl: process.env.PROVIDER_BASE_URL || 'http:\u002F\u002Flocalhost:3000',\n  provider: 'user-service',\n\n  pactBrokerUrl: process.env.PACT_BROKER_BASE_URL,\n  pactBrokerToken: process.env.PACT_BROKER_TOKEN,\n\n  publishVerificationResult: process.env.CI === 'true',\n  providerVersion: process.env.GIT_COMMIT_SHA || 'local',\n  providerVersionBranch: process.env.GIT_BRANCH || 'local',\n\n  enablePending: true,\n  includeWipPactsSince: '2024-01-01',\n\n  consumerVersionSelectors: [\n    { mainBranch: true },\n    { deployedOrReleased: true },\n    { matchingBranch: true },\n  ],\n\n  \u002F\u002F Timeout for provider state setup (milliseconds)\n  stateHandlerTimeout: 10000,\n\n  \u002F\u002F Request timeout for each interaction verification\n  requestTimeout: 15000,\n};\n```\n\n### Package.json Scripts\n\n```json\n{\n  \"scripts\": {\n    \"test:contract:consumer\": \"jest --testPathPattern=consumer.pact\",\n    \"test:contract:provider\": \"jest --testPathPattern=provider-verification\",\n    \"pact:publish\": \"ts-node scripts\u002Fpublish-pacts.ts\",\n    \"pact:can-i-deploy\": \"bash ci\u002Fcan-i-deploy.sh\",\n    \"pact:broker\": \"docker compose -f pact-broker\u002Fdocker-compose.yml up -d\"\n  }\n}\n```\n\n## Best Practices\n\n1. **Use Pact matchers instead of exact values.** Matchers like `like()`, `regex()`, and `eachLike()` validate structure and type rather than specific values, making contracts resilient to data changes.\n\n2. **Keep provider states minimal and descriptive.** Each `given()` state should describe a precondition clearly (e.g., \"a user with ID 42 exists\") and the state handler should set up only what is needed.\n\n3. **Version pacts with git commit SHA.** Using the git commit SHA as the consumer version ensures traceability and enables the can-i-deploy tool to accurately determine deployment safety.\n\n4. **Enable pending pacts in provider verification.** This prevents new consumers or new interactions from immediately breaking the provider build while still tracking verification status.\n\n5. **Run can-i-deploy before every deployment.** This is the single most important practice for preventing integration breakages; it should gate every production deployment.\n\n6. **Test only what the consumer uses.** If the consumer only reads the `id` and `name` fields from a 20-field response, the contract should only assert on those two fields.\n\n7. **Use consumer version selectors wisely.** Always verify pacts from `mainBranch` and `deployedOrReleased`; add `matchingBranch` for feature branch coordination between teams.\n\n8. **Publish verification results from CI only.** Set `publishVerificationResult: true` only when running in CI to avoid polluting the broker with local verification results.\n\n9. **Implement proper state handlers.** Provider state handlers should seed the database or configure mocks to satisfy each consumer expectation reproducibly.\n\n10. **Tag environments with record-deployment.** After successful deployment, record the deployment in the broker so can-i-deploy knows which versions are in which environments.\n\n11. **Include request headers in contracts when they affect behavior.** If the provider returns different responses based on Accept headers or API versions, include those in the contract.\n\n12. **Use separate CI jobs for consumer and provider.** Consumer tests and provider verification should run independently, connected only through the Pact Broker.\n\n## Anti-Patterns to Avoid\n\n1. **Asserting on entire response bodies.** Never match every field in a provider response. This creates brittle contracts that break when the provider adds a new field, which should be a non-breaking change.\n\n2. **Using exact matchers for dynamic data.** Dates, IDs, and timestamps should use type matchers or regex matchers, not exact values. Using `like(42)` is correct; using the literal `42` is fragile.\n\n3. **Sharing a single provider state across unrelated tests.** Each test should declare its own provider state. Reusing states like \"default state\" leads to hidden coupling and test fragility.\n\n4. **Running provider verification against a shared staging environment.** Provider verification must run against a locally started provider instance to ensure reproducibility and speed.\n\n5. **Skipping can-i-deploy because it is slow.** If can-i-deploy is too slow, configure retry parameters rather than bypassing it. The `--retry-while-unknown` flag handles asynchronous verification gracefully.\n\n6. **Coupling consumer and provider test suites.** Consumer and provider tests must live in their respective repositories. The pact file (or broker) is the only connection between them.\n\n7. **Using contract tests as functional tests.** Contract tests verify the shape and structure of interactions, not business logic. Do not test complex business scenarios through contracts.\n\n## Debugging Tips\n\n1. **Enable verbose logging.** Set `logLevel: 'debug'` in the Pact configuration or use the environment variable `PACT_LOG_LEVEL=debug` to see detailed request\u002Fresponse matching output.\n\n2. **Inspect generated pact files.** The JSON pact files in the output directory contain the exact interactions defined. Reviewing these files helps identify matcher misconfigurations before publishing.\n\n3. **Use the Pact Broker UI.** The broker provides a visual matrix showing which consumer versions are verified against which provider versions. This is invaluable for diagnosing can-i-deploy failures.\n\n4. **Check provider state handler execution.** If verification fails with unexpected data, add logging to state handlers to confirm they execute and set up data correctly.\n\n5. **Verify the mock server URL.** A common failure is the consumer test using a hardcoded URL instead of `mockServer.url`. Always construct the API client with the dynamic mock server URL.\n\n6. **Compare pact specification versions.** If consumer and provider use different Pact specification versions (v2 vs v3 vs v4), certain matchers may not be supported. Align on the same specification version.\n\n7. **Check for port conflicts.** When running multiple Pact tests in parallel, ensure each test uses a unique port or let Pact assign random ports automatically.\n\n8. **Validate webhook configuration.** If provider verification does not trigger after pact publication, check the broker webhook configuration and review the webhook execution logs in the broker UI.\n\n9. **Review the verification output diff.** When provider verification fails, the output shows an expected vs actual diff. Focus on the specific field or header that mismatched rather than the entire interaction.\n\n10. **Test state handlers in isolation.** Before running full verification, run state handler functions independently to confirm they produce the expected database state or mock configuration.\n",{"name":5,"tags":24,"agents":32,"author":45,"domains":46,"license":15,"version":48,"languages":49,"frameworks":53,"description":7,"testingTypes":54},[25,26,27,28,29,30,31],"contract-testing","pact","consumer-driven","provider-verification","api-compatibility","pact-broker","integration-testing",[33,34,35,36,37,38,39,40,41,42,43,44],"claude-code","cursor","github-copilot","windsurf","codex","aider","continue","cline","zed","bolt","gemini-cli","amp","Pramod",[47],"api","1.0.0",[50,51,52],"typescript","javascript","java",[26],[55,47],"contract","main","eac438ea9216a7cb8a570cab803eb01eeafc6793","skills\u002Fqa\u002Fcontract-test-generator","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m","https:\u002F\u002Fid-preview--d5bef06d-6c9e-4563-a3d4-a855b9d61610.lovable.app\u002F","Eu sou Antonio B. B. Ndombe \r\nEu sou um Pesquisador e desenvolvedor de sistema autonomia cognitivos, fundador de sistemas ODCs ( organismos digital conscientes)","2026-11-04 06:53:39",{"source":8,"skillName":5,"commands":65,"prompt":75,"zipAvailable":76},[66,69,72],{"tool":67,"command":68},"npx","npx skills add GrupoANDevelopment-m\u002Falberto-ai --skill \"Contract Test Generator\"",{"tool":70,"command":71},"bunx","bunx skills add GrupoANDevelopment-m\u002Falberto-ai --skill \"Contract Test Generator\"",{"tool":73,"command":74},"pnpm","pnpm dlx skills add GrupoANDevelopment-m\u002Falberto-ai --skill \"Contract Test Generator\"","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fskills\u002Fqa\u002Fcontract-test-generator\u002FSKILL.md",true,[],[79,87,94,101,108,115],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":83,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M7DASC6FSCJP49JZBSK0NY1Z","nemoclaw-user-reference","Describes the NemoClaw integration layer and blueprint architecture and how they orchestrate compatible agent sandboxes. Use when looking up architecture, agent integration, plugin structure, or blueprint design. Trigger keywords - nemoclaw architecture, nemoclaw agent architecture, nemoclaw plugin blueprint structure, nemoclaw vs openshell, which cli, nemoclaw cli, openshell cli, sandbox commands, nemoclaw cli commands, nemoclaw command reference, nemoclaw network policy, sandbox egress control operator approval, nemoclaw troubleshooting, nemoclaw debug sandbox issues.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-reference\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":83,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":19},"01M7DAS5S79VK33XFGVAM2TFWF","nemoclaw-user-overview","Explains how OpenClaw, OpenShell, and NemoClaw form the ecosystem, NemoClaw's position in the stack, what NemoClaw adds beyond the community sandbox, and when to prefer NemoClaw versus integrating OpenShell and OpenClaw directly. Use when users ask about the relationship between OpenClaw, OpenShell, and NemoClaw, or when to use NemoClaw versus OpenShell. Trigger keywords - nemoclaw ecosystem, openclaw openshell, nemoclaw vs openshell, sandboxed openclaw, how nemoclaw works, nemoclaw sandbox lifecycle blueprint, nemoclaw overview, openclaw always-on assistants, nvidia openshell, nvidia nemotron, nemoclaw release notes, nemoclaw changelog.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-overview\u002FSKILL.md",[],[],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":83,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":19},"01M7DAS0PQEMET5MNGZ1ABSZVS","nemoclaw-user-monitor-sandbox","Inspects sandbox health, traces agent behavior, and diagnoses problems. Use when monitoring a running sandbox, debugging agent issues, or checking sandbox logs. Trigger keywords - monitor nemoclaw sandbox, debug nemoclaw agent issues.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-monitor-sandbox\u002FSKILL.md",[],[],{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":83,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":19},"01M7DARQYGF7E9A69VH6S3CGN9","nemoclaw-user-manage-sandboxes","Explains operational tasks after the quickstart: listing sandboxes, status and health checks, logs, diagnostics, port forwards, multiple sandboxes, credential reset, rebuilds, network presets, upgrades, and uninstall. Trigger keywords - manage nemoclaw sandboxes, nemoclaw status, nemoclaw list, nemoclaw dashboard port, nemoclaw rebuild, nemoclaw upgrade sandboxes, nemoclaw uninstall, sandbox mutability, sandbox runtime configuration, sandbox rebuild, nemoclaw backup, nemoclaw restore, workspace backup, openshell sandbox download upload, nemoclaw messaging channels, nemoclaw telegram, nemoclaw discord, nemoclaw slack, nemoclaw wechat, nemoclaw whatsapp, openshell channel messaging, nemoclaw workspace files, soul.md, user.md, identity.md, agents.md, sandbox persistence.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-manage-sandboxes\u002FSKILL.md",[],[],{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":83,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":19},"01M7DARH8BRTG51TRCAB7YWDJ4","nemoclaw-user-manage-policy","Adds, removes, or modifies allowed endpoints in the sandbox policy. Use when customizing network policy, changing egress rules, or configuring sandbox endpoint access. Trigger keywords - customize nemoclaw network policy, sandbox egress policy configuration, nemoclaw integration policy examples, post-install policy setup, openshell approval workflow, policy preset, nemoclaw approve network requests, sandbox egress approval tui.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-manage-policy\u002FSKILL.md",[],[],{"skillNo":116,"name":117,"nameZh":6,"description":118,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":83,"licenseFileUrl":6,"sourceHtmlUrl":119,"categories":120,"keywords":121,"publishedAt":19},"01M7DARAT62M2VR37590VCZ5NS","nemoclaw-user-get-started","Installs NemoClaw, launches a sandbox, and runs the first agent prompt. Use when onboarding, installing, or launching a NemoClaw sandbox for the first time. Trigger keywords - nemoclaw quickstart, install nemoclaw openclaw sandbox, nemohermes quickstart, hermes agent nemoclaw, run hermes openshell sandbox, nemoclaw prerequisites, nemoclaw supported platforms, nemoclaw hardware software, nemoclaw windows wsl2 setup, nemoclaw install windows docker desktop.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-get-started\u002FSKILL.md",[],[]]