# API Contract Specialist

> Deep expertise in contract testing at scale: multi-team Pact Broker workflows, version tags, and breaking-change policy. Use when working with broker governance, compatibility policy or when the user mentions broker governance, compatibility policy.

- Skill: `opknock/api-contract-specialist` (Agent Skill)
- Install (CLI): `npx get-skill add opknock/api-contract-specialist`
- Raw SKILL.md: https://api.skillmd.com/api/skills/opknock/api-contract-specialist/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- License: MIT
- Author: OpKnock (https://skillmd.com/u/opknock)
- Updated: 2026-11-23
- Page: https://skillmd.com/skills/opknock/api-contract-specialist

---


Deep expertise in contract testing at scale: multi-team Pact Broker workflows, version tags, and breaking-change policy.

## Agentic Workflow: Read -> Reason -> Act (api-contract-specialist)

You are **api-contract-specialist** (testing) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.

### 1. Read — testing context for `api-contract-specialist`
- Domain: Deep expertise in contract testing at scale: multi-team Pact Broker workflows, version tags, and breaking-change policy.
- **broker-governance**: Operate Pact Broker with tags, branches, and deploy gates across teams — `npx pact-broker publish ./pacts --consumer-version 1.0.0 --tag prod --broker-bas`
- **compatibility-policy**: Define and enforce breaking-change policy with diffs and can-i-deploy — `openapi-diff --fail-on-incompatible v1.yaml v2.yaml`
- Check `knowledge` and `prerequisites: pact, openapi, node.js, python`

### 2. Reason — think for `api-contract-specialist`
- For `broker-governance`: Operate Pact Broker with tags, branches, and deploy gates across teams — decide which checks to run
- For `compatibility-policy`: Define and enforce breaking-change policy with diffs and can-i-deploy — decide which checks to run
- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs

### 3. Act — execute with `api-contract-specialist` tools
- Tools: `Glob`, `Grep`, `Read`, `Npx`, `Openapi-diff` (see frontmatter `tools`/`allowed-tools`)
- Use `safe_path` for any write; record evidence (paths, checksums)
- Fingerprint: `api-contract-specialist:e1cc84f5`

# API Contract Specialist

Runs contract testing as an organization-wide program.

## When to Use
- Many consumer-provider pairs
- Enforcing a no-breaking-changes policy
- Building release confidence across teams

## Real Commands

```bash
# Publish with environment tags
npx pact-broker publish ./pacts --consumer-version 1.0.0 --tag prod --broker-base-url http://localhost:9292

# Gate deployment
npx pact-broker can-i-deploy --pacticipant payments-service --version 2.1.0 --to prod --broker-base-url http://localhost:9292

# Compatibility matrix
npx pact-broker matrix --consumer consumer --broker-base-url http://localhost:9292

# Spec diff policy
openapi-diff --fail-on-incompatible v1.yaml v2.yaml
```

## Policy Design
- `can-i-deploy` is mandatory in every release
- Tag every deploy environment
- Webhook broker to notify providers of new pacts

## Testing
Run can-i-deploy against the matrix in CI before promoting builds.

## Best Practices
- One participant per service, one version per build
- Never delete pacts blindly; archive with the matrix

## Capabilities

### broker-governance
Operate Pact Broker with tags, branches, and deploy gates across teams

**Parameters:**
- `broker` (string): Pact Broker base URL
- `participant` (string): Pacticipant name
- `tag` (string): Environment tag

**Commands:**
- `npx pact-broker publish ./pacts --consumer-version 1.0.0 --tag prod --broker-base-url http://localhost:9292`
- `npx pact-broker can-i-deploy --pacticipant payments-service --version 2.1.0 --to prod --broker-base-url http://localhost:9292`
- `npx pact-broker list-pacticipants --broker-base-url http://localhost:9292`
- `npx pact-broker describe-version --pacticipant orders --version 3.0.0 --broker-base-url http://localhost:9292`
- `npx pact-broker remove-all-pacticipant-versions --pacticipant legacy-service --broker-base-url http://localhost:9292`

**Examples:**
- npx pact-broker publish ./pacts --consumer-version 1.0.0 --tag prod --broker-base-url http://localhost:9292
- npx pact-broker can-i-deploy --pacticipant payments-service --version 2.1.0 --to prod --broker-base-url http://localhost:9292
- npx pact-broker list-pacticipants --broker-base-url http://localhost:9292

### compatibility-policy
Define and enforce breaking-change policy with diffs and can-i-deploy

**Parameters:**
- `oldSpec` (string): Previous spec
- `newSpec` (string): New spec

**Commands:**
- `openapi-diff --fail-on-incompatible v1.yaml v2.yaml`
- `npx pact-broker can-i-deploy --pacticipant consumer --latest --to prod --broker-base-url http://localhost:9292`
- `openapi-generator validate -i v2.yaml`
- `npx pact-broker matrix --consumer consumer --broker-base-url http://localhost:9292`
- `git diff v1.yaml v2.yaml --stat`

**Examples:**
- openapi-diff --fail-on-incompatible v1.yaml v2.yaml
- npx pact-broker matrix --consumer consumer --broker-base-url http://localhost:9292
- npx pact-broker can-i-deploy --pacticipant consumer --latest --to prod --broker-base-url http://localhost:9292

## References
- [Pact Broker Docs](https://docs.pact.io/pact_broker/)
- [openapi-diff](https://github.com/OpenAPITools/openapi-diff)

