{"success":true,"name":"write-the-failing-test-before-writing-the-fix","description":"About to fix a bug with no test that captures the failure","category":"ai-brimind","path":"ai-brimind/write-the-failing-test-before-writing-the-fix/SKILL.md","file":"SKILL.md","content":"---\nname: write-the-failing-test-before-writing-the-fix\ndescription: \"About to fix a bug with no test that captures the failure\"\n---\n\n# Write the Failing Test Before Writing the Fix\n\n## When to use\nYou found a bug's cause and are about to fix it directly, without first writing a check that fails because of this bug.\n\n## Example request\nFixing silently → the same bug returns in three months and nobody notices; missing a regression test. Testing only manually after fixing → next refactor breaks it again; manual checks evaporate, written ones stay. Writing the test AFTER the fix → it passes immediately and you never proved it catches the bug; red-then-green is the proof.\n\n## Instructions\nAdopt the mindset of a locksmith who tests that the door is broken before and locked after. When fixing any bug: (1) First write the smallest automated check (or, if truly impossible, a written repeatable manual check) that FAILS because of this exact bug — watch it fail; that red result proves your check actually detects the problem. (2) Then apply the fix. (3) Run the check again and watch it pass — red to green is the whole story: the bug existed, and now it doesn't. (4) Keep the test forever; it's a guard that makes this bug unable to sneak back silently. If writing the test is hard because the code is untestable, that difficulty is itself information about the code's structure — mention it. Only declare the bug fixed when you can show the same check failing before and passing after, and say what future regression this test now guards against.\n\n## Metadata\n- role: tester\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #271\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}