Agent Self-Correction
Protocols for the agent to autonomously detect failures, analyze root causes, and attempt recovery strategies before requesting user intervention.
npx skills add majiayu000/claude-skill-registry --skill agent-self-correction --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Agent Self-Correction [Context: Errors and roadblocks are inevitable. An efficient agent does not stop at the first sign of failure; it analyzes the error, adjusts its approach, and retries. This skill defines the cognitive loop for autonomous self-correction.] ## 1. Core Principles - **Analyze First**: Never retry the exact same action without understanding *why* it failed. - **Fail Fast, recover Faster**: Identify failure modes immediately (tech stack mismatch, syntax error, hallucination). - **Graceful Escalation**: Attempt 2-3 autonomous fixes before escalating to the user. - **State Preservation**: Don't destroy partial progress when fixing a specific bug. ## 2. Step-by-Step Implementation ### Phase 1: Failure Detection & Analysis When a tool returns an error or a check fails: 1. **Stop**: Do not proceed to the next step of the plan. 2. **Read**: Analyze the error message thoroughly. - Is it a syntax error? -> Fix code. - Is it a logic error? -> Rethink algorithm. - Is it a tool misuse? -> Check tool definition. - Is it environmental? -> Check paths/permissions. 3. **Hypothesize**: Formulate a hypothesis for the fix. ### Phase 2: autonomous Recovery Loop 1. **Attempt 1 (Quic
- 1. Core Principles
- 2. Step-by-Step Implementation
- Phase 1: Failure Detection & Analysis
- Phase 2: autonomous Recovery Loop
- Phase 3: Escalation
- 3. Templates & Examples
- Internal Monologue for Debugging
- Self-Correction Checklist
- 4. Common Pitfalls
What does the Agent Self-Correction skill do?
Protocols for the agent to autonomously detect failures, analyze root causes, and attempt recovery strategies before requesting user intervention.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill agent-self-correction --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
