nikhil231993

Contract Test Agent — Testing skill for Claude Code

Testing community

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