Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports.
.claude/skills/agent-introspection-debugging/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-04 | ✗→✓ | ▲ Improved | — | — |
| case-15 | ✗→✓ | ▲ Improved | — | — |
| case-17 | ✗→✓ | ▲ Improved | — | — |
| case-12 | ✗→✓ | ▲ Improved | — | — |
| case-18 | ✗→✓ | ▲ Improved | — | — |
Use this skill when an agent run is failing repeatedly, consuming tokens without progress, looping on the same tools, or drifting away from the intended task.
This is a workflow skill, not a hidden runtime. It teaches the agent to debug itself systematically before escalating to a human.
Activate this skill for:
Do not use this skill as the primary source for:
verification-loopBefore trying to recover, record the failure precisely.
Capture:
Minimum capture template:
markdown## Failure Capture - Session / task: - Goal in progress: - Error: - Last successful step: - Last failed tool / command: - Repeated pattern seen: - Environment assumptions to verify:
Match the failure to a known pattern before changing anything.
| Pattern | Likely Cause | Check | | --- | --- | --- | | Maximum tool calls / repeated same command | loop or no-exit observer path | inspect the last N tool calls for repetition | | Context overflow / degraded reasoning | unbounded notes, repeated plans, oversized logs | inspect recent context for duplication and low-signal bulk | | ECONNREFUSED / timeout | service unavailable or wrong port | verify service health, URL, and port assumptions | | 429 / quota exhaustion | retry storm or missing backoff | count repeated calls and inspect retry spacing | | file missing after write / stale diff | race, wrong cwd, or branch drift | re-check path, cwd, git status, and actual file existence | | tests still failing after “fix” | wrong hypothesis | isolate the exact failing test and re-derive the bug |
Diagnosis questions:
Recover with the smallest action that changes the diagnosis surface.
Safe recovery actions:
Do not claim unsupported auto-healing actions like “reset agent state” or “update harness config” unless you are actually doing them through real tools in the current environment.
Contained recovery checklist:
markdown## Recovery Action - Diagnosis chosen: - Smallest action taken: - Why this is safe: - What evidence would prove the fix worked:
End with a report that makes the recovery legible to the next agent or human.
markdown## Agent Self-Debug Report - Session / task: - Failure: - Root cause: - Recovery action: - Result: success | partial | blocked - Token / time burn risk: - Follow-up needed: - Preventive change to encode later:
Prefer these interventions in order:
Bad pattern:
Good pattern:
verification-loop after recovery if code was changed.continuous-learning-v2 when the failure pattern is worth turning into an instinct or later skill.council when the issue is not technical failure but decision ambiguity.workspace-surface-audit if the failure came from conflicting local state or repo drift.When this skill is active, do not end with “I fixed it” alone.
Always provide:
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-07 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-11 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-03 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-12 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-02 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 20 counted toward the lift figure. The other 2 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +41 percentage points is the difference between those two pass rates over the 20 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
Other measured skills in the registry, with their headline benchmark lift.