test-first
Skill0 starsChanged 37 days agoMITView on GitHub
Build and fix test-first at seams agreed in advance: write the failing test, write only enough code to pass it, take expected values from an independent source rather than from the code, mock only at system boundaries, gate every commit on exit codes, run suites one at a time against shared state, and enumerate the branches before repairing a failing test. Triggers on: "TDD", "test first", "red green", "write a failing test", "add tests", "integration test", "fix the test", "the test is flaky", "coverage", "what should we test".
26 other projects use a version of this.
Adopted by
Most recently taken up by
- iaintsaket/how-saket-claudestheir own version, first seen Nov 15, 2026
- llopresto87/Cypresstheir own version, first seen Nov 11, 2026
- TheLunchTrae/claude-code-configstheir own version, first seen Nov 8, 2026
- sergvss/agents-best-teamstheir own version, first seen Nov 1, 2026
- JordanCoin/codemaptheir own version, first seen Nov 1, 2026
- claude-world/director-mode-litetheir own version, first seen Nov 1, 2026
Used with
Projects with it also use security-sweep, refactor and 3 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
n24q02mSkillsecurity-sweep
Graph-driven security sweep -- scan for dangerous sinks, then rank each finding by whether an entry point can actually reach it, and triage the rest into suppressions.
Also in 3 projects that use this
GitHubSkillrefactor
Surgical code refactoring to improve maintainability without changing behavior. Covers extracting functions, renaming variables, breaking down god functions, improving type safety, eliminating code smells, and applying design patterns. Less drastic than repo-rebuilder; use for gradual improvements.
Also in 4 projects that use this
MicrosoftSkillapi-design
Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.
Also in 3 projects that use this
GoogleSkillcode-review
Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.
Also in 4 projects that use this
SentrySkillskill-creator
Create new agent skills following the Agent Skills specification. Use when asked to "create a skill", "add a new skill", "write a skill", "make a skill", "build a skill", or scaffold a new skill with SKILL.md. Guides through requirements, writing, registration, and verification.
Also in 3 projects that use this
Other versions26 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 26
- JordanCoin/codemap★ 715same name
- llopresto87/Cypress★ 121same name
- NoobyGains/godmode★ 120same name
- claude-world/director-mode-lite★ 80same name
- bmtrnavsky/disciplined-vibe-coding★ 19same name
- s-hiraoku/synapse-a2a★ 17same name
- dfedoryshchev/weftworks★ 5same name
- eeshsaxena/agent-skills★ 2same name
- iaintsaket/how-saket-claudes★ 2same name
- sergvss/agents-best-teams★ 2same name
16 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository11 other files it gives its agents.
- AGENTS.mdAGENTS.md
- cut-ticketsSkill
- decision-recordsSkill
- deep-modulesSkill
- evidenceSkill
- grill-planSkill
- plain-voiceSkill
- plan-projectSkill
- review-changeSkill
- setup-conventionsSkill
- thin-slicesSkill
The file
Files
Test first
The loop is red then green. These rules make the loop produce tests worth keeping. Every section applies on every cycle. Read the glossary first so test names use the project's words.
The rules
| Id | Rule | In practice |
| TEST-1 | Seams agreed before tests | Write down the seams under test and confirm them with the decider. Each proposed seam gets one line on what it catches and what it misses. No test at an unconfirmed seam. |
| TEST-2 | Red before green | The failing test first, then only enough code to pass it. One seam, one test, one minimal implementation per cycle. No speculative features. A refactor is its own slice after green (SLICE-3), not part of the loop. |
| TEST-3 | Expected values from an independent source | A known-good literal, a worked example, the specification, with the derivation in the test. Never expect(add(a, b)).toBe(a + b). A test that asserts only a range or a sign is the class that let wrong figures through a passing suite. |
| TEST-4 | Mock only at system boundaries | External services, time, randomness, the file system. Never the code under test, pure functions, value objects or internal collaborators. Inject boundaries; prefer one function per external operation over a generic fetcher. |
| TEST-5 | Gate on exit codes | check && test first; the commit follows on its own go-ahead, gated on the exit codes (just check && git commit once the yes is given). A check whose failure is printed and ignored gates nothing. After a pass on unchanged code, do not re-run for reassurance (SLICE-4). |
| TEST-6 | Suites one at a time against shared state | A number that moves between identical runs is a harness artefact (EVID-5). Run suites that share a database one at a time; compare named failures, not counts. |
| TEST-7 | Enumerate branches before repairing | List the branches the code takes before touching a failing test. A better-shaped test often beats a patched one. Confirm with the mutation check (REVIEW-4). |
What a good test is
It verifies behaviour through the public interface (DESIGN-2). It reads like a specification:
"user can check out with a valid cart" says what capability exists, and survives refactors
because it does not care about internal structure. Examples and anti-patterns are in
references/good-and-bad-tests.md.
Anti-patterns
- Implementation-coupled: mocks internal collaborators, tests private methods, verifies through a side channel. The tell: it breaks on a refactor that changed no behaviour.
- Tautological: the assertion recomputes the expected value the way the code does.
- Horizontal slicing: all tests first, then all implementation. Tests of imagined behaviour go insensitive to real changes. Work in vertical slices: one test, one implementation, repeat.
Companion skills
| Need | Skill |
| Where the seam belongs | invoke deep-modules first when the interface is in question |
| The mutation check and the review of tests | review-change |
| Landing each cycle as a reviewable piece | thin-slices |
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.

