Skip to content

Contract-First Design

Defining the interface before implementation forces clarity of thought, enables parallel development, and produces APIs shaped by consumer needs rather than implementation convenience.

Tension Addressed

Stability vs. Evolution

Recognizable As

API specifications written before code, schema definitions as source of truth, mock servers generated from specs, client SDK generation, documentation that precedes implementation

Canonical Sources

Meyer, "Object-Oriented Software Construction" (1988) - Design by Contract; "API Design Patterns" - Geewax (2021)

Transfers To

Interface-driven development, Test-driven development (tests as contract), Protocol design, Database schema design, Type systems (types as contracts)

Contract-first inverts the natural tendency to expose implementation details. The discipline of defining "what" before "how" produces more stable, consumer-friendly interfaces.