~/.claude/skills/test-fixer/SKILL.mdTest Fixer
When tests fail, analyzes the failure, determines if the test or the code is wrong, and fixes the right one.
--- name: test-fixer description: | Diagnoses and fixes failing tests by determining whether the test or the code is wrong. IMPORTANT: Activate this skill whenever the user says "tests are failing", "fix the tests", "test failure", or "broken tests". This skill MUST be used for all test failure diagnosis requests. --- # Test Fixer When tests fail, this skill determines the root cause: is the test wrong, or is the code wrong? Then it fixes the correct one. Prevents the common mistake of making tests pass by weakening assertions. **Trigger:** Say any of these to activate this skill: - "tests are failing" - "fix the tests" - "this test is broken" - "Use skill: test fixer" **How It Works:** 1. Run the failing test(s) and capture the full error output 2. Read the test file and the source file it tests 3. Compare the test's expectations against the actual behavior of the code 4. Determine: is the test asserting the wrong thing, or is the code producing wrong output? 5. If the code changed intentionally (feature update), update the test to match new behavior 6. If the code has a bug, fix the code and verify the test now passes 7. Run the full test suite to ensure no regressions 8. Explain what was wrong and what was fixed **Guidelines:** - Never make a test pass by removing assertions or weakening checks - If the code was intentionally changed, update the test (don't revert the code) - If the code has a bug, fix the bug (don't change the test) - When unclear, check git history to see what changed recently - Always run the full test suite after fixing, not just the single test **Works With:** - Best with: Claude Code CLI (can run tests, read diffs, and iterate) - Also works: Cursor, Windsurf (paste the error output manually) - Expects: A project with a test suite and a recent test failure **Output Format:** - Diagnosis: what broke and why - Fix applied to either the test or the source code - Verification: all tests passing
When tests fail, this skill determines the root cause: is the test wrong, or is the code wrong? Then it fixes the correct one. Prevents the common mistake of making tests pass by weakening assertions.
Say any of these to activate this skill: - "tests are failing" - "fix the tests" - "this test is broken" - "Use skill: test fixer"
1. Run the failing test(s) and capture the full error output 2. Read the test file and the source file it tests 3. Compare the test's expectations against the actual behavior of the code 4. Determine: is the test asserting the wrong thing, or is the code producing wrong output? 5. If the code changed intentionally (feature update), update the test to match new behavior 6. If the code has a bug, fix the code and verify the test now passes 7. Run the full test suite to ensure no regressions 8. Explain what was wrong and what was fixed
- Never make a test pass by removing assertions or weakening checks
- If the code was intentionally changed, update the test (don't revert the code)
- If the code has a bug, fix the bug (don't change the test)
- When unclear, check git history to see what changed recently
- Always run the full test suite after fixing, not just the single test
- Best with: Claude Code CLI (can run tests, read diffs, and iterate)
- Also works: Cursor, Windsurf (paste the error output manually)
- Expects: A project with a test suite and a recent test failure
- Diagnosis: what broke and why
- Fix applied to either the test or the source code
- Verification: all tests passing