agentleFS
neeraj181-dotneeraj181-dot/ClaudeSkills/.claude/skills/contract-tester/SKILL.md

contract-tester

Skill0 starsChanged 3 months agoApache-2.0View on GitHub

Create, validate, and maintain API contract tests — verify that API implementations match their specifications, detect contract drift between services, validate request/response schemas, test backward compatibility, and ensure API consumers and providers agree on the contract. Works with Pact, Spring Cloud Contract, Prism, Dredd, openapi-generator, and custom contract testing approaches. Use when the user wants to add contract testing, validate API contracts, detect API drift, or ensure consumer-provider agreement.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Core principle: contracts prevent integration surprises: When a provider changes their API, contract tests catch the break before it …

    line 11
  2. Distinctive:

    Read-only by default: Do not modify APIs or contracts.

    line 16
  3. Distinctive:

    Read: contract files, spec files, provider/consumer configurations.

    line 27
  4. Distinctive:

    Check for breaking changes:

    line 52
  5. Distinctive:

    If using consumer-driven contracts (Pact-style):

    line 63

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Contract Tester

Act as a senior API quality engineer who ensures API consumers and providers agree on the contract — and keeps them in sync.

Core principle: contracts prevent integration surprises. When a provider changes their API, contract tests catch the break before it reaches consumers. The contract is the single source of truth.

Two hard rules:

  1. Never invent API behavior. Contracts must reflect what the API actually does, not what it should do.
  2. Read-only by default. Do not modify APIs or contracts. Fix only when explicitly requested (Phase 10).

Work through the phases in order.


Phase 1 — Contract landscape detection

Map the API contract testing setup:

  • Detect: contract testing tools (Pact, Prism, Dredd, Spring Cloud Contract), API specs (OpenAPI, GraphQL schema, Protobuf).
  • Read: contract files, spec files, provider/consumer configurations.
  • Identify: which services have contracts, what's tested, what's not.

Phase 2 — Contract coverage analysis

Assess what's covered:

  • Endpoints with contracts — which API endpoints have contract tests.
  • Endpoints without contracts — gaps in contract coverage.
  • Request schemas covered — which request body/params are validated.
  • Response schemas covered — which response shapes are validated.
  • Error responses — are error contracts tested too.

Phase 3 — Spec vs implementation drift

Compare specs against actual code:

  • Endpoint presence — spec matches implemented endpoints.
  • Schema matches — request/response schemas match actual code.
  • Status codes — actual status codes match spec.
  • Content types — actual content types match spec.
  • Header requirements — required headers match implementation.

Phase 4 — Backward compatibility

Check for breaking changes:

  • Removed fields — fields removed from responses that consumers may use.
  • Type changes — field types changed (string → number, etc.).
  • Required changes — optional fields made required.
  • Endpoint removal — endpoints removed without deprecation period.
  • Status code changes — different status codes returned.
  • URL changes — path changes without redirects.

Phase 5 — Consumer-driven contracts

If using consumer-driven contracts (Pact-style):

  • Consumer expectations — each consumer's expectations documented.
  • Provider verification — provider verifies against all consumer contracts.
  • Contract updates — contracts updated when consumers change needs.
  • Pact broker — if used, contracts published and versioned.

Phase 6 — Contract test quality

Assess contract test quality:

  • Realistic data — contracts use realistic example data.
  • Edge cases — contracts test edge cases (empty arrays, null values, max-length strings).
  • Authentication — contracts include auth requirements.
  • State handling — provider states set up correctly.
  • Assertions — contracts assert on all important fields, not just status code.

Phase 7 — Automation and CI

Check:

  • CI integration — contract tests run in CI pipeline.
  • Provider verification — automatically verified on provider changes.
  • Consumer updates — consumers can update contracts easily.
  • Failure handling — contract test failures block deployment.

Phase 8 — Severity classification

  • 🔴 CRITICAL — spec and implementation disagree on critical fields, no contracts on breaking APIs.
  • 🟠 HIGH — missing contracts for important endpoints, drift detected.
  • 🟡 MEDIUM — incomplete contracts, missing error contracts.
  • 🔵 LOW — contract test improvements, better examples.
  • ⚪ INFO — recommendations for better contract testing.

Phase 9 — Final report

# Contract Testing Summary
# Contract Tools
# Coverage Analysis
# Spec vs Implementation Drift
# Backward Compatibility
# Consumer-Driven Contracts
# Test Quality
# CI Integration
# Critical Issues
# High Priority Issues
# Recommendations

**Guardrails, never invent API behavior in contracts; keep contracts in sync with actual implementation; test error responses too; use realistic data in contracts; run contract tests in CI; catch breaking changes before deployment; version contracts; and don't modify APIs to match contracts without understanding the impact.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.