test-and-fix
Skill2 starsChanged 8 months agoApache-2.0View on GitHub
Run the test suite, analyze failures, and auto-fix the failing code. Iterates up to 3 times until green or reports what remains broken.
6 other projects use a version of this.
Adopted by
Most recently taken up by
- Lucface/claude-skillstheir own version, first seen Nov 16, 2026
- LucasCooperBey/claude-skillstheir own version, first seen Oct 20, 2026
- prasadmogulothu/agent-skillstheir own version, first seen Jun 28, 2026
- renatorozas/claude-code-configtheir own version, first seen Mar 19, 2026
- yu-iskw/coding-agent-fabrictheir own version, first seen Feb 5, 2026
- yu-iskw/skill-inspectortheir own version, first seen Jan 23, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- yu-iskw/skill-inspector★ 2same name
- LucasCooperBey/claude-skills★ 1same name
- Lucface/claude-skills★ 1same name
- renatorozas/claude-code-config★ 1same name
- yu-iskw/coding-agent-fabric★ 1same name
- prasadmogulothu/agent-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
Show its rules and text
We split this skill into the rules it gives an agent
20 rules. 0 are common, 17 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
17
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Run the test suite, identify failures, and fix them automatically.
- Distinctive: line 30
If the user provided a framework hint, use that instead of auto-detection.
- Distinctive: line 32
If a specific test file was provided, scope the run:
- Distinctive: line 45
Run the test suite and capture the full output.
- Distinctive: line 59
If all tests pass: skip to Phase 5 (report success).
- Distinctive: line 61
If tests fail: record the failures and proceed to Phase 3.
- Distinctive: line 78
If you must change a test, explain why and flag it in the report.
- Distinctive: line 81
Run lint: after each fix to ensure no new warnings.
- Distinctive: line 93
Maximum 3 iterations: If tests still fail after 3 fix attempts, escalate — don't just report.
- Distinctive: line 101
If 3 fix attempts fail, the problem is likely deeper than a simple bug.
- Distinctive: line 105
If Architect identifies a design issue → report to user with Architect's analysis and recommended redesign.
- Distinctive: line 106
If Architect says implementation is correct and tests are wrong → fix the tests (flag clearly in report).
- Distinctive: line 107
If Architect can't determine → report ESCALATING to user with full context.
- Distinctive: line 157
After pulling changes that might have broken tests
- Distinctive: line 158
After a refactor to catch and fix any regressions
- Distinctive: line 159
When CI is red and you want to auto-fix locally
- Very specific: line 161
Before /commit-push-pr to ensure a clean commit
- Very specific: line 165
When you want to write new tests first (use /tdd instead)
- Very specific: line 166
When you only want to verify without fixing (use /prove-it instead)
- Distinctive: line 167
When the test failures are intentional (e.g.
“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Test and Fix
Run the test suite, identify failures, and fix them automatically. Fixes target the source code, not the tests — unless the tests themselves are demonstrably wrong.
Input: Optional arguments — a specific test file, test name pattern (e.g. test_parse_cert), or language/framework hint (e.g. pytest, cargo). If omitted, auto-detects everything.
Phase 1 — Detect Project and Test Framework
Scan the project root to determine the language and test runner:
| Signal | Framework | Run Command |
Cargo.toml | Rust / cargo | cargo test |
pyproject.toml, pytest.ini, setup.py, requirements.txt | Python / pytest | pytest -v |
bun.lockb, bunfig.toml | TypeScript / bun | bun test |
package.json (has test script) | Node / npm | npm test |
go.mod | Go | go test ./... |
Makefile (has test target) | Make-based | make test |
*.bats files in test/ or tests/ | Shell / BATS | bats test/ |
If the user provided a framework hint, use that instead of auto-detection.
If a specific test file was provided, scope the run:
- cargo:
cargo test --test <name>or filter withcargo test <pattern> - pytest:
pytest -v <file>orpytest -v -k "<pattern>" - bun:
bun test <file> - npm: pass pattern via
npm test -- --grep "<pattern>"if supported - go:
go test -run "<pattern>" ./...
DETECT checkpoint: Language=[X], Framework=[Y], Command=[Z], Scope=[all | filtered]Phase 2 — Run Tests (Attempt 1)
Run the test suite and capture the full output.
# Example for Rust
cargo test 2>&1
# Example for Python
pytest -v 2>&1Also run the linter if applicable:
- Rust:
cargo clippy -- -D warnings 2>&1 - Python:
ruff check . 2>&1 - Shell:
shellcheck <changed-scripts> 2>&1
If all tests pass: skip to Phase 5 (report success).
If tests fail: record the failures and proceed to Phase 3.
RUN checkpoint: [X pass, Y fail, Z skip]. Failures: [list of test names]Phase 3 — Analyze and Fix
Agent perspective: Builder (use subagent_type: builder if spawning via Task tool)
For each failing test:
- Read the test to understand what behavior it expects.
- Read the failure output — assertion mismatches, stack traces, error messages.
- Trace to source — identify the source file and function where the bug lives.
- Fix the source code. Rules:
- Fix the implementation, NOT the test — unless the test has a clear bug (wrong expected value, broken setup, outdated assertion).
- If you must change a test, explain why and flag it in the report.
- Minimal changes — fix only what is needed to pass. No drive-by refactoring.
- Handle error paths properly. No silent failures or unwraps without context.
- Run lint after each fix to ensure no new warnings.
FIX checkpoint: [N files modified]. Changes: [brief list]Phase 4 — Re-run and Iterate
Re-run the test suite after fixes.
- All pass: proceed to Phase 5.
- Still failing: return to Phase 3 with the remaining failures.
- Maximum 3 iterations. If tests still fail after 3 fix attempts, escalate — don't just report.
ITERATION [1|2|3]: [X pass, Y fail]. [Proceeding to fix | ESCALATING — max attempts reached]Escalation After 3 Iterations
If 3 fix attempts fail, the problem is likely deeper than a simple bug. Escalate:
- Spawn Architect (
subagent_type: architect,model: "opus") with prompt: "Think deeply about why these tests are failing after 3 fix attempts. Analyze the test expectations vs. the implementation design. Is there a design-level issue? Review: [list of failing tests and error summaries]" - If Architect identifies a design issue → report to user with Architect's analysis and recommended redesign.
- If Architect says implementation is correct and tests are wrong → fix the tests (flag clearly in report).
- If Architect can't determine → report ESCALATING to user with full context.
Phase 5 — Report
Produce a clear final report.
## Test and Fix Report
**Project**: [path]
**Framework**: [detected framework]
**Scope**: [all tests | filtered to X]
### Result: ALL PASSING / PARTIAL / FAILED
### Test Summary
- Total: [N]
- Passing: [N]
- Failing: [N]
- Skipped: [N]
### Fixes Applied
| File | Change | Tests Fixed |
|------|--------|-------------|
| `path/to/file.ext` | [what changed] | `test_name_1`, `test_name_2` |
### Tests Modified (if any)
| Test File | Change | Reason |
|-----------|--------|--------|
| (none, or list) | | |
### Remaining Failures (if any)
| Test | Error | Analysis |
|------|-------|----------|
| `test_name` | [error summary] | [why it resists fixing — missing dep, design issue, etc.] |
### Lint Status
- [tool]: PASS/FAIL ([N] warnings/errors)
### Coverage (if available)
- [coverage summary or "not configured"]
### Iterations
- Attempt 1: [X pass, Y fail]
- Attempt 2: [X pass, Y fail] (if needed)
- Attempt 3: [X pass, Y fail] (if needed)When to Use
- After pulling changes that might have broken tests
- After a refactor to catch and fix any regressions
- When CI is red and you want to auto-fix locally
- As a general "make the tests green" command
- Before
/commit-push-prto ensure a clean commit
When NOT to Use
- When you want to write new tests first (use
/tddinstead) - When you only want to verify without fixing (use
/prove-itinstead) - When the test failures are intentional (e.g. red phase of TDD)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

