From dev
Use when verify.sh fails repeatedly, a feature breaks unrelated code, or the project is in a bad state. Triggers when user says "tests are failing", "something broke", "revert", "recover", or "rollback". Provides a structured protocol for diagnosing failures, isolating regressions, and restoring the project to a known good state using git.
How this skill is triggered — by the user, by Claude, or both
Slash command
/dev:recover-sessionThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Structured error recovery for harness-based projects. When verify.sh fails and you can't immediately see why, **follow this protocol instead of flailing.** Git is your safety net — use it deliberately.
Structured error recovery for harness-based projects. When verify.sh fails and you can't immediately see why, follow this protocol instead of flailing. Git is your safety net — use it deliberately.
Core principle: Diagnose before you fix. Isolate before you revert. Never lose working code to fix broken code.
Use this skill when:
Do NOT use for:
Follow this order. Do NOT skip to "just revert everything."
Before touching ANY code, gather information:
# What's actually failing?
./harness/verify.sh 2>&1 | tee /tmp/verify-output.txt
# What changed since last known good state?
git log --oneline -10
git diff --stat HEAD~1
# What does progress.txt say about last session?
cat harness/progress.txt | tail -30
Write down (or note mentally):
Red flag: "I'll just revert everything and start over" Reality: You'll lose working code. Diagnose first.
Determine if the failure is isolated or widespread:
Isolated failure (one test, one check):
Widespread failure (multiple tests, build broken):
Regression (previously passing features now fail):
For a single failing test or check:
Time limit: If you can't fix it in 15 minutes of focused effort, escalate to 3b.
When the project is too broken to fix forward:
# Find last passing commit
git log --oneline -20
# Check verify.sh at a specific commit WITHOUT losing current work
git stash
git checkout <last-good-commit>
./harness/verify.sh # Confirm it actually passes
git checkout - # Return to current branch
git stash pop
If last good commit passes:
# Option A: Soft reset (keep changes as unstaged)
git reset --soft <last-good-commit>
# Now you can selectively re-apply changes
# Option B: Create a recovery branch (safest)
git branch recovery-backup # Save current state
git reset --hard <last-good-commit>
# Cherry-pick or manually re-apply what worked
Always document the rollback in progress.txt.
When new code broke old code and you're not sure which change caused it:
# Find the breaking commit
git bisect start
git bisect bad HEAD
git bisect good <last-known-good-commit>
# At each step, run verify.sh
./harness/verify.sh
# If passes: git bisect good
# If fails: git bisect bad
# When found:
git bisect reset
After identifying the breaking commit:
After any recovery, append to progress.txt:
--- Session 2026-02-22-recovery ---
Agent: Claude Opus 4.6
Worked on: Recovery - verify.sh failures after F007 implementation
Root cause: F007 database migration broke F003 config loader (shared env vars)
Recovery action: Reverted F007, re-implemented with isolated env namespace
Completed:
- Diagnosed regression using git bisect (breaking commit: a3f8b21)
- Rolled back to last good state (commit: 7c2e1f4)
- Re-implemented F007 with proper env isolation
- All tests passing via verify.sh
Blocked: none
Next: F008 - API rate limiting
Commit: fix(project): re-implement F007 with isolated env namespace
Required fields for recovery sessions:
| Excuse | Reality | Counter |
|---|---|---|
| "I'll just revert everything" | Loses working code from multiple sessions | Diagnose first. Surgical revert > nuclear option. |
| "It worked before, I'll just re-run" | Flaky tests need fixing, not re-running | If verify.sh fails, something is wrong. Investigate. |
| "Let me add a quick fix on top" | Fixes on top of broken code compound problems | Understand root cause before applying fixes. |
| "I'll skip the failing test for now" | Skipped tests never get fixed. Quality decay starts here. | Fix the test or revert the code. No middle ground. |
| "This isn't related to my changes" | It probably is. Check git diff carefully. | If truly unrelated, document it and create a new feature for the fix. |
If you're thinking any of these, you're about to make things worse:
All of these mean: Step back. Follow the protocol from Step 1.
Escalate if:
How to escalate:
npx claudepluginhub 0xobat/claude-skills --plugin devReverts code to last known working Git baseline after multiple failed fixes, then reimplements changes step-by-step with verification and local testing.
Diagnoses and routes fixes for verification or test failures with evidence-based root cause analysis. Never edits code directly.
Guides structured recovery from errors and failures by assessing, logging root cause, and applying safe fixes with rollback plans. Prevents cascading mistakes via forbidden patterns and escalation rules.