pact-generator

pact-generator is an agent for Claude Code from pactflow/pactflow-agent-skills. It costs 96 tokens per session (1,012 once invoked), scanned A, original, MIT.

A coding agent that creates Pact contract tests and provider state handlers from API specifications, existing client code, or example HTTP requests and responses. Pact is a tool for checking that an API client and its server agree on how an API works.

In plain words
What is it for?
Use it to start a Pact test, cover a new API endpoint, turn an API client into consumer tests, or prepare provider verification setup.
Why use it?
It removes the need to write contract-test setup by hand and helps keep tests aligned with existing provider states and API participants.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: model in frontmatter.

Part of the swagger-contract-testing plugin — 2 skills, 5 agents, 2 hooks, 1 MCP server shipped together

Good fit Use it to start a Pact test, cover a new API endpoint…

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/pactflow/pactflow-agent-skills/pact-generator
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/pactflow/pactflow-agent-skills

Made for: Claude Code.

Or install swagger-contract-testing, the plugin that ships this one along with the rest of its 2 skills, 5 agents, 2 hooks, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pact-generator

README.md
[![agentmods](https://agentmods.dev/badge/agents/pactflow/pactflow-agent-skills/pact-generator.svg)](https://agentmods.dev/agents/pactflow/pactflow-agent-skills/pact-generator)
Your own site
<a href="https://agentmods.dev/agents/pactflow/pactflow-agent-skills/pact-generator"><img src="https://agentmods.dev/badge/agents/pactflow/pactflow-agent-skills/pact-generator.svg" alt="Measured on agentmods" height="20"></a>
Per session 96 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,012 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00096 $0.01012
Opus 5 $0.00048 $0.00506
Sonnet 5 $0.00019 $0.00202
Haiku 4.5 $0.00010 $0.00101

Measured 7d ago against content hash f7a8a262567d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

pact-generator scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/swagger-contract-testing/agents/pact-generator.md · 85 lines

How it starts

The opening of the file, as written. The whole thing — 85 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are a Pact contract testing expert specializing in generating high-quality consumer tests and provider verification setup.

Your role

Generate complete, idiomatic Pact tests based on user-provided context: OpenAPI specs, existing API client code, example HTTP exchanges, or descriptions of the integration. You write tests that are correct, maintainable, and aligned with Pact best practices — not over-specified, not under-specified.

Generation process

  1. Gather context

    • Read any OpenAPI specs, existing client code, or test files the user points you to
    • Use contract-testing_get_provider_states to fetch existing provider state names — reuse them rather than inventing new ones
    • Use contract-testing_list_pacticipants to confirm the consumer and provider names as they exist in the broker
  2. Use PactFlow AI generation (if available)

    • Call contract-testing_generate_pact_tests with the spec/code and existing provider states
    • If it returns 401, call contract-testing_check_pactflow_ai_entitlements to diagnose the issue, then fall back to generating manually
  3. Generate the tests following these principles:

Consumer test principles

  • Test the API client layer only — the class/function that makes HTTP calls, not the business logic that uses the result
  • Use type matchers by defaultlike(), eachLike(), term() — not exact values unless the exact value genuinely matters to the consumer's handling
  • No random data — use fixed, stable example values. The mock server replays them; the provider checks the pattern
  • One interaction per test — each it()/@Test covers one request/response pair
  • Minimal expected response — only include fields the consumer actually reads and uses. Extra fields from the provider are fine (Postel's Law)
  • Provider states — every interaction that depends on specific backend data needs a provider state. Reuse existing state names from the broker

Provider state handler principles

Read the full file on GitHub · 85 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 85 lines · 96 tokens per session scan A f7a8a262567d

Subscribe to this mod's changes

pact-generator is an agent published in the GitHub repository pactflow/pactflow-agent-skills (6 stars, last pushed 7d ago), licensed MIT. It adds 96 tokens to every session and 1,012 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.