← ClaudeAtlas

handle_test_failurelisted

Use this skill when the user pastes failing test output and wants to understand why the test is failing or how to fix it. Triggers on: pasted pytest/Jest/cargo test output, "this test is failing", "test is red", "assertion error in test", "why is this test failing?", "the test suite broke". This is distinct from production bugs — the code may work fine in production, but the test is asserting something that's wrong or the test itself is broken.
feralbureau/luminy · ★ 0 · AI & Automation · score 68
Install: claude install-skill feralbureau/luminy
# handle_test_failure A failing test tells you one of three things: the code is broken (the test found a real bug), the test is broken (the assertion is wrong), or the test environment is wrong (flaky, leaking state, wrong fixtures). Figuring out which one is step zero. ## Step 1: Read the Full Test Failure Don't just look at the error message — read the full failure output, which includes: 1. **Which test failed** — the test name tells you what behavior was being tested. 2. **The assertion** — what was expected vs. what was actual. 3. **The stack trace** — where in the code the failure occurred. **Pytest example:** ``` FAILED tests/test_order_service.py::test_apply_discount_reduces_total - AssertionError: assert Decimal('60.0') == Decimal('54.0') tests/test_order_service.py:45: AssertionError ____________________________ test_apply_discount_reduces_total _____________________________ def test_apply_discount_reduces_total(): order = Order(items=[Item(price=Decimal("60.0"))], coupon=Coupon(percentage=10)) > assert order.total == Decimal("54.0") E AssertionError: assert Decimal('60.0') == Decimal('54.0') ``` The test says: "order with a 10% coupon should have total $54, but got $60." This tells us the discount isn't being applied. ## Step 2: Determine — Is the Code Wrong, or the Test Wrong? This is the most important question. Ask: **Is the expected value correct?** - Re-derive the expected value from the business rule. If the order total is