A Claude Code slash command for debugging and fixing failing tests.
# Clone to your preferred location
git clone git@github.com:claude-commands/command-failing-tests.git <clone-path>/command-failing-tests
# Symlink (use full path to cloned repo)
ln -s <clone-path>/command-failing-tests/failing-tests.md ~/.claude/commands/failing-tests.md/failing-tests # Run all tests, analyze failures
/failing-tests auth # Run only auth-related tests
/failing-tests --flaky # Identify flaky tests
/failing-tests --fix # Auto-fix simple failures
- Runs tests and captures failures
- Parses error messages and stack traces
- Analyzes root causes
- Categorizes by fix type
- Suggests or applies fixes
- Verifies fixes pass
# Test Failure Analysis
## Summary
- Total: 150 | Passing: 142 | Failing: 8
## Failures
| Test | Error | Root Cause |
|------|-------|------------|
| auth/login | 401 != 200 | Mock not setup |
## Detailed Analysis
### auth/login.test.ts
**Error**: Expected 200, Received 401
**Fix**: Update mock to return valid token| Category | Example | Fix Type |
|---|---|---|
| Assertion | Wrong expected value | Update test |
| Implementation | Code bug | Fix source |
| Environment | Missing env var | Fix setup |
| Flaky | Race condition | Fix timing |
| Framework | Command | Notes |
|---|---|---|
| Jest | npx jest | --json output |
| Vitest | npx vitest | --reporter=json |
| Go | go test | -json flag |
| pytest | pytest | --tb=short |
- Git repository with tests
- Test framework installed
- Claude Code with Opus 4.5 model access
cd <clone-path>/command-failing-tests && git pull