strict-tdd
Skill5 starsChanged 3 days agoMITView on GitHub
The full strict-TDD contract: RED/GREEN/REFACTOR discipline, per-layer scope (backend, frontend, infra), the setup-first rule for projects with no runner, the [tdd-gate] pre-flight block, why after-the-fact tests are forbidden. Invoke when starting any feature, bug fix or behavioural refactor, or when a project has no test runner configured yet.
7 other projects use a version of this.
Adopted by
Most recently taken up by
- bryceklinker/claude-skillstheir own version, first seen Nov 22, 2026
- alvaroofernaandez/avalword for word, first seen Nov 22, 2026
- muhamedsohaib/Tetherplanetheir own version, first seen Nov 15, 2026
- Echo-Scion/orioncortextheir own version, first seen Nov 8, 2026
- proffesor-for-testing/agentic-qetheir own version, first seen Oct 25, 2026
- Echo-Scion/portable-brainvibingtheir own version, first seen Oct 15, 2026
Used with
Projects with it also use systematic-debugging.
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.
OpenAISkillsystematic-debugging
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes
Also in 3 projects that use this
Other versions7 projects use a version of this.
Word for word · 1
- alvaroofernaandez/aval★ 5100% same
Edited · 0
None found.
Wrote their own version · 6
- proffesor-for-testing/agentic-qe★ 524same name
- Echo-Scion/orioncortex★ 2same name
- Echo-Scion/portable-brainvibing★ 2same name
- muhamedsohaib/Tetherplane★ 1same name
- vertz-dev/claude-code★ 1same name
- bryceklinker/claude-skills★ 0same name
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 repository36 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- aval-architectureSkill
- aval-docsSkill
- aval-release-notesSkill
- aval-releaseSkill
- aval-testingSkill
- accessibilitySkill
- ai-sdk-5Skill
- architecture-evidenceSkill
- branch-prSkill
- chained-prSkill
- cognitive-doc-designSkill
- design-pipelineSkill
- design-refactorSkill
- docker-build-optimizedSkill
- docker-space-optimizerSkill
- herdrSkill
- issue-creation-proSkill
- kiri-dockerSkill
- kiri-healthSkill
- laws-of-uxSkill
- lightpanda-browserSkill
- mac-disk-cleanupSkill
- pdf-reportSkill
- plan-deckSkill
- prs-proSkill
- react-19Skill
- readme-guardianSkill
- readme-portalSkill
- repo-prepSkill
- skill-creatorSkill
- tailwind-4Skill
- typescriptSkill
- work-unit-commitsSkill
- zod-4Skill
The file
We split this skill into the rules it gives an agent
11 rules. 0 are common, 9 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
9
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 22
Never invert this order. Never write the implementation first and "add tests later".
- Distinctive: line 28
Infra/Scripts: if logic is non-trivial, write tests.
- Distinctive: line 32
If a project has no test runner configured, your FIRST commit in that project is to bootstrap one (install deps, add config, write one …
- Very specific: line 36
Before writing implementation code, emit a [tdd-gate] block:
- Distinctive: line 44
If you cannot fill this block honestly, you are not allowed to write implementation code yet.
- Distinctive: line 56
Test at the lowest level that catches the regression, and assert through the public interface (output, exit code, return value, files …
- Distinctive: line 66
If a command cannot be tested in process, that is a design finding: make the entry point take its args, streams and env instead of reading …
- Very specific: line 86
No fixed sleeps. Inject a fake clock, or poll a condition with a deadline and fail with the last observed state.
- Distinctive: line 93
Run it alone and serially, then with the whole package.
- Distinctive: line 95
Never loosen an assertion, add a sleep or retry blindly until it passes.
- Distinctive: line 103
When you report a test run, state:
“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Strict TDD (MANDATORY for ALL projects — frontend AND backend)
This rule is STRICT and BLOCKING across every project, every language, every layer. There is no "TDD only when the project supports it" — if a project doesn't support TDD yet, you set it up first, then write code.
Iron law
For ANY new feature, bug fix, refactor with behavioral changes, or any code touching logic:
- RED — write the failing test first. The test MUST fail for the right reason (assertion failure, not import error).
- GREEN — write the minimum code that makes the test pass. Nothing more.
- REFACTOR — clean up while keeping the test green.
Never invert this order. Never write the implementation first and "add tests later". "Later" never comes; this is non-negotiable.
Scope (no exceptions)
- Backend: APIs, services, domain logic, data access, jobs, scripts → unit + integration tests via the project's runner (pytest, jest, vitest, go test, etc.).
- Frontend: components, hooks, stores, utilities, page logic → unit/component tests via the project's runner (vitest + RTL, jest + RTL, etc.). E2E with Playwright for critical user flows.
- Infra/Scripts: if logic is non-trivial, write tests. If truly one-shot and disposable, document why no test exists.
Setup-first rule
If a project has no test runner configured, your FIRST commit in that project is to bootstrap one (install deps, add config, write one passing smoke test). Only then do you start the requested work — RED → GREEN → REFACTOR.
Pre-flight check (emit before any implementation)
Before writing implementation code, emit a [tdd-gate] block:
[tdd-gate]
Runner: <pytest | vitest | jest | go test | …>
RED test: <path/to/test_file::test_name — what it asserts and why it must fail now>If you cannot fill this block honestly, you are not allowed to write implementation code yet.
After-the-fact tests are forbidden
Writing the code first and then "covering it with tests" is NOT TDD. It is regression testing of code you already trust — which means you skipped the design feedback that TDD provides. Do not do this. If you catch yourself doing it, STOP, delete the implementation, and restart from RED.
Testing checklist
The iron law says when to write a test. This is how to write a good one, in any language.
Levels
Test at the lowest level that catches the regression, and assert through the public interface (output, exit code, return value, files written), not private helpers.
| What you verify | Level |
| A parser, planner, mapping, renderer | Unit, pure, scratch in the framework's temp dir |
| A command or handler's behaviour | In process: call the entry function with args, input and output streams, env |
| Process startup: argv, exit code, PATH | One real-process smoke test per entry point (spawn the built binary or script once) |
| Repository rules: budgets, boundaries, docs | A repo-level guard test |
| Real browsers, terminals, services | e2e behind a tag or marker, kept out of the default run |
If a command cannot be tested in process, that is a design finding: make the entry point take its args, streams and env instead of reading globals, then test it directly.
Assert identity, not text
- Errors: assert the error's identity, never its message. Go:
errors.Isfor sentinels,errors.Asfor typed errors. TS/JS:instanceofor an errorcode. Python:pytest.raises(SpecificError)or a.code. If the code returns only a string, add a sentinel, class or code first (RED), then assert it. - User-facing text is pinned in one place (a single messages test or snapshot). Logic tests assert data, not sentences, so rewording a message breaks one test, not forty.
- One reason to fail per test. Prefer in-memory fakes that behave like the real thing over mocks that assert call order.
if !errors.Is(err, ErrNotFound) { t.Fatalf("want ErrNotFound, got %v", err) }await expect(load("x")).rejects.toMatchObject({ code: "NOT_FOUND" });with pytest.raises(NotFoundError): load("x")Determinism
- No fixed sleeps. Inject a fake clock, or poll a condition with a deadline and fail with the last observed state.
sleep(100)is a guess that is wrong on a loaded machine. - Scratch only in the framework's temp dir (
t.TempDir(),tmp_path,fs.mkdtempunderos.tmpdir()cleaned in teardown). Never write into the repo,$HOMEor a fixed/tmpname; set env through the framework's scoped helper (t.Setenv,monkeypatch,vi.stubEnv). - Goldens are regenerated by a flag, never by hand; mask times, durations, absolute paths and versions before comparing.
Flake protocol
- Reproduce by repeating it:
go test -race -count=20 -run '^TestX$',pytest --count=20 -k x,vitest --repeat 20. - Run it alone and serially, then with the whole package. A test that passes alone but fails in parallel is a finding (shared env, ports, files, globals), not noise.
- Find the mechanism. Often the code has a real race: make it deterministic (hold an event back, a fake that answers late) to get a RED that fails every run, then fix the code.
- Never loosen an assertion, add a sleep or retry blindly until it passes.
Differential check
Before finishing a change to a command, compare it with the base commit. Build the base in a separate worktree, run both builds with the same args and the same throwaway home and fixtures, and diff stdout, stderr and exit code. A sibling command that shares code you touched must behave as before. Every difference you did not intend is a regression: fix it and pin it with a test. Committed tests never read git history; this check is a one-off you run.
Output contract
When you report a test run, state:
- What ran: the exact command, exit code, pass, fail and skip counts.
- What did not run, and why: a tag not set, a missing tool, another OS. Skipped is not passed.
- Failures: the test name and the output tail, not a paraphrase.
- TDD evidence: the RED line (the failing assertion) and the GREEN output for each rule, plus the differential result.
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.

