agent-debug
Skill1 starsChanged 7 months agoMITView on GitHub
Structured self-debugging for AI agent run failures — loop limits, repeated retries with no progress, context drift, or tool failures. Use when an agent session is stuck or degrading and needs a reproducible diagnosis instead of a blind retry.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- alexaiarchitect/google-adk-skillstheir own version, first seen Oct 20, 2026
- DmNote-App/DmNotetheir own version, first seen Oct 8, 2026
- angelgabrieljacintohuayllasco/clipboard-skillstheir own version, first seen Sep 20, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- DmNote-App/DmNote★ 4.2ksame name
- alexaiarchitect/google-adk-skills★ 0same name
- angelgabrieljacintohuayllasco/clipboard-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository206 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- project-healthSkill
- skill-validatorSkill
- accessibilitySkill
- agent-evaluateSkill
- ai-governanceSkill
- ai-system-reviewSkill
- api-docs-generateSkill
- api-examplesSkill
- api-mockSkill
- api-test-generateSkill
- api-validateSkill
- architecture-diagramSkill
- ask-mattSkill
- assumption-mapSkill
- boilerplateSkill
- brainstormSkill
- branch-finishSkill
- briefingSkill
- browser-testing-with-devtoolsSkill
- bundle-analyzeSkill
- cache-strategySkill
- canarySkill
- carefulSkill
- cavemanSkill
- changelog-autoSkill
- chaos-testSkill
- ci-setupSkill
- ci-sweepSkill
- cleanprojectSkill
- click-path-auditSkill
- codebase-designSkill
- code-review-checklistSkill
- code-tourSkill
- commitSkill
- completion-verifySkill
- complexity-reduceSkill
- component-librarySkill
- config-cleanupSkill
- config-generateSkill
- conflict-resolveSkill
- container-optimizeSkill
- context-budgetSkill
- context-engineeringSkill
- context-restoreSkill
- context-saveSkill
- continuous-learningSkill
- contributingSkill
- cost-trackSkill
- councilSkill
- create-todosSkill
- cross-modal-reviewSkill
- database-connectSkill
- db-diagramSkill
- ddd-modelSkill
- debug-root-causeSkill
- debug-sessionSkill
- debug-systematicSkill
- decision-logSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 7 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 43
Ask: is this logic, state, environment, or policy failure?
- Very specific: line 50
Verify real state directly (git status, ls, service check) instead of trusting memory.
- Distinctive: line 53
Run one discriminating check.
- Distinctive: line 54
Only then retry — and only the narrowed piece.
- Distinctive: line 56
Never claim an unsupported auto-heal ("reset agent state", "reload harness config") unless actually invoking a real tool that does it.
- Distinctive: line 71
Never end with "fixed it" alone — always give the pattern, root cause, action, and evidence.
- Distinctive: line 99
Early exit: If the last 2 tool calls already show forward progress (no repetition, no error), reports "no stuck pattern detected" in one …
- Distinctive: line 111
Read-only by default: Phase 3 recovery actions are diagnostic (reading state, trimming context, narrowing scope), not destructive.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Agent Debug
Diagnose a failing or stuck agent run through capture, root-cause classification, contained recovery, and a structured introspection report — instead of retrying blindly.
Usage
/agent-debug # Diagnose the current stuck/failing run
/agent-debug --report-only # Skip recovery, just produce the introspection reportBehavior
Phase 1: Capture
Record the failure before touching anything:
- error type, message, last tool call sequence
- what the agent was trying to accomplish
- signs of context pressure: duplicated plans, oversized pasted output, repeated near-identical prompts
- environment assumptions to verify: cwd, branch, expected files, service state
Phase 2: Diagnose
Match the failure to a known pattern before changing anything:
| Symptom | Likely cause | Check |
| Same tool call repeated | loop with no exit condition | last N tool calls for repetition |
| Reasoning degrading, output rambling | context overflow from duplicated notes/logs | recent context for low-signal bulk |
| Connection refused / timeout | wrong port, service down | service health, URL, port |
| 429 / rate limit | retry storm, no backoff | call frequency and spacing |
| File missing after write | wrong cwd, race, branch drift | actual path, git status, file existence |
| "Fixed" but still failing | wrong hypothesis | isolate the exact failing case, re-derive |
Ask: is this logic, state, environment, or policy failure? Deterministic or transient? What is the smallest reversible check that would confirm the diagnosis?
Phase 3: Contained Recovery
Take the smallest action that changes the diagnosis surface, in order:
- Restate the actual goal in one sentence.
- Verify real state directly (
git status,ls, service check) instead of trusting memory. - Trim context to active goal, blockers, and evidence only.
- Narrow scope to one failing command, file, or test.
- Run one discriminating check.
- Only then retry — and only the narrowed piece.
Never claim an unsupported auto-heal ("reset agent state", "reload harness config") unless actually invoking a real tool that does it. Escalate to the user when the failure is high-risk, externally blocked, or the diagnosis is still ambiguous after one recovery attempt.
Phase 4: Introspection Report
## Agent Self-Debug Report
- Task:
- Failure:
- Root cause:
- Recovery action taken:
- Result: success | partial | blocked
- Evidence:
- Follow-up needed:Never end with "fixed it" alone — always give the pattern, root cause, action, and evidence.
Examples
Loop detected:
/agent-debug
→ Pattern: same `npm test` call 4x with no diff between runs
→ Cause: no-exit retry path, error unread between attempts
→ Recovery: read the actual failure output, narrow to the one failing test
→ Result: partial — root cause identified, fix pendingContext drift:
/agent-debug
→ Pattern: last 6 turns re-paste the same 400-line log
→ Cause: context overflow, reasoning quality dropping
→ Recovery: trim to goal + last error line, restate objective
→ Result: successToken Optimization
Expected range: 500–2,000 tokens (initial), 100–300 tokens (cache hit)
Caching: None — each failure is unique context; nothing to cache across calls.
Early exit: If the last 2 tool calls already show forward progress (no repetition, no error), reports "no stuck pattern detected" in one line and exits without running full diagnosis.
Patterns used: Early exit, progressive disclosure (capture and diagnose before recovery, report last).
Edge Cases
- No error captured: still runs Phase 1 against the described symptom (e.g., "feels stuck") rather than skipping capture.
- Diagnosis inconclusive: report says so explicitly and escalates rather than guessing a recovery action.
- Recovery attempted but symptom persists: re-run Phase 2 with the new evidence before attempting a second recovery; do not repeat the same recovery action twice.
Safety
Read-only by default: Phase 3 recovery actions are diagnostic (reading state, trimming context, narrowing scope), not destructive. No file deletion, no git reset, no force operations. If a recovery step would touch tracked files, create a git checkpoint first per .claude/rules/git-workflow.md.
Distinct from /llm-qa (investigates LLM output quality — hallucination, retrieval, prompt issues in a shipped app) and /debug-systematic (hypothesis-driven debugging of application code bugs). Use this skill instead when the failure is in the agent's own run — loops, drift, or tool-call breakdowns — not in the code or output it produced.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

