contract-testing

Write contract tests for HTTP APIs using the Steps API.

7|7|Updated Mar 9, 2026
One-click install
npx skills add https://github.com/civitas-cerebrum/element-interactions --skill contract-testing-civitas-cerebrum
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: contract-testing
Source: https://github.com/civitas-cerebrum/element-interactions/tree/main/skills/contract-testing
Command: npx skills add https://github.com/civitas-cerebrum/element-interactions --skill contract-testing-civitas-cerebrum

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enables teams to write contract-style tests for HTTP APIs to lock the surface they expose: status codes, headers, and the shape of responses, without coupling to UI or business logic.

Core Features & Use Cases

  • Phase-driven workflow from intake to report, ensuring each contract obligation is tested separately.
  • Shape-first assertions using typed responses and reusable schemas to prevent data leakage into the contract.
  • Provider-aware API calls (GET/POST/PUT/PATCH/DELETE) with explicit status and header verification and optional authentication handling.
  • Clear guidance for when a contract should be derived from an OpenAPI/README spec versus live discovery, with guardrails to avoid drifting.

Quick Start

Create contract tests against your API endpoints using the Steps API to assert status, headers, and response shapes against a live backend.

Frequently Asked Questions about contract-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write contract tests for HTTP APIs to lock response schemas and status codes?

Contract testing for HTTP APIs uses the Steps API to verify status codes, header contracts, and response shapes against a live backend. You apply shape-first assertions with typed responses to prevent data leakage and lock the API surface without coupling to UI logic.

What is the best way to prevent API contract drift when testing multiple backends?

To prevent API contract drift across backends, enforce one obligation per test and apply shape-based assertions using reusable schemas. Avoid hardcoding base URLs and rely on provider-aware API calls to maintain deterministic contract verification.

Can I use Playwright for API contract testing and header verification?

Yes, Playwright supports API contract testing by utilizing the Steps API, which includes apiGet, apiPost, verifyApiStatus, and verifyApiHeader. These steps allow you to assert response schemas and header contracts deterministically.

How do I structure API contract tests from intake through to final reporting?

API contract tests follow a phase-driven workflow from intake through to final reporting. This process ensures each contract obligation is tested separately using provider-aware API calls and typed responses to avoid data leakage into the contract.

When should I derive API contracts from an OpenAPI spec versus live discovery?

You should derive API contracts from an OpenAPI or README spec when available documentation is precise, and use live discovery when specs are absent. Guardrails are applied in both approaches to ensure shape-first assertions and prevent drifting from the intended contract.