/harness-anchor:self-correction-loopfrom harness-anchor
Iterates minimal-fix correction loops for warning/error signals from hooks, lint, type-checkers, and test failures. Stops when verification passes.
Ships in harness-anchor. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
When your edit produces a warning/error signal, you're in a correction loop. This skill is the discipline that keeps the loop productive instead of thrashing.
You should engage this loop when ANY of these happen after your edit:
PostToolUse hook injected clang-tidy warnings: / lint warnings: / similarBash command you ran returned non-zero exitThis is TDD's RED-GREEN-REFACTOR adapted for correction:
1. CAPTURE the signal
- What is the EXACT error message?
- Which file / line?
- What was my last change?
2. DIAGNOSE root cause (not symptom)
- Read the error carefully — the answer is often in it
- Check if my change broke an invariant elsewhere
- Do NOT guess. If unclear, narrow with prints / smaller test cases
3. MINIMAL FIX
- Smallest possible change that resolves THE specific issue
- No "while I'm here" tangents (that's scope creep — see scope-jump)
- Do NOT mask the error (e.g. catch-and-ignore) without explicit reason
4. RE-VERIFY
- Run the same command that produced the signal
- Observe the new output
- Capture it as evidence
This loop is for surface signals that a quick minimal fix resolves. If a minimal fix doesn't clear the signal within 1–2 iterations — or the failure spans components / needs backward root-cause tracing — switch to superpowers:systematic-debugging (its 4-phase root-cause process). Don't keep thrashing minimal fixes here.
If you've iterated 3 times on the same signal without resolving it, stop and escalate:
superpowers:systematic-debugging for structured root-cause investigation (its budget also caps at 3 fixes → then question the architecture; the two thresholds are intentionally aligned)docs-lookup skill for the specific error class (Context7 → WebSearch fallback)Looping > 5 times is almost always a sign of:
The budget above is the re-run budget — re-running the same failing command. There's a second, sneakier loop: the edit budget.
done_criteria — not your own diff (the classic failure is re-reading your own code, deciding it "looks ok", and continuing). Then either switch to a structurally different approach or escalate to the user.This mirrors LoopDetection middleware ("reconsider the approach after N edits on one file") — break out before the 10th micro-adjustment, not after.
If you can't articulate WHY, your fix is suspicious — even if green. State this uncertainty per anti-hallucination-gates.
Before moving on: if the failure you just fixed is a recurrence (second+ time you've seen
the class), capture it as a golden rule in this same turn — a rough stub via
capturing-golden-rules — not as a mental note for session end. Deferred captures get distorted
or forgotten when context compacts.
// @ts-ignore, --no-verify, deleting failing tests, broadening exception catches. These hide problems; sometimes they're warranted but require explicit user note.harness-anchor hooks are warn-only. They inject additionalContext describing the problem; they don't block your action. That means:
session-handoff.md.planned in feature_list.json and continue current scope.A fresh-context sensor's report — /verify (verification-runner), /test-plan (coverage-analyst), /gc (drift-analyst) — is reviewer feedback from a deliberately context-blind evaluator: it cannot see your intent (that independence is the design). Triage it with superpowers:receiving-code-review rigor — verify each finding against the code, push back on false positives with technical reasoning, act one-at-a-time — rather than blind-applying. This matters most inside /verify --fix: the bounded loop should apply verified findings, not churn on every recommendation. This is not a licence to dismiss the sensor — receiving-code-review is rigorous; you verify, then act.
anti-hallucination-gates — keep claims honest while loopingcapturing-golden-rules — a recurring failure you just fixed becomes a rule in the same turnreceiving-code-review (superpowers) — the discipline for triaging a fresh-context sensor's findings (verify each, push back with reasoning, don't blind-apply)systematic-debugging (superpowers) — for deep debugging beyond surface signalsverification-runner (agent) — for fresh-eyes evaluation of "is this really fixed?"What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub redtropig/harness-anchor --plugin harness-anchor14 skills in this plugin
/anti-hallucination-gatesUse before claiming done/fixed/passing — or before asserting something is absent: not installed, not available, no such function, couldn't find it. Default-FAIL runs both ways — every claim needs an evidence path. A negative claim must carry its search scope and observation date; state calibrated uncertainty when evidence is missing./capturing-golden-rulesUse when the same mistake or bad pattern recurs, when a code-review comment is really a convention worth enforcing, or when you catch AI-generated drift/slop and want it to never happen again. Encodes the lesson as a durable rule in golden-rules.md — the feedback-flywheel / harness-layer-learning ratchet — instead of a one-off fix. Generic (language-agnostic)./context-budget-disciplineUse when sessions run long, adding subagents, fetching large files, or planning context-heavy work. SELECT/WRITE/COMPRESS/ISOLATE discipline./cpp-build-systemsUse in C/C++ projects for build configure/errors, compile_commands.json generation, or selecting CMake/Meson/Make/Bazel commands./cpp-formattingUse in C/C++ projects for clang-format. Changed-lines-only; never reformat unchanged code mid-feature. .clang-format from root or LLVM baseline./cpp-sanitizersUse in C/C++ projects for crashes, hangs, UB, data races, memory errors. ASan/UBSan/TSan runtime checks. Build sanitizer config separately.Other plugins' skills for the same job