← ClaudeAtlas

tests-that-catch-bugslisted

Use when adding, changing, or reviewing tests. Also use it when the user says "add a regression test", "write the test first", or "make sure this cannot break again". Writes a few tests that each name a bug and check the result where the user sees it. Expected values come from an independent source, and each test fails without the change. Test first is an ordering choice inside this skill. Not for checking finished work against the real command output (use `verify-and-review`).
theonly1me/shadowclone · ★ 26 · Code & Development · score 85
Install: claude install-skill theonly1me/shadowclone
# Tests That Catch Bugs ## Use when You add or change a test, you fix a bug, or the user asks for test first work. A test has value only if it fails when the behavior it guards breaks. Three tests that catch real bugs are better than ten tests that pass whatever the code does. ## Gates 1. Can you name the bug that the test catches, as a wrong output for a given input? If not, do not write the test. 2. Does the test check the result where the user sees it, such as the command output, the exit code, or a written file? If the symptom is at the command, a helper test alone does not count. 3. Does the expected value come from a source other than the code under test? Use the bug report, the specification, a value you calculated by hand, or a recorded real output. 4. Did you see the test fail without the change, for the reason you named, and then pass with the change? 5. Would the test fail if the code under test returned nothing, an empty list, or a constant? If not, make the test specific or delete it. 6. Is the final diff free of each temporary mutation and debug line? ## Process ### Choose the order - Test first: write the failing test before the change. Use this order when the user or a saved preference asks for it. Also use it when the behavior is new and you know its interface. Run the test and see it fail because the behavior is missing. - Fix first, then prove: use this order when the fix for a confirmed bug already exists. Write the test, then undo the smallest part