agent-recovery
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.zipInstalls 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.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
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
- Undo broken changes:
git status
git checkout -- .
- 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
- 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
| Pattern | Fix |
|---|---|
| Duplicate lines | Read file first, count declarations |
| Missing destructuring | Check props signature |
| Broken JSX | Close tags in same edit |
| Phantom variables | grep in file before using |
| Edit offset drift | Re-read file after each edit |
File Edit Protocol
view_file_outline→ Understand structureview_file(exact range) → Copy PRECISE content- Make edit with MINIMAL scope
- 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.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| agent-recovery (this skill) | 0 | 5mo | Review | Beginner |
| retrospective | 0 | 4mo | No flags | Intermediate |
| n8n-expression-syntax | 6 | 4mo | No flags | Beginner |
| python-repl | 6 | 4mo | Review | Beginner |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by JStaRFilms
View all by JStaRFilms →You might also like
retrospective
macroscopicentric
Pause and reflect when you've been repeating the same actions or cycling through a failing loop. Produce a structured self-assessment with proposed config changes.
n8n-expression-syntax
czlonkowski
Validate n8n expression syntax and fix common errors. Use when writing n8n expressions, using {{}} syntax, accessing $json/$node variables, troubleshooting expression errors, or working with webhook data in workflows.
python-repl
gptme
Interactive Python REPL automation with common helpers and best practices
n8n-validation-expert
czlonkowski
Interpret validation errors and guide fixing them. Use when encountering validation errors, validation warnings, false positives, operator structure issues, or need help understanding validation results. Also use when asking about validation profiles, error types, or the validation loop process.
powershell-windows
davila7
PowerShell Windows patterns. Critical pitfalls, operator syntax, error handling.
bats
OleksandrKucherenko
Bash Automated Testing System (BATS) for TDD-style testing of shell scripts. Use when: (1) Writing unit or integration tests for Bash scripts, (2) Testing CLI tools or shell functions, (3) Setting up test infrastructure with setup/teardown hooks, (4) Mocking external commands (curl, git, docker), (5) Generating JUnit reports for CI/CD, (6) Debugging test failures or flaky tests, (7) Implementing test-driven development for shell scripts.