Skip to content
Back to skills

Self Heal

ASecurity

When a test fails, lint errors, or CI breaks — diagnose with debugger agent, propose minimal fix, implementer applies, verifier reruns, loop up to 3 attempts then escalate. Combines Anthropic Auto-Fix + Playwright self-heal + 4-tier escalation pattern.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 9, 2026
ai-agentsbashdebugginggit

Security analysis

A100/100

Scanned October 9, 2026

npx -y skills add qyndex/claude-init --skill self-heal --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Self Heal?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Self Heal
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/qyndex-self-heal/badge)](https://www.skillsdirectory.com/skills/qyndex-self-heal)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: self-heal
description: When a test fails, lint errors, or CI breaks — diagnose with debugger agent, propose minimal fix, implementer applies, verifier reruns, loop up to 3 attempts then escalate. Combines Anthropic Auto-Fix + Playwright self-heal + 4-tier escalation pattern.
when_to_use: Auto-triggered by stop-verify hook when verify.sh exits non-zero. User says "fix this", "make it pass", "auto-heal", "the tests are red". Used inside /loop iteration.
model: inherit
---

# Self-Heal

A failure is not "done." It's a debugging task with a defined recovery path.

## The four tiers (escalate only when the prior tier fails)

```
Tier 1 — Pre-flight retry         (transient: network, flake, race)
        ↓
Tier 2 — Debugger diagnosis       (root cause via 4-phase loop)
        ↓
Tier 3 — Implementer applies      (minimal fix from diagnosis)
        ↓
Tier 4 — Human escalation         (after 3 failed Tier 1-3 cycles)
```

## Process

### Tier 1 — Transient retry (max 1)
- If the error message matches transient patterns (timeout, connection reset, "Test timeout after Nms" on first run), rerun once.
- If second run succeeds, log to `.claude/memory/incidents/flaky-<date>.md` and move on.
- If second run fails, escalate to Tier 2.

### Tier 2 — Debugger diagnosis (1 invocation)
- Delegate to `debugger` agent with the failure output.
- Debugger runs reproduce → isolate → diagnose → fix-proposal (4 phases).
- Output: `file:line` + cause + minimal fix proposal.
- **No commits** by debugger.

### Tier 3 — Implementer applies (1 invocation)
- Delegate to `implementer` agent with the debugger's fix proposal.
- Implementer writes a failing test first (capturing the bug), then the fix, then watches green.
- Run the broader test suite to confirm no regression.
- Commit with `fix(<scope>): <summary>` + git trailer `Confidence: high` if all tests green; `Confidence: medium` if only the targeted test passes.

### Tier 4 — Human escalation (after 3 cycles fail)
- Stop the loop.
- Write `OVERNIGHT_REPORT.md` or PR comment with:
  - Failure output
  - Debugger's three diagnoses
  - Implementer's three attempts (commits)
  - Why each failed (paste verify output)
  - Suggested human next step
- Mark the task failed: `bash .claude/scripts/task-status.sh T-<id> failed --note "<one-line why>"` (lock-safe; also feeds the consecutive-aborts machine).

## Hard rules

- **Don't fix without understanding.** Tier 2 is mandatory before any code change.
- **Don't suppress symptoms.** No `try/except: pass`, no `// @ts-ignore`, no broad `catch {}`. If the fix looks like suppression, escalate.
- **One fix per attempt.** Don't batch hypotheses. Test each independently.
- **Escalate at 3 attempts, not 5.** A bug that resists 3 root-cause-driven fixes is a human problem.
- **Document.** Every escalation writes to `.claude/memory/incidents/`.

## Auto-trigger

The `stop-verify.sh` hook fires this skill when:
- Any task's `accept:` command exits non-zero
- `bash .claude/scripts/verify.sh` exits non-zero
- `/loop` iteration reports failure

## References

- PolarOrchid/ClaudeWatch (4-tier recovery pattern)
- obra/superpowers/skills/systematic-debugging (4-phase debugger loop)
- Anthropic Auto-Fix (CI-side self-healing via claude-code-action)

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.