Contract Test Agent — Testing skill for Claude Code
AI agent (Claude Agent SDK) that writes and runs Specmatic consumer contract tests for Java Spring services, using test-context-graph and an OpenAPI spec finder over MCP.
How to install Contract Test Agent
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open nikhil231993/contract-test-agent and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Contract Test Agent does
AI agent (Claude Agent SDK) that writes and runs Specmatic consumer contract tests for Java Spring services, using test-context-graph and an OpenAPI spec finder over MCP. Reports consumer bugs it finds; guarded for unattended CI runs.
Alternatives in Testing
- Deslop Reborn — One iteration of the IronClaw Reborn de-slop loop — take ONE Reborn crate, fan out parallel review sub-agents 12.6k ★
- Regen API — Regenerate the OpenAPI spec and web API client after server API changes 2.5k ★
- Ext Apps — Official repo for spec & SDK of MCP Apps protocol - standard for UIs embedded AI chatbots, served by MCP serve 1.9k ★
README
contract-test-agent
An AI agent that writes **Specmatic consumer contract tests** for a Java Spring service, runs them, and reports what it found, including bugs in the service itself.
contract-agent ~/code/checkout-consumer --spec-repo nikhil231993/contract-api-specs
It finds every HTTP call the service makes to other services, looks up each provider's OpenAPI spec (the version marked ACTIVE), writes the Specmatic examples, `specmatic.yaml` and a JUnit test that drives the service against a strict Specmatic mock, then runs the tests. A request the contract doesn't allow fails the build: on the [demo](https://github.com/nikhil231993/specmatic-contract-testing-demo) the first run caught checkout sending `"amount": null` on full refunds.
How it works
Built on the [Claude Agent SDK](https://code.claude.com/docs/en/agent-sdk) (the Claude Code harness as a library), with Claude Opus 5.5 and three MCP servers:
| Tool | What the agent uses it for |
|---|---|
test-context-graph (tcg, tcg-mcp) |
The service's outbound calls, each call's request as the code builds it, the base-URL property, entry points to drive, a draft example |
| ghes-openapi-mcp | Finds the provider spec that defines a call, and its ACTIVE version |
| artifactory-mocks-mcp (optional) | Existing WireMock stubs, for realistic example values |
| Specmatic (open source, jar) | Validates the config and examples, and is the strict mock the tests run against |
The workflow is in [`prompts.py`](src/contract_test_agent/prompts.py): index, list calls, find and fetch each spec, re-index with it, get each call's context, write, validate, run, report.
Safe to run unattended
Every tool call goes through [`guard.py`](src/contract_test_agent/guard.py) first:
- Reads stay in the service's repo and a
Related Skills
Contract Version Bump
Classify and apply a version bump to a machine-readable contract (JSON Schema, API spec, config schema) — vers
Auto Test
Auto-Testing Skill — PP Quality Gate. Detects the project type (Python/Node/Java/Mixed/Unknown) of the current
Metadata Extractor
Scaffold a custom Alfresco metadata extractor/embedder (extending AbstractMappingMetadataExtracter) with a pro
Permissions
Generate custom Alfresco permission groups and permissions (permissionDefinitions.xml extension) plus optional
Contract Sync
Pull latest FuFirE OpenAPI spec, update local copy, run contract tests, report drift
React Developer Challenge
A comprehensive challenge system designed to test senior React developers' skills through practical coding cha
Related Agents
Openapi Spec Author
Specializes in API design, OpenAPI specification authoring, and backward compatibility validation. Uses Specma
Code Writer Java
Java code implementation sub-agent. Invoked by any manager whose plan calls for Java code — Spring Boot servic
Contract Arbiter
Plan M3 contract arbiter. Lives in Phase 5 paired-teammate teams as the senior reviewer. Listens for FE/BE con