Contract Test Writer logo

Contract Test Writer

Organization
SkillMedev
contract-test-writer

Writes consumer-driven contract tests at service and API boundaries - Pact consumer tests, provider verification, broker publishing, and can-i-deploy gates - so an incompatible change fails a build instead of breaking integrations in production. Use when someone asks "how do I stop the backend breaking my client", "set up Pact between these services", "a renamed field broke a consumer that unit tests passed", or two separately deployed services must stay in sync. Do NOT use for designing a new API contract from scratch or reviewing its design - use api-design instead; do NOT use for end-to-end user-journey tests - use e2e-scenario-author instead; do NOT use for calls inside a single deployable - write a unit test.

Overview

PublisherSkillMedev
Repositoryskills
Skill namecontract-test-writer
Stars
25
Forks
3
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by SkillMedev on GitHub. Read the source before you install it.

Installation

Install the Contract Test Writer AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/SkillMedev/skills/tree/main/skills/contract-test-writer
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/SkillMedev/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/contract-test-writer .claude/skills/contract-test-writer
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Contract Test Writer in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Contract Test Writer on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Contract Test Writer is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Contract Test Writer

Pin the shape of a network boundary from the consumer's side so a provider change that breaks any deployed consumer fails the provider's build, not production. The costly failure this prevents is the silent break: both teams' unit tests pass, both deploys go green, and the integration dies at runtime because a field was renamed or a status code changed and nothing in either pipeline knew the other side existed.

Operating procedure

The consumer-driven order is the point: the consumer declares what it needs first, and the provider verifies against that declaration. Reversing it (provider publishes a schema, consumers hope) is how unread fields calcify and real dependencies go untracked.

Step 1: Gather inputs

  1. The boundary: consumer name, provider name, and the calls in play. Confirm it is a real network boundary you do not control end-to-end (cross-service call, client-to-API). For an internal function call inside one deployable, stop - write a unit test instead.
  2. The fields the consumer actually reads from each response - from the consumer's code, not the provider's docs.
  3. Broker availability: Pact Broker or PactFlow URL and write credentials (default: recommend standing one up; pacts committed to a repo go stale silently).
  4. The environments where consumer versions run (prod, staging), for can-i-deploy.

Label as a guess any field list not confirmed against consumer source.

Step 2: Write the consumer test against a mock provider

Declare only the request shape and the exact response fields the consumer reads - never the provider's full schema. Over-specifying makes the provider brittle to harmless additions. The consumer-driven rule: a field enters the contract only when a consumer consumes it.

Step 3: Match on type and shape, not literal values

Use matchers: like() for scalars, eachLike() for arrays, term()/regex for patterns. Pin a literal only when it is semantically part of the contract - an enum member, a specific status code.

Bad - pinned fixture values plus fields the consumer never reads; harmless data changes now break the build:

javascript
.willRespondWith({
  status: 200,
  body: {
    id: 42, name: 'Alice Smith', email: 'alice@example.com',
    createdAt: '2021-03-04T10:00:00Z', internalScore: 0.87, region: 'us-east-1',
  },
})

Good - matchers for shape, literals only where meaning lives, only consumed fields:

javascript
.willRespondWith({
  status: 200,
  body: {
    id: like(42),
    name: like('Alice Smith'),
    status: term({ matcher: 'active|suspended', generate: 'active' }), // enum: pinned
  },
})

Step 4: Declare coarse provider states

For responses that depend on data, declare a coarse, reusable provider state ("user exists", "user is suspended") in the consumer test rather than encoding exact rows. Fine-grained states ("user 42 with 3 orders placed on Tuesday") multiply provider setup hooks and couple the contract to fixtures.

Step 5: Publish the pact

Run the consumer test to emit the pact file. Publish to the broker tagged with the consumer version and git sha, plus the branch. The broker's matrix of verified consumer-provider version pairs is what makes Step 7 possible.

Step 6: Verify in the provider's pipeline

In the provider's own test suite, replay the pact against the real provider: stand up the endpoint, implement a setup hook for each declared provider state, and verify recorded requests against expectations. A renamed field or changed status code must fail this build. Verification that runs anywhere other than the provider's merge-blocking pipeline is decoration.

Step 7: Gate deploys with can-i-deploy

Run can-i-deploy against the consumer versions actually running in each target environment - not just the latest pact on main. Older consumer versions still deployed are still contracts in force; a provider change compatible with main but not with the version running in prod is still a production break.

Deliverable

Produce: (A) consumer tests emitting a pact whose every field is traceable to a consumer read, (B) broker publishing wired with version, sha, and branch tags, (C) provider verification with state hooks running in the provider's merge-blocking CI, and (D) a can-i-deploy gate checking every environment's deployed consumer versions before release.

Do NOT

  • Do not assert exact field values that are not part of the contract - it produces false breaks on harmless data changes, and false breaks teach teams to ignore the gate.
  • Do not include unread response fields just because the provider returns them - every extra field is a freedom the provider loses for nothing.
  • Do not verify business correctness, performance, or auth flows here - keep logic in unit tests and critical journeys in a thin E2E layer; a contract test asserts shape compatibility only.
  • Do not write contract tests for calls inside a single deployable - the compiler and unit tests already cover that boundary.
  • Do not gate deploys against only the latest pact when older consumer versions are still running in an environment.
  • Do not let the provider team write the "consumer" test from their own schema - that inverts consumer-driven and re-creates the original blindness.

Quality bar

  • The contract contains only fields the consumer consumes - nothing the provider happens to return.
  • Matchers everywhere except deliberately pinned enums and status codes; zero coupling to fixture values.
  • Provider verification runs in the provider's pipeline and a deliberately renamed field demonstrably fails it.
  • Provider states are coarse and shared; can-i-deploy checks every deployed consumer version, not just main.
  • Both teams can name where the pact lives and which build breaks when compatibility does.

Frequently asked questions

What does the Contract Test Writer AI skill do?

Writes consumer-driven contract tests at service and API boundaries - Pact consumer tests, provider verification, broker publishing, and can-i-deploy gates - so an incompatible change fails a build instead of breaking integrations in production. Use when someone asks "how do I stop the backend breaking my client", "set up Pact between these services", "a renamed field broke a consumer that unit tests passed", or two separately deployed services must stay in sync. Do NOT use for designing a new API contract from scratch or reviewing its design - use api-design instead; do NOT use for end-to-...

Why use Contract Test Writer on TypingMind?

Because you install it once and use it with any model. Contract Test Writer is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Contract Test Writer in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/SkillMedev/skills/tree/main/skills/contract-test-writer. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Contract Test Writer?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Contract Test Writer?

As many as you like. As long as a model supports skills, you can use Contract Test Writer with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Contract Test Writer AI skill free?

Yes. It is published on GitHub by SkillMedev under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇