From error-fixer-loop
Recursive error-fix loop. Use when a bash command fails with a build/test/typecheck error, when the same class of error appears more than once, or when the harness itself needs a persistent rule so the error does not come back. Detect → root-cause → minimal fix → test → lint/typecheck → persist rule (SKILL.md / AGENTS.md / docs/rules) → audit with evidence. Cross-harness (Claude Code, OpenCode, Codex, Gemini, Agy).
How this skill is triggered — by the user, by Claude, or both
Slash command
/error-fixer-loop:error-fixer-loopThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
> Every fixed error must reduce the chance of the same error returning.
Every fixed error must reduce the chance of the same error returning. If the loop ends at the patch, it failed — even if the patch worked.
Recursive skill: it closes the cycle between execution, verification, and harness improvement. Each run produces evidence (error found, decision made, test run, rule created, harness adjusted) and leaves the system harder to break in the same way.
Reference pattern: Como Criar uma Skill Recursiva.
Load this skill when ANY of these is true:
bash/shell tool call returns output matching a known build/test/typecheck error pattern (see hooks/ — they auto-inject a reminder).Do not load for:
code-smell or architecture-deepener instead).Follow the steps in order. Skipping steps is the exact failure this skill prevents.
Format: <Component> fails because <specific reason>, triggered by <minimal repro>.
If you cannot write this sentence yet, you are not at root cause — go back to step 1 with a tighter repro (see bug-diagnostics for repro-building techniques).
Pick exactly one primary class. This decides where the fix lives.
| Class | Symptom | Where the fix belongs |
|---|---|---|
procedure | Skill/agent didn't say to run the check | this SKILL.md or the calling skill |
missing-rule | Project convention violated repeatedly | docs/rules/<topic>.md or AGENTS.md |
missing-test | Bug escaped because no seam | test suite (add regression test) |
permission | Tool denied, sandbox blocked, path forbidden | harness policy (~/.config/opencode/permission.json, Claude settings) |
observability | No log, no checkpoint, no evidence | logging/checkpoint layer |
documentation | Agent followed stale doc | doc file referenced by agent |
lint and typecheck for TS/JS projects (tsc --noEmit, biome check, eslint).If the failure is repeatable (same class can appear again), write a rule. Use this decision tree:
Is it specific to THIS project?
├─ yes → docs/rules/<topic>.md in the project, link from AGENTS.md
└─ no → could other projects hit it?
├─ yes → this SKILL.md (anti-patterns section) or a new global rule
└─ no → record in the final report only; do NOT write a rule
Rule format (one line, operational, verifiable):
- **<Rule name>**: <imperative sentence>. Verify with: <command or check>.
Good: Never use as anyto silence a TS error without a// justified: comment. Verify with: grep -rn "as any" src/ | grep -v justified.
Bad: Be careful with types. (not operational, not verifiable)
docs/rules/, link it from AGENTS.md under the relevant section.SKILL.md, bump the version in plugin.json and note the change in the audit.Write a dynamic fix-prompt file so the fix can be replayed, delegated, or audited later — even in another session or harness.
.error-fixer-loop/<YYYYMMDD-HHMMSS>-<short-slug>.md (create the folder if missing; add it to .gitignore if the project doesn't want it versioned).templates/fix-prompt.md from this plugin.senior-prompt-engineer output shape — Role/Context, Task, Inputs/files, Constraints, Plan with → verify: per step, Output contract, Feedback DO, Feedback DO NOT, and a closing EXEC-MAP v1 fenced block.ts2322-string-to-number, jest-module-not-found).<...> still in it.This artifact is what makes the loop recursive across sessions: the next agent (or the same agent next week) can pick up the file and execute the fix without re-doing the investigation.
Produce a short report answering ALL of:
Without the audit AND the fix-prompt, the loop is not closed.
This skill MAY propose or edit:
SKILL.md (anti-patterns, protocol refinements).docs/rules/*.md, docs/ai/rules/*.md, AGENTS.md, CLAUDE.md.evals.json)..error-fixer-loop/ (always allowed; never requires confirmation).This skill MUST NOT:
as any, @ts-ignore, eslint-disable or equivalent to silence an error without an inline // justified: <reason> comment and a rule entry..error-fixer-loop/.<placeholders>.Update this SKILL.md only when ALL are true:
Update a project rule file when the learning is project-specific (e.g., "in this repo, blog posts need both index.md and index-pt-br.md").
Create an eval (evals.json) when the failure can be simulated (e.g., "agent concludes without running tests", "agent uses as any").
Two hooks auto-detect build/test errors in bash output and inject a reminder to run this loop:
hooks/error-fixer-loop-hook.sh — register as PostToolUse on Bash.hooks/error-fixer-loop.ts — plugin listening on tool.execute.after.Both are passive: they only print a one-line reminder. They never block, never mutate the tool result, never auto-run the fix.
Detected patterns (extend via ERROR_PATTERNS in the TS hook or the regex in the shell hook):
error TS\d+Cannot find module, Module not found:, Unable to find a specification forBUILD FAILED, GRADLE.*FAILED, npm ERR!, pod install.*failTest Suites:.*[1-9]\d* failed, Tests:.*[1-9]\d* failed, jest.*FAILNitroModules.*not foundModuleNotFoundError, ImportError, AssertionError, FAILED tests/FAIL\s+\S+, undefined:, cannot find packageerror\[E\d+\], panicked atBUILD FAILURE, Compilation failure, > Task .* FAILEDAdd new patterns only when you have seen them fire in the wild — not speculatively.
Do not pile every learning into this file. Four layers:
docs/rules/, AGENTS.md, this SKILL.md.Layer 4 is the most sensitive. Changes there must be small, verified, and reversible.
~/.claude/hooks/error-fix-loop-hook.sh (replaced by hooks/error-fixer-loop-hook.sh)bug-diagnostics (deep repro/hypothesis work when step 2 stalls)~/.config/opencode/AGENTS.md (global), project AGENTS.md (local)npx claudepluginhub andersonlimahw/lemon-ai-hub --plugin error-fixer-loopIterates minimal-fix correction loops for warning/error signals from hooks, lint, type-checkers, and test failures. Stops when verification passes.
Diagnoses and fixes bugs, type errors, lint failures, CI/CD issues, and runtime errors through root-cause-first investigation.
Use when repeated fix attempts fail, the agent appears stuck in a loop, or complexity is increasing without progress