
Contract enforcement
Keeps mocks honest by tying them to typed ports, OpenAPI schemas and Pact contracts
Contract enforcement is an open-source agent skill for developer tools. It is available on Claude Code.
- Scripts
- None
- Platforms
- Claude Code
- GitHub stars
- 6
- Last commit
- License
- Apache-2.0
- Listing updated
Similar skills
About Contract enforcement
This reference rulebook argues that every mock makes a claim about how a dependency behaves, and that claim should be checked against something verifiable. It tells the agent to mock against the full typed port interface rather than ad-hoc partial stubs, and to pair each mock with adapter tests that run the real implementation against the same interface. When a port changes, the mock tests and adapter tests are expected to change together.
For cross-language boundaries, such as a FastAPI backend feeding a TypeScript frontend, the skill describes generating the OpenAPI schema from Pydantic models and then generating frontend types from it. It includes a CI check that regenerates the types and fails the build if the committed file differs. For services owned by separate teams, it describes consumer-driven contract testing with Pact, where consumers publish expectations and providers verify against them before deploying.
The skill is a rulebook loaded as context by other workflow skills when ports are involved, not a tool the agent invokes directly. It expects a project with port interfaces, typed mocks and, where relevant, FastAPI and openapi-typescript or Pact in its build pipeline.
When your agent uses it
Mocks must be anchored to verifiable contracts — typed mocks against ports, adapter tests on the same interface, OpenAPI schema generation, consumer-driven contracts. L2+ reference rulebook.
From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.
What it can access
From a static check of its 1 file (3 KB) on GitHub on 4 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.
Check another skill before you install it.
Install
This skill ships in the fff plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):
/plugin marketplace add zerotechdebt/ffflow
/plugin install fff@ffflowOr copy only this skill to ~/.claude/skills/contract-enforcement:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zerotechdebt/ffflow.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/contract-enforcement &&
cp -R "$tmp/plugin/skills/contract-enforcement" ~/.claude/skills/contract-enforcement &&
rm -rf "$tmp"For one project only, put the folder in .claude/skills/contract-enforcement inside it instead.
Copy the skill folder to ~/.agents/skills/contract-enforcement to use it in every repository:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zerotechdebt/ffflow.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/contract-enforcement &&
cp -R "$tmp/plugin/skills/contract-enforcement" ~/.agents/skills/contract-enforcement &&
rm -rf "$tmp"For one repository only, put the folder in .agents/skills/contract-enforcement inside it instead.
Copy the skill folder to ~/.cursor/skills/contract-enforcement to use it in every project:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zerotechdebt/ffflow.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/contract-enforcement &&
cp -R "$tmp/plugin/skills/contract-enforcement" ~/.cursor/skills/contract-enforcement &&
rm -rf "$tmp"For one project only, put the folder in .cursor/skills/contract-enforcement inside it instead.
Run in a terminal (add --scope workspace to install it for the current workspace only):
gemini skills install https://github.com/zerotechdebt/ffflow.git --path plugin/skills/contract-enforcementOr copy the folder to ~/.gemini/skills/contract-enforcement yourself.
For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/contract-enforcement:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zerotechdebt/ffflow.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/contract-enforcement &&
cp -R "$tmp/plugin/skills/contract-enforcement" ~/.copilot/skills/contract-enforcement &&
rm -rf "$tmp"For one project only, put the folder in .github/skills/contract-enforcement inside it instead.
Get the folder:
git clone --depth 1 https://github.com/zerotechdebt/ffflow.gitThen copy ffflow/plugin/skills/contract-enforcement into your agent's skills folder as contract-enforcement. Agents that support SKILL.md read one folder per skill.
What it does
- Typed mock rule
- Requires unit tests to mock against the full typed port interface instead of partial ad-hoc stubs.
- Adapter contract tests
- Verifies that real adapter implementations satisfy the same interface the mocks use.
- OpenAPI type generation
- Exports a FastAPI OpenAPI schema and generates TypeScript types from it for the frontend.
- Build-time drift check
- Fails the build when generated contract types change without being regenerated and committed.
- Consumer-driven contracts
- Describes Pact-based testing where consumers declare needs and providers verify them.
Good for
- Check that unit test mocks still match a changed port interface
- Set up adapter tests that run against the same interface as the mocks
- Generate TypeScript types from a FastAPI OpenAPI schema
- Add a CI step that catches stale generated API types
- Plan Pact consumer contracts between services owned by different teams
Contract enforcement FAQ
When is Contract enforcement loaded?
It is loaded as context by the work-issue and plan-chat skills when ports are involved. It is not invoked as a tool on its own.
Does Contract enforcement require a specific language or framework?
The rules mention TypeScript types or Python Protocols and ABCs for ports, and a FastAPI backend with a TypeScript frontend for the OpenAPI example.
What does the OpenAPI check run?
The example CI check runs a Python script to export openapi.json, regenerates types with openapi-typescript, and then checks with git diff that the generated file is unchanged.
Does the skill include scripts?
No. It is a single SKILL.md file with no bundled scripts; the commands it shows are examples for the user's own project.
How do I install Contract enforcement in Claude Code?
Copy the skill folder from GitHub to ~/.claude/skills/contract-enforcement to use it in all your projects, or to .claude/skills/contract-enforcement in one project. Or install the fff plugin, which includes it: /plugin marketplace add zerotechdebt/ffflow, then /plugin install fff@ffflow.
Does Contract enforcement run scripts?
No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.
Which AI agents can use Contract enforcement?
Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.
What are the best alternatives to Contract enforcement?
The closest alternatives to Contract enforcement are Contract first, Testing conventions, API mock helper, API mocking and Contract author.
Where this comes from
- Description: from the skill's own SKILL.md.
More from zerotechdebt/ffflow

Onboards a project onto FFFlow: config, stack setup, then a phased roadmap
- Open source
- 6 GitHub stars
- Developer tools

Runs keep-honest audits on a project and reports drift, stale docs and tech debt
- Open source
- 6 GitHub stars
- Developer tools

Runs another interactive skill unattended, making routine choices from project context
- Open source
- 6 GitHub stars
- Developer tools

Lists and validates the adapter cartridges that FFFlow ports load in a project
- Open source
- 6 GitHub stars
- Developer tools

Extracts a behavioral spec from an unspecified codebase and plans characterization tests
- Open source
- 6 GitHub stars
- Developer tools

Adds GitHub Actions workflows that run FFFlow quality gates on pull requests
- Open source
- 6 GitHub stars
- Developer tools





