Verified against Claude Code · 2026-07-30
Freeze the interface first, implement against it, instead of discovering it mid-build
A contract-first development loop that has Claude Code define the full interface, type, and error-case shape for a feature before any implementation begins, requires explicit re-approval for any later contract change, and names every downstream consumer that would be affected if the frozen shape turns out to need adjusting.
The prompt
Ready to copy — highlighted parts are example details you can swap.
You are defining the contract for this feature before writing any implementation against it — every function signature, request and response shape, and error case this feature introduces must be fully specified and approved before implementation starts, not discovered incrementally as the build proceeds. FEATURE A new bulk-tag-update endpoint for the prompt library admin panel, letting an editor apply a tag to many prompt entries at once. WHAT SPECIFICALLY NEEDS A FROZEN SHAPE The POST /api/admin/prompts/bulk-tag request body shape, the response shape including per-item success or failure, and every distinct error case such as an invalid slug or a tag exceeding the allowed length. WHO ALREADY CONSUMES OR WILL CONSUME THIS CONTRACT The admin panel frontend, currently being built in parallel by a different session against this exact contract. VERSIONING STRATEGY IF THIS CONTRACT NEEDS TO CHANGE LATER This is an internal admin-only endpoint with one consumer, so an in-place change is acceptable as long as both sides update together; it is not a public API needing deprecation. STAGE ONE — CONTRACT DEFINITION ONLY Write out every element of The POST /api/admin/prompts/bulk-tag request body shape, the response shape including per-item success or failure, and every distinct error case such as an invalid slug or a tag exceeding the allowed length. in full: exact function signatures with parameter and return types, exact request and response shapes if this crosses a network or process boundary, and every distinct error case with what triggers it and what the caller receives back for it. Do not write any implementation logic in this stage — a type signature and a stub that throws not-implemented is acceptable here; real logic behind it is not. Do not proceed past this stage until the contract is explicitly approved. State clearly that you are waiting for that approval. STAGE TWO — IMPLEMENTATION AGAINST THE FROZEN CONTRACT Once approved, implement strictly against the contract from stage one. If, while implementing, a genuine need to change the contract emerges — a case that turns out to need a different shape, a return type that cannot actually express what the implementation needs to convey — stop implementing, name exactly what needs to change and why, and treat this as a new stage-one proposal requiring its own approval, not a change to quietly make and mention afterward. CHECK AGAINST CONSUMERS Before any contract change is approved, whether at the start or mid-implementation, check The admin panel frontend, currently being built in parallel by a different session against this exact contract. explicitly — a contract change that looks purely additive to the feature being built can still be a breaking change for an existing consumer that pattern-matches on the previous shape, and that has to be confirmed against the actual consumer code, not assumed safe because the change felt small from inside this feature's own perspective. CONSTRAINTS - If This is an internal admin-only endpoint with one consumer, so an in-place change is acceptable as long as both sides update together; it is not a public API needing deprecation. indicates this contract is public or crosses a boundary this codebase does not fully control, such as an external API consumer, treat a contract change as requiring a deprecation path, not an in-place edit, and say so explicitly. - Do not let implementation details leak backward into the contract definition — the contract describes what callers can rely on, not how the feature happens to be built internally, and conflating the two makes the contract brittle to implementation changes that should never have affected it. OUTPUT Stage one's full contract, an explicit wait-for-approval line, and only then, once approved, stage two's implementation strictly matching it.
Customize
Optional — swap in your own details for the highlighted parts above.
Why this works
An interface discovered incrementally during implementation is discovered under exactly the wrong conditions to design it well — the shape that feels natural to write from inside the function currently being built is not reliably the shape a consumer on the other side of that boundary actually needs, and by the time a second file is built against whatever shape the first one happened to settle on, correcting course requires redoing work rather than adjusting a plan. Freezing the contract before any implementation begins forces the design questions — what does an error case actually return, what does an empty result look like, what is optional versus required — to be answered once, deliberately, in a form a reviewer can actually evaluate, rather than being answered implicitly and inconsistently across however many call sites end up depending on them. The explicit re-approval requirement for a mid-implementation contract change matters for the same reason a mid-plan deviation needs its own approval in a Plan Mode workflow: an approved contract that quietly changes without a second look defeats the entire reason it was frozen in the first place, since anyone relying on the original approved shape now has a false sense of what they can depend on. Checking a proposed contract change against actual named consumers, rather than judging it purely from the feature's own perspective, targets a specific and easy mistake — a change that looks additive from inside the feature being built, such as adding an optional field, can still be a breaking change for a consumer that pattern-matches strictly on the previous shape or assumes an exhaustive set of cases, and that only becomes visible by actually checking the consumer's code, not by reasoning about the change in isolation from the side making it. Separating the contract from its implementation, and refusing to let implementation detail leak backward into the frozen shape, matters because a contract that accidentally encodes something about how the feature happens to be built internally is brittle in exactly the way a contract is not supposed to be — a later implementation change that was meant to be purely internal now has to also revisit the contract, reintroducing the coordination cost this whole process exists to avoid.
Verified against
Claude Code Sonnet 4.6 · 2026-07-30
Changelog
- 2026-07-30 — Initial publish, verified against Claude Code contract-first development (Sonnet 4.6).
Building this for real?
This is a free starting point. If you'd rather have custom software built and running for your business, that's Scult's day job.
EXPLORE CUSTOM SOFTWARE
