prefix-failure-verification
Skill9 starsChanged 45 days agoApache-2.0View on GitHub
Prove a new regression test actually fails on the pre-fix code, without reverting files or checking out the parent commit. Use for any bug-fix PR in core-agent before opening it. Covers the patch-the-behaviour-back method, why the obvious methods do not work, predicting the failure list, and restoring cleanly.
In this repository10 other files it gives its agents.
- .agents/AGENTS.mdAGENTS.md
- AGENTS.mdAGENTS.md
- .agents/reviewer/AGENTS.mdAGENTS.md
- adversarial-review-gateSkill
- changelog-bulletSkill
- presubmit-sweepSkill
- stacked-pr-orderSkill
- autonomous-setupSkill
- cli-setupSkill
- library-embeddingSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is 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.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 20
Do not
git checkout -- <files>to undo the patch: If the fix is not committed yet, HEAD is the pre-fix state and that command destroys … - Distinctive: line 43
Run the suite. Record the exact failure lines verbatim — they go in the PR body.
- Distinctive: line 62
When the change adds a *check* rather than fixes a behaviour, the equivalent step is mutation: break the tree on purpose in the way the …
- Distinctive: line 69
Do both if the change does both.
≈ “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
Proving the test fails before the fix
A test that passes on the buggy code is documentation, not a gate. This exact failure has shipped in a downstream release, which is why every bug-fix PR here records the pre-fix failure.
Do not do it the obvious way
Do not revert the production files. Do not check out the parent commit. Once the fix introduced a new const, type, field or signature, the test no longer compiles against pre-fix sources — and a compile error is not evidence about an assertion. You will have proved that the file changed, which you already knew.
Do not git checkout -- <files> to undo the patch. If the fix is not
committed yet, HEAD is the pre-fix state and that command destroys the fix
itself. Restore from copies you made, or apply the inverse of the patch
script.
The method that works
Used on #935, #974, #1036, #1137.
- Predict the failure list first, in writing. Which tests, and roughly what each will say. A prediction you write afterwards is a description.
- Copy each production file you are about to touch aside
(
cp pkg/agent/foo.go /tmp/foo.bak). Patch the behaviour back inside the new code, leaving every new symbol in place so the package still builds. Silence "declared and not used" with
_ = theSymbol. Mark every site:// PREFIX BEHAVIOUR: #1137 — front-slot id removed, this is the #1136 splice.A script is better than hand edits here, because you need the inverse later and because you want the count to be exact.
- Run the suite. Record the exact failure lines verbatim — they go in the PR body.
- Restore from the copies.
- Prove the restore:
grep -rn "PREFIX BEHAVIOUR" pkg/must return nothing, andgit diffagainst the staged tree must be empty. A test-cache hit on the re-run is good evidence the restore was byte-identical.
Compare prediction to measurement
Say which tests failed and whether that matched. If a test you expected to fail passed, that is the finding — it means the test does not exercise what you thought, and it is worth more than the rest of the exercise.
A pure-function or boundary test that legitimately passes both ways is fine. Declare it in the PR as "passes before and after, by design" rather than quietly omitting it from the list.
Mutation, for a guard rather than a bug fix
When the change adds a check rather than fixes a behaviour, the equivalent step is mutation: break the tree on purpose in the way the check exists to catch, confirm the check fires on the right line with the right message, restore, verify the restore. Assert the message, not just the failure — a check that fires for the wrong reason passes this exercise while catching nothing.
Do both if the change does both.
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.

