.claude/skills/test-failure-investigator/SKILL.md
Use when a test is failing and you need to determine root cause: is it flaky, an environment issue, or a real regression? Traces failure from symptom to fix.
npx skillsauth add proffesor-for-testing/agentic-qe test-failure-investigatorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Runbook-style skill for systematic test failure investigation. Given a failing test, determines root cause and recommends action.
/test-failure-investigator [test-name-or-file]
Run the test 3 times and classify:
| Result Pattern | Classification | Action | |---------------|---------------|--------| | Fails consistently | Regression or Environment | Continue to Step 2 | | Fails intermittently | Flaky | Skip to Step 4 | | Passes now | Transient | Check CI logs, environment diff |
# Run test 3 times
for i in 1 2 3; do npx jest {{test_file}} 2>&1 | tail -5; echo "--- Run $i ---"; done
# When did it start failing?
git log --oneline -20 -- {{related_source_files}}
# What changed recently?
git diff HEAD~5 -- {{related_source_files}}
# Does it fail in isolation?
npx jest {{test_file}} --testNamePattern="{{test_name}}"
# Does it fail with other tests?
npx jest --runInBand # sequential execution
| Symptom | Likely Cause | Investigation |
|---------|-------------|--------------|
| Timeout | Network/DB dependency | Check external service availability |
| Assertion mismatch | Logic change | Compare expected vs actual, check git blame |
| Import error | Dependency change | Check package.json changes, run npm ci |
| Permission denied | Environment | Check file permissions, Docker volumes |
| Out of memory | Resource leak | Profile with --detectOpenHandles |
# Run 10 times to confirm flakiness
for i in $(seq 1 10); do npx jest {{test_file}} --forceExit 2>&1 | grep -E 'PASS|FAIL'; done
# Common flaky causes:
# - Shared state between tests (missing cleanup)
# - Time-dependent assertions (use fake timers)
# - Race conditions (missing await)
# - Port conflicts (use random ports)
# - Order dependency (run with --randomize)
## Test Failure Report
- **Test**: {{test_name}}
- **File**: {{test_file}}
- **Classification**: Regression / Flaky / Environment / Transient
- **Root Cause**: {{description}}
- **First Failed**: {{commit_hash}} ({{date}})
- **Fix**: {{recommended_action}}
- **Verified**: [ ] Fix applied and test passes 3x consecutively
After investigation, compose with:
/bug-reporting-excellence — if regression found, file a bug report/regression-testing — if regression, add to regression suite/qe-test-execution — for re-running tests after fixdevelopment
Apply XP practices including pair programming, ensemble programming, continuous integration, and sustainable pace. Use when implementing agile development practices, improving team collaboration, or adopting technical excellence practices.
development
Warehouse Management System testing patterns for inventory operations, pick/pack/ship workflows, wave management, EDI X12/EDIFACT compliance, RF/barcode scanning, and WMS-ERP integration. Use when testing WMS platforms (Blue Yonder, Manhattan, SAP EWM).
testing
Advanced visual regression testing with pixel-perfect comparison, AI-powered diff analysis, responsive design validation, and cross-browser visual consistency. Use when detecting UI regressions, validating designs, or ensuring visual consistency.
development
Comprehensive truth scoring, code quality verification, and automatic rollback system with 0.95 accuracy threshold for ensuring high-quality agent outputs and codebase reliability.