test-driven-slices
Skill1 starsChanged 13 days agoMITView on GitHub
Use whenever writing tests or making tests pass, for red-green-refactor one behaviour at a time through agreed public seams, with rules that separate tests that prove behaviour from tests that only look busy.
In this repository17 other files it gives its agents.
- AGENTS.mdAGENTS.md
- project-skeleton/AGENTS.mdAGENTS.md
- adversarial-attackSkill
- agent-authoring-guideSkill
- docs-writingSkill
- glossary-and-decisionsSkill
- handoffSkill
- independent-reviewSkill
- performance-reviewSkill
- process-retrospectiveSkill
- pull-request-evidenceSkill
- release-processSkill
- requirements-interviewSkill
- resume-sessionSkill
- slice-into-tasksSkill
- systematic-debuggingSkill
- threat-checkSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
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 13
Refactor: only on green. Improve names and structure, and re-run after each change.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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
Test-driven slices
The loop
- Red: one test, for one behaviour, at an agreed seam. Run it and watch it fail for the right reason: the behaviour is missing, not a typo or a fixture error.
- Green: the least code that makes it pass. No options, branches or abstractions that no test asks for yet.
- Refactor: only on green. Improve names and structure, and re-run after each change.
- Repeat for the next behaviour. One slice at a time: each test teaches you something that shapes the next one.
In this kit the work is split across two roles. The test-designer writes the acceptance tests for a task slice (one per AC) before implementation, and locks them. The implementer then runs the inner loop above, adding their own small unit tests as needed. Writing every test for the whole spec up front is avoided: tests written far ahead of the code tend to pin imagined behaviour.
Seams
Agree the seam (the public interface a test calls) before writing the test, and record what it catches and misses. Prefer the highest seam that still runs fast and deterministically.
A good test
- Calls only the public interface, and asserts observable behaviour: return values, emitted events, persisted state read back through the public interface, and errors.
- Reads like a line of the spec, with the AC id and the behaviour in the name.
- Takes its expected values from an independent source: the spec, a worked example by hand, or a known-good literal.
- Survives a refactor that keeps the behaviour.
- Is deterministic: it controls the clock, randomness, ordering and I/O.
Smells to reject
| Smell | Sign | Instead |
| Tautological | The expected value is computed with the same logic as the code | Hard-code the value from the spec or a worked example |
| Implementation-coupled | Mocks internal collaborators, calls private functions, or checks a side channel | Go through the seam, and assert the outcome |
| Over-mocked | More mock setup than assertions; mocks of your own modules | Fake only at process edges: network, clock, randomness, external services |
| Assertion-free | It "passes" because nothing threw | Assert the specific outcome |
| Snapshot dump | A large snapshot accepted without reading it | Assert the few fields that matter |
| Flaky | It passes on re-run | Hand it to the debugger. It is a bug in the test or the code |
Done when
- The test was seen failing first, and the failure reason is recorded.
- The test passes with the smallest implementation.
- Nobody can delete the behaviour and keep the test green. Mutation testing checks this in CI.
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.

