test-first-fix
Skill0 starsChanged 41 days agoMITView on GitHub
Prove a fix by making the failure observable before changing code. Use when fixing a bug, or changing existing behaviour; when deciding whether a test is worth writing and which one; when a test passes both before and after the change; when reviewing a diff and wondering what would catch a regression; or when a command returns exit 0 but printed nothing. Ships scripts/repro-check.mjs, which reports whether a command matched `--expect-fail` or `--expect-ok`, and can require a minimum `--min-bytes` or a `--require` substring.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- ceccopierangiolieugenio/pyTermTktheir own version, first seen Oct 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- ceccopierangiolieugenio/pyTermTk★ 921same 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 repository19 other files it gives its agents.
- api-doc-recallSkill
- assistant-runtime-architectureSkill
- code-disciplineSkill
- english-requestSkill
- github-repo-opsSkill
- git-safetySkill
- long-task-continuitySkill
- opencode-config-authoringSkill
- opencode-tool-outputSkill
- powershell-windowsSkill
- provider-reconnectSkill
- reference-booksSkill
- release-checklistSkill
- research-synthesisSkill
- self-improvementSkill
- skill-authoringSkill
- subagent-delegationSkill
- task-closureSkill
- troubleshooting-treeSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
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 26
Keep the check: Delete only if it cannot fail again.
- Distinctive: line 46
Assert the seam, not the whole: Prefer the smallest public entry point that still exercises the defect.
- Distinctive: line 57
Ask: what is the least code that runs the real thing and reports disagreement?
≈ “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
Test first, then fix
A fix is a claim: "this was the cause, and this resolves it." Before the edit, turn that claim into something a machine can disagree with. If you cannot make the failure appear, you do not yet know what you are fixing.
When to use this
- Fixing a bug, or changing behaviour other code already depends on.
- Deciding whether a change needs a test, and which one.
- A test passes both before and after your change, so it proves nothing.
- Reviewing a diff and asking what would catch a regression.
- A command exits 0 but produced no output, and you assumed it worked.
The order
- Reproduce first. Find the smallest input that shows the wrong behaviour.
- Pin it. Turn that input into a check that fails now, for the right reason.
- Fix.
- Watch the check flip, and confirm the reason flipped too.
- Keep the check. Delete only if it cannot fail again.
Steps 1 and 2 come first because a check written after the fix is shaped by the fix. It reproduces your reasoning rather than testing it, and it passes for reasons you already agree with.
Rules
- A check that passes before the change is not a test. It is a smoke test that will not notice the regression you are about to prevent. If you cannot watch it fail, you have not verified that it works.
- Watch it fail for the stated reason. "Red" is not enough. A check that fails on a typo in the test, or on a missing fixture, is red for the wrong reason and will mislead you. Read the failure message and confirm it names the defect.
- Test behaviour, not implementation. Assert on what a caller observes: return value, output, exit code, written file. An assertion that a mock was called a specific number of times fails on every refactor and catches no bug.
- One reason to fail. A check asserting five unrelated things reports only the first failure and hides the rest. Split them.
- Assert the seam, not the whole. Prefer the smallest public entry point that still exercises the defect. A full end-to-end run to check one branch is slow, so it will not get run.
- The regression case is the test. The valuable test is the exact input that broke, named after the defect, not a generic happy path added alongside.
- Empty output is a failure. Exit 0 with nothing on stdout is a bug that reports itself as success. Treat a missing or suspiciously short output as a failed check even when the exit code is 0.
Smallest useful check
Ask: what is the least code that runs the real thing and reports disagreement?
node scripts/repro-check.mjs --expect-fail --min-bytes 100 -- ./some-command--expect-fail— the bug must still be there.--expect-ok— the bug must be gone.--min-bytes N— catches "exited 0, printed nothing".--require "<text>"— the output must actually say the thing.--timeout <s>— default 120.
Exit codes: 0 expectation met, 1 expectation violated, 2 bad invocation.
--expect-fail before the fix and --expect-ok after is the whole discipline
in two commands. It fails loudly in the case that is easiest to fool yourself
about: a command that exits 0 and does nothing.
Not every change needs a test
| Change | Test? |
| Bug fix | yes, the exact reproduction |
| Behaviour others depend on | yes |
| Parsing, money, permissions, migrations | yes |
| Refactor with no behaviour change | only if existing tests miss the path |
| Typo in a comment or log message | no |
| Pure rename visible in one commit | no |
Writing a test for a typo is the same error as writing none for a bug: it spends attention where it buys nothing.
Checklist
- Reproduced the failure before editing anything
- The check failed first, and for the reason stated
- It asserts observable behaviour, not mock calls
- One reason to fail per check
- It flipped to passing after the fix
- Kept the check, and it can still fail
- Nothing asserts only that a command exited 0
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.

