self-correction-loop

self-correction-loop is a skill for Claude Code from Redtropig/harness-anchor. It costs 35 tokens per session (1,608 once invoked), scanned A, original, MIT.

A method for responding to warnings, failed tests, build errors, or other problems after a code change.

In plain words
What is it for?
Use it to capture the error, find its root cause, make the smallest relevant fix, and verify that the problem is gone.
Why use it?
It keeps debugging focused on the exact failure and reduces guesswork or unrelated edits.

Skill for Claude Code

Written for Claude Code: PostToolUse hook event.

Part of the harness-anchor plugin — 14 skills, 9 commands, 5 agents, 5 hooks shipped together

Good fit Use it to capture the error, find its root cause, make the…

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/redtropig/harness-anchor/self-correction-loop
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Redtropig/harness-anchor --skill self-correction-loop
Clone the repo
git clone --depth 1 https://github.com/Redtropig/harness-anchor

Made for: Claude Code.

Or install harness-anchor, the plugin that ships this one along with the rest of its 14 skills, 9 commands, 5 agents, 5 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for self-correction-loop

README.md
[![agentmods](https://agentmods.dev/badge/skills/redtropig/harness-anchor/self-correction-loop.svg)](https://agentmods.dev/skills/redtropig/harness-anchor/self-correction-loop)
Your own site
<a href="https://agentmods.dev/skills/redtropig/harness-anchor/self-correction-loop"><img src="https://agentmods.dev/badge/skills/redtropig/harness-anchor/self-correction-loop.svg" alt="Measured on agentmods" height="20"></a>
Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,608 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00035 $0.01608
Opus 5 $0.00017 $0.00804
Sonnet 5 $0.00007 $0.00322
Haiku 4.5 $0.00003 $0.00161

Measured 6d ago against content hash abfd0263ba13, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

self-correction-loop scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/self-correction-loop/SKILL.md · 113 lines

How it starts

The opening of the file, as written. The whole thing — 113 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Self-Correction Loop

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.

Trigger signals

You should engage this loop when ANY of these happen after your edit:

  • PostToolUse hook injected clang-tidy warnings: / lint warnings: / similar
  • A Bash command you ran returned non-zero exit
  • A test runner reports failures
  • A type-checker reports errors
  • The user says "that broke X" / "it's failing now"

The Loop (RED → diagnose → minimal-fix → GREEN)

This 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

Loop budget

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:

  • Switch to 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)
  • Read more of the surrounding code than you have so far
  • Invoke docs-lookup skill for the specific error class (Context7 → WebSearch fallback)
  • Tell the user: "I've tried 3 approaches to . Latest output: <...>. I need more context. Recommend either or ?"

Read the full file on GitHub · 113 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 113 lines · 35 tokens per session scan A abfd0263ba13

Subscribe to this mod's changes

self-correction-loop is a skill published in the GitHub repository Redtropig/harness-anchor (13 stars, last pushed 1mo ago), licensed MIT. It adds 35 tokens to every session and 1,608 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

ci-debug

Diagnose a failing CI run against an 11-pattern playbook. Classifies the failure, cites the relevant memory entry, proposes the exact fix command — but NEVER applies without explicit user approval. Use when a specific PR check or GitHub Actions run failed and you want a diagnosis instead of speculation. Don't use for…

yonatangross/orchestkit · 92 tokens

paired-probe

Refuse a verdict a probe did not earn. Runs a check where the fault IS present and where it is NOT, and blocks the answer when both arms print the same thing, because a check that cannot disagree with you has measured nothing. Also catches the zero-sample sweep that reads as "clean" and the swallowed error that reads…

yonatangross/orchestkit · 100 tokens

simplifier

Replatform mode ("lift, tinker, and shift") — simplify a 1:1-lifted legacy system in place: modernize code and remove external dependencies, one pass at a time, each bracketed by characterization-tests replays, structure preserved. Owns the stack-neutral pass discipline; the transformation catalog and dependency…

AdamBien/airails · 0 tokens

error-handling

Apply error handling and recovery patterns in JavaScript/TypeScript or Node.js. Use when implementing error handling, retry logic, or when the user mentions domain errors, error recovery, error escalation.

metarhia/metaskills · 43 tokens

implement

Implement a feature or fix with automatic validation.

peteski22/agent-pragma · 10 tokens

error-handling

Validate error handling completeness across languages.

peteski22/agent-pragma · 10 tokens