Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
aj-geddes avatar

Api Contract Testing

  • 797 installs
  • 305 repo stars
  • Updated March 4, 2026
  • aj-geddes/useful-ai-prompts

API Contract Testing is a backend testing skill that verifies API contracts between consumers and providers using contract testing, Pact, and schema validation for developers who must catch breaking service changes befor

About

API Contract Testing is an installable skill from aj-geddes/useful-ai-prompts that guides contract testing between microservice consumers and providers. It validates that API changes do not break dependent consumers without requiring full integration test suites. Coverage includes consumer-driven contracts, Pact workflows, schema validation, and compatibility checks before ship. Developers reach for API Contract Testing when services evolve independently and integration tests are too slow or brittle to catch contract drift. The skill documents overview, quick start, reference guides, and best practices for honoring published API contracts.

  • Verifies request/response formats, data types, and behavior without full integration tests
  • Prevents breaking changes in microservices and third-party integrations
  • Supports consumer-driven contract testing with Pact and OpenAPI/Swagger validation
  • Catches contract violations early in CI pipelines
  • Validates API versioning and backward compatibility

Api Contract Testing by the numbers

  • 797 all-time installs (skills.sh)
  • +10 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #557 of 2,153 Testing & QA skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill api-contract-testing

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs797
repo stars305
Security audit3 / 3 scanners passed
Last updatedMarch 4, 2026
Repositoryaj-geddes/useful-ai-prompts

How do you prevent breaking API contract changes?

Automatically verify that API changes between services will not break dependent consumers before they ship.

Who is it for?

Backend developers maintaining microservices who need consumer-driven contract tests instead of heavyweight end-to-end integration suites.

Skip if: Teams with a single monolithic API and no independent consumer services that require contract isolation.

When should I use this skill?

A developer mentions Pact, consumer-driven contracts, schema validation, or breaking API changes between services.

What you get

Contract test plans, Pact consumer-provider validations, and schema compatibility checks confirming services honor published API contracts.

  • contract test specifications
  • schema validation checklist

Files

SKILL.mdMarkdownGitHub ↗

API Contract Testing

Table of Contents

Overview

Contract testing verifies that APIs honor their contracts between consumers and providers. It ensures that service changes don't break dependent consumers without requiring full integration tests. Contract tests validate request/response formats, data types, and API behavior independently.

When to Use

  • Testing microservices communication
  • Preventing breaking API changes
  • Validating API versioning
  • Testing consumer-provider contracts
  • Ensuring backward compatibility
  • Validating OpenAPI/Swagger specifications
  • Testing third-party API integrations
  • Catching contract violations in CI

Quick Start

Minimal working example:

// tests/pact/user-service.pact.test.ts
import { PactV3, MatchersV3 } from "@pact-foundation/pact";
import { UserService } from "../../src/services/UserService";

const { like, eachLike, iso8601DateTimeWithMillis } = MatchersV3;

const provider = new PactV3({
  consumer: "OrderService",
  provider: "UserService",
  port: 1234,
  dir: "./pacts",
});

describe("User Service Contract", () => {
  const userService = new UserService("http://localhost:1234");

  describe("GET /users/:id", () => {
    test("returns user when found", async () => {
      await provider
        .given("user with ID 123 exists")
        .uponReceiving("a request for user 123")
        .withRequest({
          method: "GET",
          path: "/users/123",
          headers: {
// ... (see reference guides for full implementation)

Reference Guides

Detailed implementations in the references/ directory:

GuideContents
Pact for Consumer-Driven ContractsPact for Consumer-Driven Contracts
OpenAPI Schema ValidationOpenAPI Schema Validation
JSON Schema ValidationJSON Schema Validation
REST Assured for JavaREST Assured for Java
Contract Testing with PostmanContract Testing with Postman
Pact Broker IntegrationPact Broker Integration

Best Practices

✅ DO

  • Test contracts from consumer perspective
  • Use matchers for flexible matching
  • Validate schema structure, not specific values
  • Version your contracts
  • Test error responses
  • Use Pact broker for contract sharing
  • Run contract tests in CI
  • Test backward compatibility

❌ DON'T

  • Test business logic in contract tests
  • Hard-code specific values in contracts
  • Skip error scenarios
  • Test UI in contract tests
  • Ignore contract versioning
  • Deploy without contract verification
  • Test implementation details
  • Mock contract tests

Related skills

How it compares

Choose API Contract Testing for cross-service contract guarantees; rely on integration tests only when you need full end-to-end behavioral coverage beyond API surface contracts.

FAQ

What problem does API Contract Testing solve?

API Contract Testing verifies that providers honor contracts expected by consumers, catching breaking API changes without running full integration tests across every dependent service.

Does API Contract Testing support Pact?

API Contract Testing explicitly covers Pact, consumer-driven contracts, and schema validation as core methods for verifying compatibility between services.

Is Api Contract Testing safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Testing & QAintegrationstesting

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.