Provides standardized methods for escalating, resetting, or migrating agent sessions.

Install

mkdir -p .claude/skills/agent-recovery && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/15767" && unzip -o skill.zip -d .claude/skills/agent-recovery && rm skill.zip

Installs to .claude/skills/agent-recovery

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Recovery protocols when agent is stuck—escalate to new agent, migrate context to new session, or reset mid-conversation.
120 chars✓ has a “when” trigger
Beginner

Key capabilities

  • Undo broken changes using git commands
  • Generate an escalation handoff report with original goal, observed failure, and failed approach
  • Open a new session and paste the handoff report content for a fresh agent
  • Auto-detect context from project files like requirements and coding guidelines
  • Generate a migration snapshot with project details, milestones, and current status
  • Reset mid-conversation by following a hard stop checklist and file edit protocol

How it works

This skill provides protocols for agent recovery when it is stuck, context is degraded, or a session needs migration. It offers options to escalate to a new agent with a handoff report, migrate context to a new session with a snapshot, or reset mid-conversation using a checklist.

Inputs & outputs

You give it
Agent stuck state, long conversation history, or need for context migration
You get back
Handoff report, context snapshot, or a recovered agent state

When to use agent-recovery

  • Recovering from hallucinated loops
  • Handing off tasks to new agents
  • Resetting stale conversation history

About this skill

Agent Recovery Skill

Protocols for when the agent is stuck, context is degraded, or session needs migration.

When to Use

  • Agent is making repeated mistakes
  • Long conversation causing hallucinations
  • Need to hand off to fresh agent
  • Context window is full

Option 1: Escalate (Handoff Report)

Use when: Agent is stuck and can't solve the problem.

Steps

  1. Undo broken changes:
git status
git checkout -- .
  1. Generate docs/escalation_report.md:
# Escalation Handoff Report

**Generated:** [Date/Time]
**Original Issue:** [GitHub Issue # or description]

## PART 1: THE DAMAGE REPORT

### 1.1 Original Goal
[The task you were asked to complete]

### 1.2 Observed Failure
[EXACT error message]

### 1.3 Failed Approach
[Strategy you attempted]

### 1.4 Key Files Involved
- `path/to/file1.ts`

### 1.5 Best-Guess Diagnosis
[Why approach failed]

## PART 2: FULL FILE CONTENTS
[EMBED entire content of each file]

## PART 3: DIRECTIVE FOR ORCHESTRATOR
1. Analyze the failure
2. Formulate a new plan
3. Execute or hand off
  1. Open new session and paste the report content.

Option 2: Migrate (Context Snapshot)

Use when: Chat is stale, need fresh session with same context.

Auto-Detect Context

cat docs/Project_Requirements.md 2>/dev/null
git log --oneline -20
gh issue list --state open --limit 10 --json number,title
cat docs/Coding_Guidelines.md 2>/dev/null

Generate docs/migration_snapshot.md:

# State Snapshot Handoff Prompt

## To the New AI: Adopt This Identity
You are the **VibeCode Project Orchestrator**...

## Project Details
- **Name:** [from PRD]
- **Stack:** [from PRD]

## Milestones
[From git log]

## Current Status
- In Progress: [from GitHub]
- Next: [from roadmap]

## Key Files
- `docs/Project_Requirements.md`
- `docs/Coding_Guidelines.md`

## First Action
Read files above, then ask: "What would you like to work on next?"

Option 3: Reset (Mid-Conversation)

Use when: Agent is making mistakes but can recover.

🛑 HARD STOP CHECKLIST

□ Did I READ the target file with view_file BEFORE editing?
□ Did I copy the EXACT target content, including whitespace?
□ Am I editing LESS than 50 lines at a time?
□ Did I verify all variable names exist in scope?
□ Did I check props are destructured in function signature?

Common Mistakes

PatternFix
Duplicate linesRead file first, count declarations
Missing destructuringCheck props signature
Broken JSXClose tags in same edit
Phantom variablesgrep in file before using
Edit offset driftRe-read file after each edit

File Edit Protocol

  1. view_file_outline → Understand structure
  2. view_file (exact range) → Copy PRECISE content
  3. Make edit with MINIMAL scope
  4. Re-check file before next edit

Verified Completion

Before saying "done":

npx tsc --noEmit  # MUST pass
  • No duplicate declarations?
  • No missing imports?
  • Task actually solved?

If errors persist after 3 fix attempts → use Escalate.

When not to use it

  • The agent is not stuck or making repeated mistakes
  • The conversation history is not long or causing hallucinations
  • The context window is not full and does not require migration

Limitations

  • The escalation report requires manual pasting into a new session
  • The migration snapshot relies on specific file names for context auto-detection
  • The reset option is limited to 3 fix attempts before escalation is recommended

How it compares

This skill provides structured recovery protocols with specific outputs like handoff reports and context snapshots, offering a systematic way to manage agent failures compared to ad-hoc troubleshooting.

Compared to similar skills

agent-recovery side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
agent-recovery (this skill)05moReviewBeginner
retrospective04moNo flagsIntermediate
n8n-expression-syntax64moNo flagsBeginner
python-repl64moReviewBeginner

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry