Run tests and systematically fix all failing tests using smart error grouping. Use when user asks to fix failing tests, mentions test failures, runs test suite and failures occur, or requests to make tests pass.
Add this skill
npx mdskills install sickn33/test-fixingWell-structured systematic approach with smart grouping strategy and clear prioritization.
1---2name: test-fixing3description: Run tests and systematically fix all failing tests using smart error grouping. Use when user asks to fix failing tests, mentions test failures, runs test suite and failures occur, or requests to make tests pass.4---56# Test Fixing78Systematically identify and fix all failing tests using smart grouping strategies.910## When to Use1112- Explicitly asks to fix tests ("fix these tests", "make tests pass")13- Reports test failures ("tests are failing", "test suite is broken")14- Completes implementation and wants tests passing15- Mentions CI/CD failures due to tests1617## Systematic Approach1819### 1. Initial Test Run2021Run `make test` to identify all failing tests.2223Analyze output for:2425- Total number of failures26- Error types and patterns27- Affected modules/files2829### 2. Smart Error Grouping3031Group similar failures by:3233- **Error type**: ImportError, AttributeError, AssertionError, etc.34- **Module/file**: Same file causing multiple test failure35- **Root cause**: Missing dependencies, API changes, refactoring impacts3637Prioritize groups by:3839- Number of affected tests (highest impact first)40- Dependency order (fix infrastructure before functionality)4142### 3. Systematic Fixing Process4344For each group (starting with highest impact):45461. **Identify root cause**4748 - Read relevant code49 - Check recent changes with `git diff`50 - Understand the error pattern51522. **Implement fix**5354 - Use Edit tool for code changes55 - Follow project conventions (see CLAUDE.md)56 - Make minimal, focused changes57583. **Verify fix**5960 - Run subset of tests for this group61 - Use pytest markers or file patterns:62 ```bash63 uv run pytest tests/path/to/test_file.py -v64 uv run pytest -k "pattern" -v65 ```66 - Ensure group passes before moving on67684. **Move to next group**6970### 4. Fix Order Strategy7172**Infrastructure first:**7374- Import errors75- Missing dependencies76- Configuration issues7778**Then API changes:**7980- Function signature changes81- Module reorganization82- Renamed variables/functions8384**Finally, logic issues:**8586- Assertion failures87- Business logic bugs88- Edge case handling8990### 5. Final Verification9192After all groups fixed:9394- Run complete test suite: `make test`95- Verify no regressions96- Check test coverage remains intact9798## Best Practices99100- Fix one group at a time101- Run focused tests after each fix102- Use `git diff` to understand recent changes103- Look for patterns in failures104- Don't move to next group until current passes105- Keep changes minimal and focused106107## Example Workflow108109User: "The tests are failing after my refactor"1101111. Run `make test` → 15 failures identified1122. Group errors:113 - 8 ImportErrors (module renamed)114 - 5 AttributeErrors (function signature changed)115 - 2 AssertionErrors (logic bugs)1163. Fix ImportErrors first → Run subset → Verify1174. Fix AttributeErrors → Run subset → Verify1185. Fix AssertionErrors → Run subset → Verify1196. Run full suite → All pass ✓120
Full transparency — inspect the skill content before installing.