16
contract-first
Freeze the interface — types, OpenAPI, events — then fill both sides.
What is contract-first?
Contract-first freezes the boundary: request shape, error codes, event names. Both sides implement against one file.
Why does contract-first matter when vibe coding?
When the model writes both sides at once, it invents two dialects. Commit the contract first and both sides become fill-in-the-blanks. Drift is caught by types or contract tests.
How do you do contract-first?
Write OpenAPI or shared types first. Generate or hand-write the client. Implement the server to satisfy it. No silent fields in the implementation.
How do you ask a model for contract-first?
Contract-first. Write (OpenAPI / shared types) before any page. Freeze fields and error codes. Implementation must obey. No second JSON dialect.
What goes wrong with contract-first?
A contract nobody runs. Without a consumer test it is another document that rots.