contract-first

Coordinate API and event schema changes through one authoritative machine-checkable contract artifact.

Updated May 7, 2026
One-click install
npx skills add https://github.com/mirzadham/trainingroombookingsystem2 --skill contract-first-mirzadham
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: contract-first
Source: https://github.com/mirzadham/trainingroombookingsystem2/tree/main/.pi/skills/contract-first
Command: npx skills add https://github.com/mirzadham/trainingroombookingsystem2 --skill contract-first-mirzadham

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When frontend and backend teams or multiple services evolve an API or event schema independently, field names, nullability, enums, and error shapes drift apart, causing integration failures and silent breaking changes. This Skill establishes a single authoritative contract artifact that both consumers and providers verify against before integration. ## Core Features & Use Cases - Canonical Boundary Artifact: Defines one version-controlled source of truth per boundary using OpenAPI, AsyncAPI, Protocol Buffers, or JSON Schema. - Consumer-First Workflow: Guides teams through identifying consumers, describing consumer jobs, defining the smallest useful contract, generating types, and verifying provider responses against the same artifact. - Contract Change Protocol: Enforces a review process where the contract changes before implementation, with migration or versioning plans for breaking changes. - Use Case: A frontend team and a backend team build an orders feature in parallel. The consumer defines an OrderSummary schema in openapi.yaml, generates TypeScript types and mocks from it, and the provider proves its serialized responses satisfy the same schema before merge. ## Quick Start Ask the AI to define an OpenAPI contract for the endpoint your frontend and backend teams are building in parallel, then generate consumer types and verify provider responses against it.

Frequently Asked Questions about contract-first

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

FAQPage Schema
How do I keep frontend and backend API contracts in sync?▼

Maintain one canonical artifact such as an OpenAPI document that both sides verify against. Generate consumer types and mocks from it, and validate the provider's real serialized responses against the same schema before merging.

What is contract-first API development?▼

Contract-first development defines the API schema in an authoritative artifact before implementation. Consumers state what they need, providers implement that shape, and both sides verify against the same contract rather than documenting the API after the fact.

OpenAPI vs AsyncAPI vs Protocol Buffers for service contracts?▼

Use OpenAPI for HTTP APIs, AsyncAPI for event-driven APIs, Protocol Buffers for RPC or message schemas, and JSON Schema for standalone payloads. Choose one canonical artifact per boundary based on the communication style.

Why do TypeScript types not prevent API integration bugs?▼

Compile-time types only check local declarations and can hide incompatible runtime data through casts. Database coercion, conditional response paths, and serialization drift require runtime schema validation or contract tests on actual serialized output.

When should I not use contract-first development?▼

Skip contract machinery for a single-module boundary that changes in one atomic commit with no independent consumer. A shared type is enough when there is no parallel work or cross-team ownership to coordinate.

How do I handle breaking changes to an API contract?▼

Change the canonical artifact first, review the diff with affected consumers and the provider, then regenerate types and update implementations. Use the repository's versioning or migration policy rather than silently repurposing an existing field.