Spec-driven development: agents and people read from one source

My answer to that is spec-driven development. The first thing you learn working with a coding agent is that it has no memory. Every session starts from zero. Yesterday you told it "a cancelled order no longer goes back to the wallet", and today it has forgotten. If the system's behaviour lives only in people's heads, the agent has to guess, and an agent's guess is usually reasonable and wrong.
In SimaCMS the answer is simple: every capability has a spec. They live under specs/, from the store and bookings to attendance and cheques. Each says what the system does, not how.
What a spec looks like
A spec is a set of Requirements, each with a few Scenarios in the familiar GIVEN / WHEN / THEN shape. The résumé spec says, for example, "the contact form stores before it notifies": if sending the email fails, the message is not lost. The sentence names no class and no table, yet anyone about to touch the contact form, person or agent, knows what must not break.
One rule matters a lot: a spec only names files that exist. A CI guard checks every path a spec mentions; if a file was deleted or moved, the PR goes red. Documents don't quietly rot.
Where a behaviour change goes
A decision that changes behaviour and has a real rejected alternative goes through OpenSpec: proposal (why), design (the options and the pick), tasks, and finally archive. Archiving merges the change's spec deltas into the main spec.
Not everything needs that ceremony. A bug fix or a small errand is just a PR. The test: "if someone asks in six months why it works this way, where is the answer?" If the answer matters, OpenSpec; if not, the commit message is enough.
Every sentence has one home
The biggest lesson: the problem isn't too little documentation, it's duplicated documentation. A rule written in the README, a code comment and a spec has three different versions after three months. So each sentence has exactly one home, chosen by its reader:
- someone changing this file: the file's docblock (contract, invariant, local traps);
- someone asking what the capability does: the spec;
- someone asking why: the archived OpenSpec change.
My test: "if this paragraph moved to the spec, would someone editing this file lose anything?" If not, it belongs in the spec.
When code and documents disagree
The code wins. Always, because the code is what actually runs. But the document is fixed the same day, in the same PR. A PR that changes behaviour updates the spec; a PR that adds or removes a customer-facing feature updates the feature list too, and a guard checks that.
What spec-driven development bought me
When I rewrote the SimaCMS backend from Laravel to Go, the specs saved me. I didn't have to guess from old code what a capability did exactly; the spec said so. Agents rebuilt each capability from its spec, and the scenarios became the checklist that nothing was dropped.
The same goes for a new teammate: instead of a week of asking around, they read the spec of the capability they're working on. Agents and people read from one source, and "only so-and-so knows" disappears.
Spec-driven development pairs with a short CLAUDE.md and path-scoped rules. The tool I use for specs is OpenSpec.
Comments
Sign in to leave a comment.
Sign inLoading…



