| name | test-failure-analysis |
| description | Analyze failing tests before changing code. Distinguish implementation bugs, test bugs, flaky behavior, and environment problems, then explain the likely root cause. |
| owner | any |
| trigger | test_failure |
| version | 2 |
Test Failure Analysis
Use this when verification or test commands fail.
Workflow
- Read the first failing test and the surrounding error output carefully.
- Classify the failure:
- implementation bug
- outdated or incorrect test
- flaky or timing-sensitive behavior
- environment/configuration issue
- Reproduce the narrowest failing command when possible.
- Prefer implementation fixes over test edits unless the test is clearly wrong.
- If the failure is environmental or flaky, say that explicitly instead of forcing a code change.
- Report the likely root cause with file references and the next fix direction.
Output
For each failure, answer:
- what failed
- why it most likely failed
- whether code or test should change
- any evidence that the failure is flaky or environmental
Do not blindly rewrite tests just to get green.