[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M799DFE70MKDHBNGEER9920F":3,"skill-same:01M799DFE70MKDHBNGEER9920F":44},{"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":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M799DFE70MKDHBNGEER9920F","API Contract Testing",null,"Comprehensive API contract testing patterns using OpenAPI\u002FSwagger validation, Pact consumer-driven contracts, JSON Schema, and breaking change detection. Use when building APIs, implementing contract-first development, validating API changes, or setting up consumer-driven contract testing between services.","pjherron\u002Fhypoc","pjherron","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F800763?v=4","01M799C7XC0XKKW2D6RMYNHCY8","Patrick Herron","01M799C7XZPGZ9QZ7XAQN5MQAN",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fpjherron\u002Fhypoc\u002Fblob\u002Fmain\u002Fhypoc\u002Fskills\u002Fapi-contract-testing\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: \"API Contract Testing\"\ndescription: \"Comprehensive API contract testing patterns using OpenAPI\u002FSwagger validation, Pact consumer-driven contracts, JSON Schema, and breaking change detection. Use when building APIs, implementing contract-first development, validating API changes, or setting up consumer-driven contract testing between services.\"\n---\n\n# API Contract Testing\n\n## What This Skill Does\n\nImplements comprehensive API contract testing strategies to ensure API compatibility, catch breaking changes early, and enable safe independent service deployment through contract-first development and consumer-driven contract testing.\n\n## Prerequisites\n\n- Node.js 18+ or Python 3.9+\n- API specification (OpenAPI\u002FSwagger) or ability to generate one\n- Test framework (Jest, Vitest, pytest)\n- Basic understanding of REST APIs and JSON Schema\n\n## Quick Start\n\n### Node.js with OpenAPI Validation\n\n```bash\nnpm install --save-dev @apidevtools\u002Fswagger-parser ajv\n\n# Validate OpenAPI spec\nnpx swagger-cli validate openapi.yaml\n\n# Run contract tests\nnpm test -- contract.test.ts\n```\n\n### Python with Schemathesis\n\n```bash\npip install schemathesis pytest\n\n# Generate and run contract tests from OpenAPI spec\nschemathesis run https:\u002F\u002Fapi.example.com\u002Fopenapi.json --checks all\n```\n\n---\n\n## Core Concepts\n\n### Contract Testing vs Integration Testing\n\n| Aspect | Integration Testing | Contract Testing |\n|--------|-------------------|-----------------|\n| **Scope** | Full service-to-service communication | API interface contracts only |\n| **Dependencies** | Requires all services running | Uses mock providers |\n| **Speed** | Slower (network, databases) | Fast (in-memory mocks) |\n| **Brittleness** | Breaks when any service changes | Breaks only on contract violations |\n| **When** | Post-deployment verification | Pre-deployment validation |\n| **Purpose** | Validate end-to-end behavior | Validate interface compatibility |\n\n**Use contract testing for:**\n- Catching breaking API changes before deployment\n- Enabling independent service deployment\n- Fast feedback in CI\u002FCD pipelines\n- Consumer-provider compatibility validation\n\n**Use integration testing for:**\n- Validating business logic across services\n- Testing error scenarios and edge cases\n- Verifying database transactions\n- End-to-end workflow validation\n\n---\n\n## OpenAPI\u002FSwagger Contract Validation\n\n### Contract-First Development Workflow\n\n```\n1. Design API contract (OpenAPI spec)\n2. Generate server stubs and client SDKs\n3. Implement endpoints to satisfy contract\n4. Run contract tests to validate compliance\n5. Deploy with confidence\n```\n\n### Validating Responses Against OpenAPI Spec\n\n#### Node.js with OpenAPI Backend Validator\n\n```typescript\nimport { OpenAPIBackend } from 'openapi-backend'\nimport { test, expect } from '@jest\u002Fglobals'\n\nconst api = new OpenAPIBackend({\n  definition: '.\u002Fopenapi.yaml',\n  strict: true,\n  validate: true\n})\n\nawait api.init()\n\ntest('GET \u002Fusers returns valid response', async () => {\n  const response = await fetch('http:\u002F\u002Flocalhost:3000\u002Fapi\u002Fusers')\n  const data = await response.json()\n\n  \u002F\u002F Validate response against OpenAPI spec\n  const validation = api.validateResponse(data, {\n    operation: {\n      operationId: 'listUsers',\n      method: 'get',\n      path: '\u002Fusers'\n    },\n    status: response.status\n  })\n\n  expect(validation.errors).toBeUndefined()\n})\n\ntest('POST \u002Fusers validates request body', async () => {\n  const invalidUser = { email: 'not-an-email' } \u002F\u002F Missing required fields\n\n  const validation = api.validateRequest({\n    method: 'post',\n    path: '\u002Fusers',\n    body: invalidUser\n  })\n\n  expect(validation.errors).toBeDefined()\n  expect(validation.errors).toContainEqual(\n    expect.objectContaining({\n      path: '.name',\n      message: expect.stringContaining('required')\n    })\n  )\n})\n```\n\n#### Python with Schemathesis\n\n```python\nimport schemathesis\n\nschema = schemathesis.from_path(\"openapi.yaml\")\n\n@schema.parametrize()\ndef test_api_contract(case):\n    \"\"\"\n    Automatically generates tests for all endpoints.\n    Validates:\n    - Request parameters match schema\n    - Response status codes are documented\n    - Response bodies match schema\n    - No undocumented errors\n    \"\"\"\n    case.call_and_validate()\n\n# Run specific checks\n@schema.parametrize()\n@schemathesis.check\ndef test_response_time(response, case):\n    \"\"\"Custom check: response time under 500ms\"\"\"\n    assert response.elapsed.total_seconds() \u003C 0.5\n\n@schema.parametrize()\n@schemathesis.check\ndef test_content_type(response, case):\n    \"\"\"Custom check: correct content type\"\"\"\n    assert response.headers.get(\"Content-Type\") == \"application\u002Fjson\"\n```\n\n### Breaking Change Detection\n\n```typescript\nimport SwaggerParser from '@apidevtools\u002Fswagger-parser'\nimport { diff } from 'openapi-diff'\n\nasync function detectBreakingChanges(\n  oldSpec: string,\n  newSpec: string\n): Promise\u003CBreakingChange[]> {\n  const result = await diff(oldSpec, newSpec)\n\n  const breakingChanges: BreakingChange[] = []\n\n  \u002F\u002F Breaking: Removed endpoint\n  if (result.breakingDifferencesFound) {\n    result.breakingDifferences.forEach(change => {\n      if (change.type === 'remove' && change.action === 'delete') {\n        breakingChanges.push({\n          type: 'REMOVED_ENDPOINT',\n          path: change.path,\n          method: change.method,\n          severity: 'CRITICAL'\n        })\n      }\n\n      \u002F\u002F Breaking: Removed required field\n      if (change.type === 'remove' && change.property === 'required') {\n        breakingChanges.push({\n          type: 'REMOVED_REQUIRED_FIELD',\n          path: change.path,\n          field: change.field,\n          severity: 'HIGH'\n        })\n      }\n\n      \u002F\u002F Breaking: Changed response type\n      if (change.type === 'edit' && change.property === 'type') {\n        breakingChanges.push({\n          type: 'CHANGED_RESPONSE_TYPE',\n          path: change.path,\n          from: change.oldValue,\n          to: change.newValue,\n          severity: 'HIGH'\n        })\n      }\n    })\n  }\n\n  return breakingChanges\n}\n\n\u002F\u002F CI\u002FCD integration\ntest('API has no breaking changes', async () => {\n  const changes = await detectBreakingChanges(\n    'specs\u002Fv1.0.0.yaml',\n    'specs\u002Fv1.1.0.yaml'\n  )\n\n  const criticalChanges = changes.filter(c => c.severity === 'CRITICAL')\n\n  expect(criticalChanges).toHaveLength(0)\n})\n```\n\n---\n\n## Pact Consumer-Driven Contract Testing\n\n### Consumer-Provider Model\n\n```\nConsumer (Frontend\u002FService A)\n  ↓ defines expected interactions\nPact Contract (JSON)\n  ↓ shared with provider\nProvider (Backend\u002FService B)\n  ↓ verifies can satisfy contract\n```\n\n### Consumer Side (Node.js)\n\n```typescript\nimport { PactV3, MatchersV3 } from '@pact-foundation\u002Fpact'\nimport { UserService } from '.\u002FUserService'\n\nconst { like, eachLike } = MatchersV3\n\nconst provider = new PactV3({\n  consumer: 'UserFrontend',\n  provider: 'UserAPI',\n  dir: '.\u002Fpacts'\n})\n\ndescribe('User API Contract', () => {\n  test('get user by id', async () => {\n    await provider\n      .given('user with id 123 exists')\n      .uponReceiving('a request for user 123')\n      .withRequest({\n        method: 'GET',\n        path: '\u002Fusers\u002F123',\n        headers: { Accept: 'application\u002Fjson' }\n      })\n      .willRespondWith({\n        status: 200,\n        headers: { 'Content-Type': 'application\u002Fjson' },\n        body: like({\n          id: '123',\n          email: 'alice@example.com',\n          name: 'Alice',\n          created_at: '2025-01-01T00:00:00Z'\n        })\n      })\n\n    await provider.executeTest(async (mockServer) => {\n      const api = new UserService(mockServer.url)\n      const user = await api.getUser('123')\n\n      expect(user.id).toBe('123')\n      expect(user.email).toBe('alice@example.com')\n    })\n  })\n\n  test('list users with pagination', async () => {\n    await provider\n      .given('multiple users exist')\n      .uponReceiving('a request for users list')\n      .withRequest({\n        method: 'GET',\n        path: '\u002Fusers',\n        query: { page: '1', limit: '10' }\n      })\n      .willRespondWith({\n        status: 200,\n        body: {\n          data: eachLike({\n            id: like('abc-123'),\n            email: like('user@example.com'),\n            name: like('User Name')\n          }),\n          meta: like({\n            total: 42,\n            page: 1,\n            limit: 10\n          })\n        }\n      })\n\n    await provider.executeTest(async (mockServer) => {\n      const api = new UserService(mockServer.url)\n      const result = await api.listUsers({ page: 1, limit: 10 })\n\n      expect(result.data).toBeInstanceOf(Array)\n      expect(result.meta.total).toBeGreaterThan(0)\n    })\n  })\n})\n```\n\n### Provider Side (Verification)\n\n```typescript\nimport { Verifier } from '@pact-foundation\u002Fpact'\nimport { startServer } from '.\u002Fserver'\n\ndescribe('Pact Verification', () => {\n  let server: any\n\n  beforeAll(async () => {\n    server = await startServer(3001)\n  })\n\n  afterAll(async () => {\n    await server.close()\n  })\n\n  test('validates pacts from consumers', async () => {\n    const verifier = new Verifier({\n      provider: 'UserAPI',\n      providerBaseUrl: 'http:\u002F\u002Flocalhost:3001',\n      pactUrls: ['.\u002Fpacts\u002FUserFrontend-UserAPI.json'],\n      stateHandlers: {\n        'user with id 123 exists': async () => {\n          \u002F\u002F Set up test data\n          await db.users.create({\n            id: '123',\n            email: 'alice@example.com',\n            name: 'Alice'\n          })\n        },\n        'multiple users exist': async () => {\n          await db.users.createMany([\n            { id: '1', email: 'user1@example.com', name: 'User 1' },\n            { id: '2', email: 'user2@example.com', name: 'User 2' }\n          ])\n        }\n      }\n    })\n\n    await verifier.verifyProvider()\n  })\n})\n```\n\n### Python with Pact\n\n```python\nimport pytest\nfrom pact import Consumer, Provider, Like, EachLike\n\npact = Consumer('UserFrontend').has_pact_with(Provider('UserAPI'))\n\ndef test_get_user():\n    expected = {\n        'id': '123',\n        'email': 'alice@example.com',\n        'name': 'Alice'\n    }\n\n    (pact\n     .given('user with id 123 exists')\n     .upon_receiving('a request for user 123')\n     .with_request('GET', '\u002Fusers\u002F123')\n     .will_respond_with(200, body=Like(expected)))\n\n    with pact:\n        user = UserService(pact.uri).get_user('123')\n        assert user['id'] == '123'\n        assert user['email'] == 'alice@example.com'\n```\n\n---\n\n## JSON Schema Validation\n\n### Schema Definition\n\n```json\n{\n  \"$schema\": \"http:\u002F\u002Fjson-schema.org\u002Fdraft-07\u002Fschema#\",\n  \"title\": \"User\",\n  \"type\": \"object\",\n  \"required\": [\"id\", \"email\", \"name\"],\n  \"properties\": {\n    \"id\": {\n      \"type\": \"string\",\n      \"pattern\": \"^[a-z0-9-]+$\"\n    },\n    \"email\": {\n      \"type\": \"string\",\n      \"format\": \"email\"\n    },\n    \"name\": {\n      \"type\": \"string\",\n      \"minLength\": 1,\n      \"maxLength\": 100\n    },\n    \"age\": {\n      \"type\": \"integer\",\n      \"minimum\": 0,\n      \"maximum\": 150\n    },\n    \"created_at\": {\n      \"type\": \"string\",\n      \"format\": \"date-time\"\n    }\n  },\n  \"additionalProperties\": false\n}\n```\n\n### Runtime Validation (Node.js)\n\n```typescript\nimport Ajv from 'ajv'\nimport addFormats from 'ajv-formats'\n\nconst ajv = new Ajv({ allErrors: true })\naddFormats(ajv)\n\nconst userSchema = require('.\u002Fschemas\u002Fuser.json')\nconst validate = ajv.compile(userSchema)\n\nfunction validateUser(data: unknown): User {\n  if (!validate(data)) {\n    const errors = validate.errors!.map(err => ({\n      field: err.instancePath.replace('\u002F', ''),\n      message: err.message,\n      params: err.params\n    }))\n\n    throw new ValidationError('Invalid user data', errors)\n  }\n\n  return data as User\n}\n\n\u002F\u002F Use in API endpoint\napp.post('\u002Fusers', async (req, res) => {\n  try {\n    const user = validateUser(req.body)\n    const created = await db.users.create(user)\n    return res.status(201).json(created)\n  } catch (error) {\n    if (error instanceof ValidationError) {\n      return res.status(400).json({ errors: error.details })\n    }\n    throw error\n  }\n})\n```\n\n### Test Response Against Schema\n\n```typescript\nimport { test, expect } from '@jest\u002Fglobals'\nimport Ajv from 'ajv'\n\nconst ajv = new Ajv()\nconst userSchema = require('.\u002Fschemas\u002Fuser.json')\n\ntest('GET \u002Fusers\u002F:id returns valid user schema', async () => {\n  const response = await fetch('http:\u002F\u002Flocalhost:3000\u002Fusers\u002F123')\n  const user = await response.json()\n\n  const validate = ajv.compile(userSchema)\n  const valid = validate(user)\n\n  if (!valid) {\n    console.error('Schema validation errors:', validate.errors)\n  }\n\n  expect(valid).toBe(true)\n})\n```\n\n---\n\n## API Versioning Strategies\n\n### URL Path Versioning\n\n```\n\u002Fapi\u002Fv1\u002Fusers\n\u002Fapi\u002Fv2\u002Fusers\n\nPros: Explicit, easy to route, cacheable\nCons: URL changes between versions\nBest for: Public APIs, major breaking changes\n```\n\n### Header Versioning\n\n```\nGET \u002Fapi\u002Fusers\nAccept: application\u002Fvnd.myapp.v2+json\n\nPros: Clean URLs, content negotiation\nCons: Harder to test, easy to forget\nBest for: Internal APIs, gradual migration\n```\n\n### Contract Testing Across Versions\n\n```typescript\ndescribe('API Version Compatibility', () => {\n  test('v1 and v2 both satisfy their contracts', async () => {\n    \u002F\u002F Test v1 contract\n    const v1Response = await fetch('\u002Fapi\u002Fv1\u002Fusers\u002F123')\n    const v1Data = await v1Response.json()\n    expect(validateV1Contract(v1Data)).toBe(true)\n\n    \u002F\u002F Test v2 contract\n    const v2Response = await fetch('\u002Fapi\u002Fv2\u002Fusers\u002F123')\n    const v2Data = await v2Response.json()\n    expect(validateV2Contract(v2Data)).toBe(true)\n  })\n\n  test('v2 is backward compatible with v1 consumers', async () => {\n    \u002F\u002F V2 should support v1 Accept header\n    const response = await fetch('\u002Fapi\u002Fusers\u002F123', {\n      headers: { Accept: 'application\u002Fvnd.myapp.v1+json' }\n    })\n\n    expect(response.status).toBe(200)\n    expect(validateV1Contract(await response.json())).toBe(true)\n  })\n})\n```\n\n---\n\n## Mock Service Patterns\n\n### Mock Service Worker (MSW) for Browser\u002FNode\n\n```typescript\nimport { rest } from 'msw'\nimport { setupServer } from 'msw\u002Fnode'\n\nconst handlers = [\n  rest.get('\u002Fapi\u002Fusers\u002F:id', (req, res, ctx) => {\n    const { id } = req.params\n\n    return res(\n      ctx.status(200),\n      ctx.json({\n        id,\n        email: `user-${id}@example.com`,\n        name: `User ${id}`\n      })\n    )\n  }),\n\n  rest.post('\u002Fapi\u002Fusers', async (req, res, ctx) => {\n    const body = await req.json()\n\n    \u002F\u002F Validate against schema\n    if (!body.email || !body.name) {\n      return res(\n        ctx.status(400),\n        ctx.json({ error: 'Missing required fields' })\n      )\n    }\n\n    return res(\n      ctx.status(201),\n      ctx.json({ id: 'new-id', ...body })\n    )\n  })\n]\n\nconst server = setupServer(...handlers)\n\nbeforeAll(() => server.listen())\nafterEach(() => server.resetHandlers())\nafterAll(() => server.close())\n```\n\n### WireMock for JVM Services\n\n```json\n{\n  \"request\": {\n    \"method\": \"GET\",\n    \"urlPattern\": \"\u002Fapi\u002Fusers\u002F[a-z0-9-]+\"\n  },\n  \"response\": {\n    \"status\": 200,\n    \"headers\": {\n      \"Content-Type\": \"application\u002Fjson\"\n    },\n    \"jsonBody\": {\n      \"id\": \"{{request.pathSegments.[2]}}\",\n      \"email\": \"user@example.com\",\n      \"name\": \"Mock User\"\n    }\n  }\n}\n```\n\n---\n\n## Load Testing Patterns\n\n### k6 Contract-Aware Load Testing\n\n```javascript\nimport http from 'k6\u002Fhttp'\nimport { check } from 'k6'\nimport { Rate } from 'k6\u002Fmetrics'\n\nconst contractViolations = new Rate('contract_violations')\n\nexport const options = {\n  stages: [\n    { duration: '30s', target: 10 },\n    { duration: '1m', target: 50 },\n    { duration: '30s', target: 0 }\n  ],\n  thresholds: {\n    http_req_duration: ['p(95)\u003C500'],\n    contract_violations: ['rate\u003C0.01'] \u002F\u002F \u003C1% contract violations\n  }\n}\n\nexport default function () {\n  const response = http.get('http:\u002F\u002Flocalhost:3000\u002Fapi\u002Fusers')\n\n  const validContract = check(response, {\n    'status is 200': (r) => r.status === 200,\n    'has data array': (r) => JSON.parse(r.body).data !== undefined,\n    'has meta object': (r) => JSON.parse(r.body).meta !== undefined,\n    'response time \u003C 500ms': (r) => r.timings.duration \u003C 500\n  })\n\n  contractViolations.add(!validContract)\n}\n```\n\n---\n\n## CI\u002FCD Integration\n\n### GitHub Actions Workflow\n\n```yaml\nname: Contract Tests\n\non: [push, pull_request]\n\njobs:\n  contract-tests:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v4\n\n      - name: Setup Node.js\n        uses: actions\u002Fsetup-node@v4\n        with:\n          node-version: 20\n\n      - name: Install dependencies\n        run: npm ci\n\n      - name: Validate OpenAPI spec\n        run: npx swagger-cli validate openapi.yaml\n\n      - name: Run contract tests\n        run: npm run test:contract\n\n      - name: Check for breaking changes\n        run: npm run test:breaking-changes\n\n      - name: Publish Pact contracts\n        if: github.ref == 'refs\u002Fheads\u002Fmain'\n        env:\n          PACT_BROKER_URL: ${{ secrets.PACT_BROKER_URL }}\n          PACT_BROKER_TOKEN: ${{ secrets.PACT_BROKER_TOKEN }}\n        run: npm run pact:publish\n\n      - name: Can I Deploy?\n        run: npx pact-broker can-i-deploy \\\n          --pacticipant UserAPI \\\n          --version ${{ github.sha }} \\\n          --to production\n```\n\n---\n\n## Chaos Engineering Basics\n\n### Simulating Contract Violations\n\n```typescript\nimport { test } from '@jest\u002Fglobals'\n\ntest('handles malformed response gracefully', async () => {\n  \u002F\u002F Simulate provider returning unexpected data\n  mockServer.use(\n    rest.get('\u002Fapi\u002Fusers\u002F:id', (req, res, ctx) => {\n      return res(\n        ctx.status(200),\n        ctx.json({\n          \u002F\u002F Missing required fields\n          id: '123'\n          \u002F\u002F email and name missing\n        })\n      )\n    })\n  )\n\n  await expect(api.getUser('123')).rejects.toThrow('Invalid response schema')\n})\n\ntest('handles unexpected status codes', async () => {\n  mockServer.use(\n    rest.get('\u002Fapi\u002Fusers\u002F:id', (req, res, ctx) => {\n      return res(ctx.status(418)) \u002F\u002F I'm a teapot\n    })\n  )\n\n  await expect(api.getUser('123')).rejects.toThrow('Unexpected status: 418')\n})\n```\n\n---\n\n## Best Practices\n\n1. **Contract-First Development**\n   - Design OpenAPI spec before implementation\n   - Generate stubs and SDKs from spec\n   - Validate implementation against spec\n\n2. **Consumer-Driven Contracts**\n   - Consumers define expected interactions\n   - Providers verify they can satisfy contracts\n   - Enables independent deployment\n\n3. **Breaking Change Prevention**\n   - Run breaking change detection in CI\n   - Block PRs with breaking changes\n   - Version APIs appropriately\n\n4. **Mock in Tests, Real in Staging**\n   - Use mocks for fast feedback in CI\n   - Run full integration tests in staging\n   - Contract tests bridge the gap\n\n5. **Version Compatibility**\n   - Support N-1 version in production\n   - Deprecate old versions gracefully\n   - Communicate changes to consumers\n\n---\n\n## Troubleshooting\n\n### Issue: Contract Test Passes But Integration Fails\n\n**Cause**: Contract doesn't match real provider behavior\n**Solution**:\n- Verify provider state handlers set up data correctly\n- Check provider verification runs against real implementation\n- Ensure mock servers match production responses\n\n### Issue: Too Many False Positives\n\n**Cause**: Overly strict schema validation\n**Solution**:\n```typescript\n\u002F\u002F Use \"like\" matchers for flexible matching\nbody: like({\n  id: '123',\n  email: 'alice@example.com'\n  \u002F\u002F Other fields allowed but not required\n})\n```\n\n### Issue: Breaking Change Detection Too Noisy\n\n**Cause**: Detecting non-breaking changes as breaking\n**Solution**:\n- Configure breaking change rules\n- Allow additive changes (new optional fields)\n- Focus on removals and type changes\n\n---\n\n## Related Skills\n\n- `api-design` - REST API design patterns\n- `backend-patterns` - Service layer patterns\n- `e2e-testing` - End-to-end testing strategies\n- `tdd-workflow` - Test-driven development\n\n## Resources\n\n- [OpenAPI Specification](https:\u002F\u002Fswagger.io\u002Fspecification\u002F)\n- [Pact Documentation](https:\u002F\u002Fdocs.pact.io\u002F)\n- [JSON Schema](https:\u002F\u002Fjson-schema.org\u002F)\n- [Schemathesis](https:\u002F\u002Fschemathesis.readthedocs.io\u002F)\n- [k6 Load Testing](https:\u002F\u002Fk6.io\u002Fdocs\u002F)\n\n---\n\n**Created**: 2025-01-15\n**Category**: Testing\n**Difficulty**: Intermediate\n**Estimated Time**: 30-60 minutes\n","# API Contract Testing\n\n## What This Skill Does\n\nImplements comprehensive API contract testing strategies to ensure API compatibility, catch breaking changes early, and enable safe independent service deployment through contract-first development and consumer-driven contract testing.\n\n## Prerequisites\n\n- Node.js 18+ or Python 3.9+\n- API specification (OpenAPI\u002FSwagger) or ability to generate one\n- Test framework (Jest, Vitest, pytest)\n- Basic understanding of REST APIs and JSON Schema\n\n## Quick Start\n\n### Node.js with OpenAPI Validation\n\n```bash\nnpm install --save-dev @apidevtools\u002Fswagger-parser ajv\n\n# Validate OpenAPI spec\nnpx swagger-cli validate openapi.yaml\n\n# Run contract tests\nnpm test -- contract.test.ts\n```\n\n### Python with Schemathesis\n\n```bash\npip install schemathesis pytest\n\n# Generate and run contract tests from OpenAPI spec\nschemathesis run https:\u002F\u002Fapi.example.com\u002Fopenapi.json --checks all\n```\n\n---\n\n## Core Concepts\n\n### Contract Testing vs Integration Testing\n\n| Aspect | Integration Testing | Contract Testing |\n|--------|-------------------|-----------------|\n| **Scope** | Full service-to-service communication | API interface contracts only |\n| **Dependencies** | Requires all services running | Uses mock providers |\n| **Speed** | Slower (network, databases) | Fast (in-memory mocks) |\n| **Brittleness** | Breaks when any service changes | Breaks only on contract violations |\n| **When** | Post-deployment verification | Pre-deployment validation |\n| **Purpose** | Validate end-to-end behavior | Validate interface compatibility |\n\n**Use contract testing for:**\n- Catching breaking API changes before deployment\n- Enabling independent service deployment\n- Fast feedback in CI\u002FCD pipelines\n- Consumer-provider compatibility validation\n\n**Use integration testing for:**\n- Validating business logic across services\n- Testing error scenarios and edge cases\n- Verifying database transactions\n- End-to-end workflow validation\n\n---\n\n## OpenAPI\u002FSwagger Contract Validation\n\n### Contract-First Development Workflow\n\n```\n1. Design API contract (OpenAPI spec)\n2. Generate server stubs and client SDKs\n3. Implement endpoints to satisfy contract\n4. Run contract tests to validate compliance\n5. Deploy with confidence\n```\n\n### Validating Responses Against OpenAPI Spec\n\n#### Node.js with OpenAPI Backend Validator\n\n```typescript\nimport { OpenAPIBackend } from 'openapi-backend'\nimport { test, expect } from '@jest\u002Fglobals'\n\nconst api = new OpenAPIBackend({\n  definition: '.\u002Fopenapi.yaml',\n  strict: true,\n  validate: true\n})\n\nawait api.init()\n\ntest('GET \u002Fusers returns valid response', async () => {\n  const response = await fetch('http:\u002F\u002Flocalhost:3000\u002Fapi\u002Fusers')\n  const data = await response.json()\n\n  \u002F\u002F Validate response against OpenAPI spec\n  const validation = api.validateResponse(data, {\n    operation: {\n      operationId: 'listUsers',\n      method: 'get',\n      path: '\u002Fusers'\n    },\n    status: response.status\n  })\n\n  expect(validation.errors).toBeUndefined()\n})\n\ntest('POST \u002Fusers validates request body', async () => {\n  const invalidUser = { email: 'not-an-email' } \u002F\u002F Missing required fields\n\n  const validation = api.validateRequest({\n    method: 'post',\n    path: '\u002Fusers',\n    body: invalidUser\n  })\n\n  expect(validation.errors).toBeDefined()\n  expect(validation.errors).toContainEqual(\n    expect.objectContaining({\n      path: '.name',\n      message: expect.stringContaining('required')\n    })\n  )\n})\n```\n\n#### Python with Schemathesis\n\n```python\nimport schemathesis\n\nschema = schemathesis.from_path(\"openapi.yaml\")\n\n@schema.parametrize()\ndef test_api_contract(case):\n    \"\"\"\n    Automatically generates tests for all endpoints.\n    Validates:\n    - Request parameters match schema\n    - Response status codes are documented\n    - Response bodies match schema\n    - No undocumented errors\n    \"\"\"\n    case.call_and_validate()\n\n# Run specific checks\n@schema.parametrize()\n@schemathesis.check\ndef test_response_time(response, case):\n    \"\"\"Custom check: response time under 500ms\"\"\"\n    assert response.elapsed.total_seconds() \u003C 0.5\n\n@schema.parametrize()\n@schemathesis.check\ndef test_content_type(response, case):\n    \"\"\"Custom check: correct content type\"\"\"\n    assert response.headers.get(\"Content-Type\") == \"application\u002Fjson\"\n```\n\n### Breaking Change Detection\n\n```typescript\nimport SwaggerParser from '@apidevtools\u002Fswagger-parser'\nimport { diff } from 'openapi-diff'\n\nasync function detectBreakingChanges(\n  oldSpec: string,\n  newSpec: string\n): Promise\u003CBreakingChange[]> {\n  const result = await diff(oldSpec, newSpec)\n\n  const breakingChanges: BreakingChange[] = []\n\n  \u002F\u002F Breaking: Removed endpoint\n  if (result.breakingDifferencesFound) {\n    result.breakingDifferences.forEach(change => {\n      if (change.type === 'remove' && change.action === 'delete') {\n        breakingChanges.push({\n          type: 'REMOVED_ENDPOINT',\n          path: change.path,\n          method: change.method,\n          severity: 'CRITICAL'\n        })\n      }\n\n      \u002F\u002F Breaking: Removed required field\n      if (change.type === 'remove' && change.property === 'required') {\n        breakingChanges.push({\n          type: 'REMOVED_REQUIRED_FIELD',\n          path: change.path,\n          field: change.field,\n          severity: 'HIGH'\n        })\n      }\n\n      \u002F\u002F Breaking: Changed response type\n      if (change.type === 'edit' && change.property === 'type') {\n        breakingChanges.push({\n          type: 'CHANGED_RESPONSE_TYPE',\n          path: change.path,\n          from: change.oldValue,\n          to: change.newValue,\n          severity: 'HIGH'\n        })\n      }\n    })\n  }\n\n  return breakingChanges\n}\n\n\u002F\u002F CI\u002FCD integration\ntest('API has no breaking changes', async () => {\n  const changes = await detectBreakingChanges(\n    'specs\u002Fv1.0.0.yaml',\n    'specs\u002Fv1.1.0.yaml'\n  )\n\n  const criticalChanges = changes.filter(c => c.severity === 'CRITICAL')\n\n  expect(criticalChanges).toHaveLength(0)\n})\n```\n\n---\n\n## Pact Consumer-Driven Contract Testing\n\n### Consumer-Provider Model\n\n```\nConsumer (Frontend\u002FService A)\n  ↓ defines expected interactions\nPact Contract (JSON)\n  ↓ shared with provider\nProvider (Backend\u002FService B)\n  ↓ verifies can satisfy contract\n```\n\n### Consumer Side (Node.js)\n\n```typescript\nimport { PactV3, MatchersV3 } from '@pact-foundation\u002Fpact'\nimport { UserService } from '.\u002FUserService'\n\nconst { like, eachLike } = MatchersV3\n\nconst provider = new PactV3({\n  consumer: 'UserFrontend',\n  provider: 'UserAPI',\n  dir: '.\u002Fpacts'\n})\n\ndescribe('User API Contract', () => {\n  test('get user by id', async () => {\n    await provider\n      .given('user with id 123 exists')\n      .uponReceiving('a request for user 123')\n      .withRequest({\n        method: 'GET',\n        path: '\u002Fusers\u002F123',\n        headers: { Accept: 'application\u002Fjson' }\n      })\n      .willRespondWith({\n        status: 200,\n        headers: { 'Content-Type': 'application\u002Fjson' },\n        body: like({\n          id: '123',\n          email: 'alice@example.com',\n          name: 'Alice',\n          created_at: '2025-01-01T00:00:00Z'\n        })\n      })\n\n    await provider.executeTest(async (mockServer) => {\n      const api = new UserService(mockServer.url)\n      const user = await api.getUser('123')\n\n      expect(user.id).toBe('123')\n      expect(user.email).toBe('alice@example.com')\n    })\n  })\n\n  test('list users with pagination', async () => {\n    await provider\n      .given('multiple users exist')\n      .uponReceiving('a request for users list')\n      .withRequest({\n        method: 'GET',\n        path: '\u002Fusers',\n        query: { page: '1', limit: '10' }\n      })\n      .willRespondWith({\n        status: 200,\n        body: {\n          data: eachLike({\n            id: like('abc-123'),\n            email: like('user@example.com'),\n            name: like('User Name')\n          }),\n          meta: like({\n            total: 42,\n            page: 1,\n            limit: 10\n          })\n        }\n      })\n\n    await provider.executeTest(async (mockServer) => {\n      const api = new UserService(mockServer.url)\n      const result = await api.listUsers({ page: 1, limit: 10 })\n\n      expect(result.data).toBeInstanceOf(Array)\n      expect(result.meta.total).toBeGreaterThan(0)\n    })\n  })\n})\n```\n\n### Provider Side (Verification)\n\n```typescript\nimport { Verifier } from '@pact-foundation\u002Fpact'\nimport { startServer } from '.\u002Fserver'\n\ndescribe('Pact Verification', () => {\n  let server: any\n\n  beforeAll(async () => {\n    server = await startServer(3001)\n  })\n\n  afterAll(async () => {\n    await server.close()\n  })\n\n  test('validates pacts from consumers', async () => {\n    const verifier = new Verifier({\n      provider: 'UserAPI',\n      providerBaseUrl: 'http:\u002F\u002Flocalhost:3001',\n      pactUrls: ['.\u002Fpacts\u002FUserFrontend-UserAPI.json'],\n      stateHandlers: {\n        'user with id 123 exists': async () => {\n          \u002F\u002F Set up test data\n          await db.users.create({\n            id: '123',\n            email: 'alice@example.com',\n            name: 'Alice'\n          })\n        },\n        'multiple users exist': async () => {\n          await db.users.createMany([\n            { id: '1', email: 'user1@example.com', name: 'User 1' },\n            { id: '2', email: 'user2@example.com', name: 'User 2' }\n          ])\n        }\n      }\n    })\n\n    await verifier.verifyProvider()\n  })\n})\n```\n\n### Python with Pact\n\n```python\nimport pytest\nfrom pact import Consumer, Provider, Like, EachLike\n\npact = Consumer('UserFrontend').has_pact_with(Provider('UserAPI'))\n\ndef test_get_user():\n    expected = {\n        'id': '123',\n        'email': 'alice@example.com',\n        'name': 'Alice'\n    }\n\n    (pact\n     .given('user with id 123 exists')\n     .upon_receiving('a request for user 123')\n     .with_request('GET', '\u002Fusers\u002F123')\n     .will_respond_with(200, body=Like(expected)))\n\n    with pact:\n        user = UserService(pact.uri).get_user('123')\n        assert user['id'] == '123'\n        assert user['email'] == 'alice@example.com'\n```\n\n---\n\n## JSON Schema Validation\n\n### Schema Definition\n\n```json\n{\n  \"$schema\": \"http:\u002F\u002Fjson-schema.org\u002Fdraft-07\u002Fschema#\",\n  \"title\": \"User\",\n  \"type\": \"object\",\n  \"required\": [\"id\", \"email\", \"name\"],\n  \"properties\": {\n    \"id\": {\n      \"type\": \"string\",\n      \"pattern\": \"^[a-z0-9-]+$\"\n    },\n    \"email\": {\n      \"type\": \"string\",\n      \"format\": \"email\"\n    },\n    \"name\": {\n      \"type\": \"string\",\n      \"minLength\": 1,\n      \"maxLength\": 100\n    },\n    \"age\": {\n      \"type\": \"integer\",\n      \"minimum\": 0,\n      \"maximum\": 150\n    },\n    \"created_at\": {\n      \"type\": \"string\",\n      \"format\": \"date-time\"\n    }\n  },\n  \"additionalProperties\": false\n}\n```\n\n### Runtime Validation (Node.js)\n\n```typescript\nimport Ajv from 'ajv'\nimport addFormats from 'ajv-formats'\n\nconst ajv = new Ajv({ allErrors: true })\naddFormats(ajv)\n\nconst userSchema = require('.\u002Fschemas\u002Fuser.json')\nconst validate = ajv.compile(userSchema)\n\nfunction validateUser(data: unknown): User {\n  if (!validate(data)) {\n    const errors = validate.errors!.map(err => ({\n      field: err.instancePath.replace('\u002F', ''),\n      message: err.message,\n      params: err.params\n    }))\n\n    throw new ValidationError('Invalid user data', errors)\n  }\n\n  return data as User\n}\n\n\u002F\u002F Use in API endpoint\napp.post('\u002Fusers', async (req, res) => {\n  try {\n    const user = validateUser(req.body)\n    const created = await db.users.create(user)\n    return res.status(201).json(created)\n  } catch (error) {\n    if (error instanceof ValidationError) {\n      return res.status(400).json({ errors: error.details })\n    }\n    throw error\n  }\n})\n```\n\n### Test Response Against Schema\n\n```typescript\nimport { test, expect } from '@jest\u002Fglobals'\nimport Ajv from 'ajv'\n\nconst ajv = new Ajv()\nconst userSchema = require('.\u002Fschemas\u002Fuser.json')\n\ntest('GET \u002Fusers\u002F:id returns valid user schema', async () => {\n  const response = await fetch('http:\u002F\u002Flocalhost:3000\u002Fusers\u002F123')\n  const user = await response.json()\n\n  const validate = ajv.compile(userSchema)\n  const valid = validate(user)\n\n  if (!valid) {\n    console.error('Schema validation errors:', validate.errors)\n  }\n\n  expect(valid).toBe(true)\n})\n```\n\n---\n\n## API Versioning Strategies\n\n### URL Path Versioning\n\n```\n\u002Fapi\u002Fv1\u002Fusers\n\u002Fapi\u002Fv2\u002Fusers\n\nPros: Explicit, easy to route, cacheable\nCons: URL changes between versions\nBest for: Public APIs, major breaking changes\n```\n\n### Header Versioning\n\n```\nGET \u002Fapi\u002Fusers\nAccept: application\u002Fvnd.myapp.v2+json\n\nPros: Clean URLs, content negotiation\nCons: Harder to test, easy to forget\nBest for: Internal APIs, gradual migration\n```\n\n### Contract Testing Across Versions\n\n```typescript\ndescribe('API Version Compatibility', () => {\n  test('v1 and v2 both satisfy their contracts', async () => {\n    \u002F\u002F Test v1 contract\n    const v1Response = await fetch('\u002Fapi\u002Fv1\u002Fusers\u002F123')\n    const v1Data = await v1Response.json()\n    expect(validateV1Contract(v1Data)).toBe(true)\n\n    \u002F\u002F Test v2 contract\n    const v2Response = await fetch('\u002Fapi\u002Fv2\u002Fusers\u002F123')\n    const v2Data = await v2Response.json()\n    expect(validateV2Contract(v2Data)).toBe(true)\n  })\n\n  test('v2 is backward compatible with v1 consumers', async () => {\n    \u002F\u002F V2 should support v1 Accept header\n    const response = await fetch('\u002Fapi\u002Fusers\u002F123', {\n      headers: { Accept: 'application\u002Fvnd.myapp.v1+json' }\n    })\n\n    expect(response.status).toBe(200)\n    expect(validateV1Contract(await response.json())).toBe(true)\n  })\n})\n```\n\n---\n\n## Mock Service Patterns\n\n### Mock Service Worker (MSW) for Browser\u002FNode\n\n```typescript\nimport { rest } from 'msw'\nimport { setupServer } from 'msw\u002Fnode'\n\nconst handlers = [\n  rest.get('\u002Fapi\u002Fusers\u002F:id', (req, res, ctx) => {\n    const { id } = req.params\n\n    return res(\n      ctx.status(200),\n      ctx.json({\n        id,\n        email: `user-${id}@example.com`,\n        name: `User ${id}`\n      })\n    )\n  }),\n\n  rest.post('\u002Fapi\u002Fusers', async (req, res, ctx) => {\n    const body = await req.json()\n\n    \u002F\u002F Validate against schema\n    if (!body.email || !body.name) {\n      return res(\n        ctx.status(400),\n        ctx.json({ error: 'Missing required fields' })\n      )\n    }\n\n    return res(\n      ctx.status(201),\n      ctx.json({ id: 'new-id', ...body })\n    )\n  })\n]\n\nconst server = setupServer(...handlers)\n\nbeforeAll(() => server.listen())\nafterEach(() => server.resetHandlers())\nafterAll(() => server.close())\n```\n\n### WireMock for JVM Services\n\n```json\n{\n  \"request\": {\n    \"method\": \"GET\",\n    \"urlPattern\": \"\u002Fapi\u002Fusers\u002F[a-z0-9-]+\"\n  },\n  \"response\": {\n    \"status\": 200,\n    \"headers\": {\n      \"Content-Type\": \"application\u002Fjson\"\n    },\n    \"jsonBody\": {\n      \"id\": \"{{request.pathSegments.[2]}}\",\n      \"email\": \"user@example.com\",\n      \"name\": \"Mock User\"\n    }\n  }\n}\n```\n\n---\n\n## Load Testing Patterns\n\n### k6 Contract-Aware Load Testing\n\n```javascript\nimport http from 'k6\u002Fhttp'\nimport { check } from 'k6'\nimport { Rate } from 'k6\u002Fmetrics'\n\nconst contractViolations = new Rate('contract_violations')\n\nexport const options = {\n  stages: [\n    { duration: '30s', target: 10 },\n    { duration: '1m', target: 50 },\n    { duration: '30s', target: 0 }\n  ],\n  thresholds: {\n    http_req_duration: ['p(95)\u003C500'],\n    contract_violations: ['rate\u003C0.01'] \u002F\u002F \u003C1% contract violations\n  }\n}\n\nexport default function () {\n  const response = http.get('http:\u002F\u002Flocalhost:3000\u002Fapi\u002Fusers')\n\n  const validContract = check(response, {\n    'status is 200': (r) => r.status === 200,\n    'has data array': (r) => JSON.parse(r.body).data !== undefined,\n    'has meta object': (r) => JSON.parse(r.body).meta !== undefined,\n    'response time \u003C 500ms': (r) => r.timings.duration \u003C 500\n  })\n\n  contractViolations.add(!validContract)\n}\n```\n\n---\n\n## CI\u002FCD Integration\n\n### GitHub Actions Workflow\n\n```yaml\nname: Contract Tests\n\non: [push, pull_request]\n\njobs:\n  contract-tests:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v4\n\n      - name: Setup Node.js\n        uses: actions\u002Fsetup-node@v4\n        with:\n          node-version: 20\n\n      - name: Install dependencies\n        run: npm ci\n\n      - name: Validate OpenAPI spec\n        run: npx swagger-cli validate openapi.yaml\n\n      - name: Run contract tests\n        run: npm run test:contract\n\n      - name: Check for breaking changes\n        run: npm run test:breaking-changes\n\n      - name: Publish Pact contracts\n        if: github.ref == 'refs\u002Fheads\u002Fmain'\n        env:\n          PACT_BROKER_URL: ${{ secrets.PACT_BROKER_URL }}\n          PACT_BROKER_TOKEN: ${{ secrets.PACT_BROKER_TOKEN }}\n        run: npm run pact:publish\n\n      - name: Can I Deploy?\n        run: npx pact-broker can-i-deploy \\\n          --pacticipant UserAPI \\\n          --version ${{ github.sha }} \\\n          --to production\n```\n\n---\n\n## Chaos Engineering Basics\n\n### Simulating Contract Violations\n\n```typescript\nimport { test } from '@jest\u002Fglobals'\n\ntest('handles malformed response gracefully', async () => {\n  \u002F\u002F Simulate provider returning unexpected data\n  mockServer.use(\n    rest.get('\u002Fapi\u002Fusers\u002F:id', (req, res, ctx) => {\n      return res(\n        ctx.status(200),\n        ctx.json({\n          \u002F\u002F Missing required fields\n          id: '123'\n          \u002F\u002F email and name missing\n        })\n      )\n    })\n  )\n\n  await expect(api.getUser('123')).rejects.toThrow('Invalid response schema')\n})\n\ntest('handles unexpected status codes', async () => {\n  mockServer.use(\n    rest.get('\u002Fapi\u002Fusers\u002F:id', (req, res, ctx) => {\n      return res(ctx.status(418)) \u002F\u002F I'm a teapot\n    })\n  )\n\n  await expect(api.getUser('123')).rejects.toThrow('Unexpected status: 418')\n})\n```\n\n---\n\n## Best Practices\n\n1. **Contract-First Development**\n   - Design OpenAPI spec before implementation\n   - Generate stubs and SDKs from spec\n   - Validate implementation against spec\n\n2. **Consumer-Driven Contracts**\n   - Consumers define expected interactions\n   - Providers verify they can satisfy contracts\n   - Enables independent deployment\n\n3. **Breaking Change Prevention**\n   - Run breaking change detection in CI\n   - Block PRs with breaking changes\n   - Version APIs appropriately\n\n4. **Mock in Tests, Real in Staging**\n   - Use mocks for fast feedback in CI\n   - Run full integration tests in staging\n   - Contract tests bridge the gap\n\n5. **Version Compatibility**\n   - Support N-1 version in production\n   - Deprecate old versions gracefully\n   - Communicate changes to consumers\n\n---\n\n## Troubleshooting\n\n### Issue: Contract Test Passes But Integration Fails\n\n**Cause**: Contract doesn't match real provider behavior\n**Solution**:\n- Verify provider state handlers set up data correctly\n- Check provider verification runs against real implementation\n- Ensure mock servers match production responses\n\n### Issue: Too Many False Positives\n\n**Cause**: Overly strict schema validation\n**Solution**:\n```typescript\n\u002F\u002F Use \"like\" matchers for flexible matching\nbody: like({\n  id: '123',\n  email: 'alice@example.com'\n  \u002F\u002F Other fields allowed but not required\n})\n```\n\n### Issue: Breaking Change Detection Too Noisy\n\n**Cause**: Detecting non-breaking changes as breaking\n**Solution**:\n- Configure breaking change rules\n- Allow additive changes (new optional fields)\n- Focus on removals and type changes\n\n---\n\n## Related Skills\n\n- `api-design` - REST API design patterns\n- `backend-patterns` - Service layer patterns\n- `e2e-testing` - End-to-end testing strategies\n- `tdd-workflow` - Test-driven development\n\n## Resources\n\n- [OpenAPI Specification](https:\u002F\u002Fswagger.io\u002Fspecification\u002F)\n- [Pact Documentation](https:\u002F\u002Fdocs.pact.io\u002F)\n- [JSON Schema](https:\u002F\u002Fjson-schema.org\u002F)\n- [Schemathesis](https:\u002F\u002Fschemathesis.readthedocs.io\u002F)\n- [k6 Load Testing](https:\u002F\u002Fk6.io\u002Fdocs\u002F)\n\n---\n\n**Created**: 2025-01-15\n**Category**: Testing\n**Difficulty**: Intermediate\n**Estimated Time**: 30-60 minutes\n",{"name":5,"description":7},"main","eebcd780d62a0710aa03028091dc1e9baa995b83","hypoc\u002Fskills\u002Fapi-contract-testing","https:\u002F\u002Fgithub.com\u002Fpjherron\u002Fhypoc","https:\u002F\u002Fgithub.com\u002Fpjherron","2026-09-01 06:45:11",{"source":8,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add pjherron\u002Fhypoc --skill \"API Contract Testing\"",{"tool":36,"command":37},"bunx","bunx skills add pjherron\u002Fhypoc --skill \"API Contract Testing\"",{"tool":39,"command":40},"pnpm","pnpm dlx skills add pjherron\u002Fhypoc --skill \"API Contract Testing\"","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fpjherron\u002Fhypoc\u002Fblob\u002Fmain\u002Fhypoc\u002Fskills\u002Fapi-contract-testing\u002FSKILL.md",true,[],[45,52,59,66,73,80],{"skillNo":46,"name":47,"nameZh":6,"description":48,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":51,"publishedAt":19},"01M799MNB4RVHZZECC75ZFGH0Y","workspace-surface-audit","Audit the active repo, MCP servers, plugins, connectors, env surfaces, and harness setup, then recommend the highest-value ECC-native skills, hooks, agents, and operator workflows. Use when the user wants help setting up Claude Code or understanding what capabilities are actually available in their environment.","https:\u002F\u002Fgithub.com\u002Fpjherron\u002Fhypoc\u002Fblob\u002Fmain\u002Fhypoc\u002Fskills\u002Fworkspace-surface-audit\u002FSKILL.md",[],[],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":19},"01M799MHR27W0YV1VMW26N691S","Verification & Quality Assurance","Comprehensive truth scoring, code quality verification, and automatic rollback system with 0.95 accuracy threshold for ensuring high-quality agent outputs and codebase reliability.","https:\u002F\u002Fgithub.com\u002Fpjherron\u002Fhypoc\u002Fblob\u002Fmain\u002Fhypoc\u002Fskills\u002Fverification-quality\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M799MEX0F1D253S3KZ1635PE","verification-loop","A comprehensive verification system for Claude Code sessions.","https:\u002F\u002Fgithub.com\u002Fpjherron\u002Fhypoc\u002Fblob\u002Fmain\u002Fhypoc\u002Fskills\u002Fverification-loop\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M799MCFN5N6A9VWM6R2TFJRK","triage","Move issues and external PRs through a state machine of triage roles — categorise, verify, grill if needed, and write agent-ready briefs.","https:\u002F\u002Fgithub.com\u002Fpjherron\u002Fhypoc\u002Fblob\u002Fmain\u002Fhypoc\u002Fskills\u002Ftriage\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M799M695F2XJBTP21YHN0R46","token-budget-advisor","Offers the user an informed choice about how much response depth to consume before answering. Use this skill when the user explicitly wants to control response length, depth, or token budget. TRIGGER when: \"token budget\", \"token count\", \"token usage\", \"token limit\", \"response length\", \"answer depth\", \"short version\", \"brief answer\", \"detailed answer\", \"exhaustive answer\", \"respuesta corta vs larga\", \"cuántos tokens\", \"ahorrar tokens\", \"responde al 50%\", \"dame la versión corta\", \"quiero controlar cuánto usas\", or clear variants where the user is explicitly asking to control answer size or depth. DO NOT TRIGGER when: user has already specified a level in the current session (maintain it), the request is clearly a one-word answer, or \"token\" refers to auth\u002Fsession\u002Fpayment tokens rather than response size.","https:\u002F\u002Fgithub.com\u002Fpjherron\u002Fhypoc\u002Fblob\u002Fmain\u002Fhypoc\u002Fskills\u002Ftoken-budget-advisor\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M799M387CZZVGC18PN0AZ70S","to-tickets","Break a plan, spec, or the current conversation into a set of tracer-bullet tickets, each declaring its blocking edges, published to the configured tracker — edges as text in a local file, or native blocking links on a real tracker.","https:\u002F\u002Fgithub.com\u002Fpjherron\u002Fhypoc\u002Fblob\u002Fmain\u002Fhypoc\u002Fskills\u002Fto-tickets\u002FSKILL.md",[],[]]