spec-before-code
Skill3 starsChanged 17 days agoMITView on GitHub
Keep a written specification ahead of the implementation it governs. Documents change first and code follows; holes the implementation exposes are written back as rules rather than patched silently; overturned conclusions move to an appendix instead of being deleted. Use when a project has a spec that code is supposed to obey, and change requests are arriving.
In this repository15 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- constraint-by-typesSkill
- decision-interviewSkill
- decision-recordSkill
- deliverable-languageSkill
- ui-contract-assetsSkill
- ui-contract-auditSkill
- ui-contract-baselineSkill
- ui-contract-designSkill
- ui-contract-enforceSkill
- ui-contract-glossarySkill
- ui-contract-layoutSkill
- ui-contract-setupSkill
- ui-contractSkill
- ui-contract-wireframeSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Documents change first, code follows: Always.
- Distinctive: line 30
If you discover mid-implementation that something you said earlier was inaccurate — you promised a property the design can't actually …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Spec before code
The spec is a constraint on future work, not a description of existing work. The moment code leads and the document follows, it has quietly become the latter.
Handling a change request
Once the user sees something running, change requests arrive. For each one:
- First judge whether it belongs in the spec at all. Recording "right-align it" or "add a button" verbatim is nearly worthless; the value is in the rule it forces. Ask: what constraint is behind this request, and would it still hold under different surface choices?
- Name the existing clause it collides with. New requests frequently contradict prohibitions you wrote yourself — surface that, then change the prohibition or the request. Never let both stand.
- Documents change first, code follows. Always.
- When overturning an old conclusion, don't delete it. Move it to the Overturned appendix with the reasoning, or to a decision record. Which of the two, and why the appendix is allowed to exist at all, is
decision-record's call — not restated here, because the reason moved there and a second copy of it would drift. - Report precisely what changed: which sections, which new prohibitions, what followed in the code.
Building the thing exposes the spec's holes
This is the part people skip. Implementing a spec surfaces questions the spec never answered — a case that was never decided, a combination nobody walked through. That exposure is the point, not an interruption.
When it happens: write the rule into the document first, then write the code. Never quietly add a rule to the code that the document doesn't state. A rule that lives only in code is a rule the next agent will overwrite without knowing it existed.
(Detecting drift after the fact is a different job with a different owner. This skill is only about staying ahead of it while you work.)
When you were wrong earlier
If you discover mid-implementation that something you said earlier was inaccurate — you promised a property the design can't actually deliver, say — say so and correct it. Do not leave the wrong conclusion standing in the document because correcting it is awkward.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

