Agent skill

API Contract Testing

by secondsky in secondsky/claude-skills

Verifies API contracts between services using consumer-driven contracts, schema validation, and tools like Pact.

MITAuto-check passedBackend & APIs

Install API Contract Testing

skills CLI
$ npx skills add secondsky/claude-skills --skill api-contract-testing -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install secondsky/claude-skills api-contract-testing --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/secondsky/claude-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/api-contract-testing/skills/api-contract-testing .claude/skills/api-contract-testing && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
api-contract-testing
GitHub stars
227
Token cost
~977 tokens
SKILL.md length
148 words
Files
4 (incl. references)
Skills in repo
169
Repo updated
First seen
Licence
MIT

At a glance

Verifies API contracts between services using consumer-driven contracts, schema validation, and tools like Pact.

  • Testing microservices communication
  • SKILL.md covers Key Concepts, Pact Consumer Test (TypeScript), Provider Verification and OpenAPI Validation (Express), plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Preventing breaking changes

What it does

API Contract Testing is an agent skill from secondsky/claude-skills. Verifies API contracts between services using consumer-driven contracts, schema validation, and tools like Pact. Use when testing microservices communication, preventing breaking changes, or validating OpenAPI specifications.

Its SKILL.md is about 980 tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `references/java-rest-assured.md`, `references/pact-broker-cicd.md` and `references/python-json-schema.md`).

It sits in Backend & APIs, covering API design, OpenAPI specifications and Forms and validation. It works with OpenAPI, Java and Python. The repository describes itself as: Production-ready skills for Claude Code CLI - Cloudflare, React, Tailwind v4, and AI integrations. The licence is MIT.

When your agent uses it

  • Testing microservices communication
  • Preventing breaking changes
  • Validating OpenAPI specifications

Example prompts

  • “Use the api-contract-testing skill to verify API contracts between services using consumer-driven contracts, schema validation, and tools like Pact”
  • “/api-contract-testing”

Requirements

  • Python 3

What it can do on your machine

Read from SKILL.md and the folder at commit 8837836. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript and javascript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

API Contract Testing loads about 977 tokens when it runs, and up to ~6.3k if it reads all its reference files. Until then it costs about 62 tokens; SKILL.md has 148 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~62
When it runs · the whole SKILL.md, loaded when a task matches
~977
With references · SKILL.md plus every file in references/, read only if the agent opens them
~6.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from secondsky/claude-skills at commit 8837836, republished under its MIT licence (© secondsky). 148 words, ~977 tokens.

Download SKILL.mdSave it as .claude/skills/api-contract-testing/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
api-contract-testing
description
Verifies API contracts between services using consumer-driven contracts, schema validation, and tools like Pact. Use when testing microservices communication, preventing breaking changes, or validating OpenAPI specifications.
license
MIT

API Contract Testing

Verify that APIs honor their contracts between consumers and providers without requiring full integration tests.

Key Concepts

TermDefinition
ConsumerService that calls an API
ProviderService that exposes an API
ContractAgreed request/response format
PactConsumer-driven contract testing tool
SchemaStructure definition (OpenAPI, JSON Schema)
BrokerCentral repository for contracts

Pact Consumer Test (TypeScript)

typescript
import { PactV3, MatchersV3 } from '@pact-foundation/pact';

const provider = new PactV3({
  consumer: 'OrderService',
  provider: 'UserService'
});

describe('User API Contract', () => {
  it('returns user by ID', async () => {
    await provider
      .given('user 123 exists')
      .uponReceiving('a request for user 123')
      .withRequest({ method: 'GET', path: '/users/123' })
      .willRespondWith({
        status: 200,
        body: MatchersV3.like({
          id: '123',
          name: MatchersV3.string('John'),
          email: MatchersV3.email('john@example.com')
        })
      })
      .executeTest(async (mockServer) => {
        const response = await fetch(`${mockServer.url}/users/123`);
        expect(response.status).toBe(200);
      });
  });

  it('returns 404 for non-existent user', async () => {
    await provider
      .given('user does not exist')
      .uponReceiving('a request for non-existent user')
      .withRequest({ method: 'GET', path: '/users/999' })
      .willRespondWith({
        status: 404,
        body: MatchersV3.like({
          error: { code: 'NOT_FOUND', message: MatchersV3.string() }
        })
      })
      .executeTest(async (mockServer) => {
        const response = await fetch(`${mockServer.url}/users/999`);
        expect(response.status).toBe(404);
      });
  });
});

Provider Verification

typescript
import { Verifier } from '@pact-foundation/pact';

new Verifier({
  provider: 'UserService',
  providerBaseUrl: 'http://localhost:3000',
  pactBrokerUrl: process.env.PACT_BROKER_URL,
  publishVerificationResult: true,
  providerVersion: process.env.GIT_SHA,
  stateHandlers: {
    'user 123 exists': async () => {
      await db.users.create({ id: '123', name: 'John' });
    },
    'user does not exist': async () => {
      await db.users.deleteAll();
    }
  }
}).verifyProvider();

OpenAPI Validation (Express)

javascript
const OpenApiValidator = require('express-openapi-validator');

app.use(OpenApiValidator.middleware({
  apiSpec: './openapi.yaml',
  validateRequests: true,
  validateResponses: true,
  validateSecurity: true
}));

Additional Implementations

Best Practices

Do:

  • Test from consumer perspective
  • Use matchers for flexible matching
  • Validate structure, not specific values
  • Version contracts explicitly
  • Test error responses
  • Run tests in CI pipeline
  • Test backward compatibility

Don't:

  • Test business logic in contracts
  • Hard-code specific values
  • Skip error scenarios
  • Ignore versioning
  • Deploy without verification

Tools

  • Pact - Multi-language consumer-driven contracts
  • Spring Cloud Contract - JVM ecosystem
  • OpenAPI/Swagger - Schema-first validation
  • Dredd - API blueprint testing
  • Spectral - OpenAPI linting

© secondsky, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (references) in plugins/api-contract-testing/skills/api-contract-testing of secondsky/claude-skills.

  • SKILL.md
  • references/java-rest-assured.md
  • references/pact-broker-cicd.md
  • references/python-json-schema.md

Open the folder on GitHubat commit 8837836

Compare with similar skills

API Contract Testing next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

API Contract Testing compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
API Contract Testing this skillsecondsky/claude-skills227—~977Automated safety check: PassMIT
API Contract Openapimakifbaysal/tasktrooper109—~1.2kAutomated safety check: PassApache-2.0
Yapi Skillhashgraph-online/awesome-codex-plugins1.2k—~2kAutomated safety check: PassApache-2.0
703 Technologies Fuzzing Testingjabrena/plinth446—~874Automated safety check: PassApache-2.0
Agentic Workflows API Documentation Lungoagntcy/coffeeAgntcy112—~2.6kAutomated safety check: PassApache-2.0
API DesignerJeffallan/claude-skills12k2 repos~2kAutomated safety check: PassMIT

Similar skills

  • API Contract Openapi

    makifbaysal/tasktrooper

    A skill your agent uses when you add or change any HTTP endpoint's request or response shape (Go or Java) — implement the task's contract exactly, evolve additively, keep the OpenAPI document in…

    109 GitHub stars~1.2k tokensUpdated today
    Backend & APIsAuto-check passed
  • Yapi Skill

    hashgraph-online/awesome-codex-plugins

    Python stdlib scripts for the YApi OpenAPI (no Java/Docker/MCP) — search interfaces, query details, and sync/upsert one interface's docs from a YApi-native payload (often converted from OpenAPI).

    1.2k GitHub stars~2k tokensUpdated today
    Backend & APIsAuto-check passed
  • A skill your agent uses when you need to add or review fuzz testing for Java APIs with CATS — including contract-driven negative testing, malformed payload validation, boundary input exploration, CI…

    446 GitHub stars~874 tokensUpdated yesterday
    Testing & QAAuto-check passed
  • Authors and maintains the human-facing Agentic Workflows API documentation for the lungo subproject at coffeeAGNTCY/coffeeagents/lungo/docs/workflow-instanceapi.md.

    112 GitHub stars~2.6k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • API Designer

    Jeffallan/claude-skills

    Designs REST and GraphQL APIs from resource modeling to an OpenAPI 3.1 contract, with versioning, pagination and RFC 7807 error handling.

    12k GitHub starsUsed in 2 repos~2k tokens
    Backend & APIsAuto-check passed
  • Old Coder API Design

    AmazingAng/old-coder

    Reviews or designs an HTTP/JSON API's endpoints, auth, pagination, versioning and deprecations, guarding against inventing a bespoke interface or silently breaking consumers.

    749 GitHub starsUsed in 1 repo~3.4k tokens
    Backend & APIsAuto-check passed

More from secondsky/claude-skills

All 169 skills in this repo
  • Tanstack AI

    secondsky/claude-skills

    TanStack AI (alpha) provider-agnostic type-safe chat with streaming for OpenAI, Anthropic, Gemini, Ollama.

    227 GitHub starsUsed in 1 repo~3.6k tokens
    Auto-check: notes
  • Auto Animate

    secondsky/claude-skills

    AutoAnimate (@formkit/auto-animate) zero-config animations for React.

    227 GitHub stars~2.9k tokensUpdated 10 days ago
    Auto-check passed
  • Base UI React

    secondsky/claude-skills

    MUI Base UI unstyled React components with Floating UI. An agent skill from secondsky/claude-skills.

    227 GitHub stars~1.9k tokensUpdated 10 days ago
    Auto-check passed
  • Cloudflare Images

    secondsky/claude-skills

    This skill should be used when the user asks to "upload images to Cloudflare", "implement direct creator upload", "configure image transformations", "optimize WebP/AVIF", "create image variants"…

    227 GitHub stars~3.6k tokensUpdated 10 days ago
    Auto-check: notes
  • Cloudflare Nextjs

    secondsky/claude-skills

    Deploy Next.js to Cloudflare Workers via the OpenNext adapter (@opennextjs/cloudflare).

    227 GitHub stars~5.3k tokensUpdated 10 days ago
    Auto-check: notes
  • Cloudflare Sandbox

    secondsky/claude-skills

    Cloudflare Sandboxes SDK for secure code execution in Linux containers at edge.

    227 GitHub stars~4.5k tokensUpdated 10 days ago
    Auto-check passed

Categories

Questions about API Contract Testing

What does API Contract Testing do?

Verifies API contracts between services using consumer-driven contracts, schema validation, and tools like Pact. API Contract Testing is an agent skill from secondsky/claude-skills. Verifies API contracts between services using consumer-driven contracts, schema validation, and tools like Pact.

When should I use API Contract Testing?

API Contract Testing fits situations like: testing microservices communication; preventing breaking changes; validating OpenAPI specifications.

How do I install API Contract Testing in Claude Code?

Run `npx skills add secondsky/claude-skills --skill api-contract-testing -a claude-code`. Or copy the skill folder (plugins/api-contract-testing/skills/api-contract-testing in secondsky/claude-skills) into .claude/skills/api-contract-testing in your project. Claude Code loads it when a task matches its description.

How do I install API Contract Testing in Codex?

Run `npx skills add secondsky/claude-skills --skill api-contract-testing -a codex`. Or copy the skill folder (plugins/api-contract-testing/skills/api-contract-testing in secondsky/claude-skills) into .agents/skills/api-contract-testing in your project. Codex loads it when a task matches its description.

Can I use API Contract Testing in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add secondsky/claude-skills --skill api-contract-testing -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/api-contract-testing, .gemini/skills/api-contract-testing, .github/skills/api-contract-testing and .opencode/skills/api-contract-testing in your project.

What does API Contract Testing need to run?

SKILL.md names no scripts, command-line tools or credentials: API Contract Testing is instructions for the agent only. Our summary lists: Python 3.

Does API Contract Testing access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is API Contract Testing safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does API Contract Testing use?

API Contract Testing is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does API Contract Testing use?

About 977 tokens (SKILL.md is roughly 3.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 5.3k tokens, read only when the agent opens those files.

What are the alternatives to API Contract Testing?

Skills that share tags, products or a category with API Contract Testing: API Contract Openapi (makifbaysal/tasktrooper, 109 stars), Yapi Skill (hashgraph-online/awesome-codex-plugins, 1.2k stars), 703 Technologies Fuzzing Testing (jabrena/plinth, 446 stars) and Agentic Workflows API Documentation Lungo (agntcy/coffeeAgntcy, 112 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains API Contract Testing?

secondsky (a GitHub user) maintains it in secondsky/claude-skills, which has 227 GitHub stars. The repository holds 169 skills in this directory. The repository was last updated on September 28, 2026.

Source: secondsky/claude-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.