debug-session
Skill9 starsChanged 3 months agoMITView on GitHub
Use when the user reports a bug, error, or unexpected behavior that needs investigation.
6 other projects use a version of this.
Adopted by
Most recently taken up by
- jars-demo/jars-skillstheir own version, first seen Oct 25, 2026
- manastalukdar/ai-devstudiotheir own version, first seen Oct 13, 2026
- ai-dynamo/dynamotheir own version, first seen Oct 8, 2026
- pathorsAI/skillstheir own version, first seen Jul 20, 2026
- SpencerGoss/agent-engineeringtheir own version, first seen Jun 18, 2026
- YehudaFrankel/clankbraintheir own version, first seen Apr 16, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- ai-dynamo/dynamo★ 8.5ksame name
- YehudaFrankel/clankbrain★ 16same name
- manastalukdar/ai-devstudio★ 1same name
- jars-demo/jars-skills★ 0same name
- pathorsAI/skills★ 0same name
- SpencerGoss/agent-engineering★ 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 repository56 other files it gives its agents.
- .claude/agents/CLAUDE.mdCLAUDE.md
- .claude/hooks/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- .claude/prompts/CLAUDE.mdCLAUDE.md
- .claude/rules/CLAUDE.mdCLAUDE.md
- .claude/skills/CLAUDE.mdCLAUDE.md
- docs/CLAUDE.mdCLAUDE.md
- vision/CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
- scaffold/llms.txtllms.txt
- architecture-checkSkill
- backlog-reviewSkill
- bootstrapSkill
- brainstormSkill
- buildSkill
- claude-sense-checkSkill
- code-qualitySkill
- commitSkill
- continueSkill
- custom-hooksSkill
- dashboardSkill
- deploySkill
- discoverSkill
- doctorSkill
- fix-issueSkill
- framework-upgradeSkill
- handoffSkill
- help-meSkill
- ideateSkill
- lanesSkill
- manual-testSkill
- merge-downSkill
- merge-upSkill
- optimizeSkill
- parallel-workSkill
- performance-checkSkill
- phase-reviewSkill
- pr-statusSkill
- quality-checkSkill
- quickstartSkill
- refine-loopSkill
- researchSkill
- retrospectiveSkill
- security-auditSkill
- skill-createSkill
- skill-evalSkill
- sprint-endSkill
- sprint-startSkill
- story-cycleSkill
- testing-cycleSkill
- test-validatorSkill
- UAT-cycleSkill
- undo-workSkill
- uninstallSkill
- weekly-maintenanceSkill
- wrap-upSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
33 rules. 0 are common, 28 are distinctive, and 5 are very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
28
Distinctive
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 53
At each phase transition: Update the frontmatter fields: phase, phase_name, next_action, and append to files_modified.
- Very specific: line 55
On successful fix (Phase 5 complete): Delete .failure-state.md — clean state means no failure to recover from.
- Distinctive: line 59
Do NOT skip this phase. Do NOT jump to a fix.
- Distinctive: line 63
Read the FULL error message — every line, including stack trace
- Distinctive: line 66
When does it occur? (always, intermittently, under specific conditions)
- Distinctive: line 70
Run the relevant test or command to reproduce:
- Distinctive: line 76
If it cannot be reproduced, gather more context before proceeding.
- Distinctive: line 95
Read the FULL error output — every line, including stack trace and surrounding context
- Distinctive: line 98
If inputs are correct: the bug is in this function — inspect its logic
- Distinctive: line 99
If inputs are wrong: trace one level further back — where do those inputs come from?
- Distinctive: line 107
Do NOT attempt any fix until the root cause is identified with evidence.
- Distinctive: line 111
DO trace backward from the symptom to the source before forming a hypothesis.
- Distinctive: line 112
DON'T jump to a fix based on the error message alone — the message describes the symptom, not the cause.
- Distinctive: line 113
DO add temporary logging to confirm data flow before changing logic.
- Distinctive: line 114
DON'T change multiple things at once hoping one will fix it.
- Distinctive: line 126
Search for known issues before deep analysis — someone may have already solved this:
- Very specific: line 129
Use WebSearch to search for: "[dependency] [error message or key phrase]"
- Distinctive: line 130
If a known issue or fix is found, verify it applies to your version and context
- Distinctive: line 131
If no results: proceed to Phase 3 — the bug is likely project-specific </IF>
- Distinctive: line 145
Run the reproduction command after each change
- Distinctive: line 146
If the hypothesis is wrong, REVERT the change and form a new hypothesis
- Very specific: line 159
After 3 failed fix attempts: STOP.
- Distinctive: line 166
Write a test that reproduces the bug (MUST fail before fix)
- Distinctive: line 167
Verify the test fails for the RIGHT reason (matches reported behavior)
- Distinctive: line 169
Verify the reproduction test passes
- Distinctive: line 170
Run the FULL test suite for regressions
- Very specific: line 174
If the root cause was initially misdiagnosed or the fix required changing approach, invoke the record-failure micro-component from …
- Distinctive: line 220
Root cause unclear after investigation: Document findings so far. Ask user for additional context.
- Distinctive: line 226
NEVER apply a fix without understanding the root cause
- Distinctive: line 227
NEVER make multiple changes at once — one hypothesis, one change, one verification
- Distinctive: line 228
NEVER weaken or delete tests to make them pass
- Distinctive: line 229
NEVER say "it should work now" without showing test output
- Distinctive: line 230
If 3+ fixes fail, STOP and discuss the approach with the user
“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
debug-session
Skill metrics: Emit a start event to the activity log:
echo "{\"type\":\"skill\",\"event\":\"start\",\"skill\":\"debug-session\",\"ts\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"}" >> docs/sessions/.activity-log.jsonlDebug session for: $ARGUMENTS
Failure State Persistence
At each phase transition, write docs/sessions/.failure-state.md with YAML frontmatter so the Stop hook and /continue can programmatically detect incomplete workflows.
At workflow start (Phase 1 entry):
---
status: active
skill: debug-session
phase: "1"
phase_name: "Root Cause Investigation"
started_at: "[ISO-8601 timestamp from date -u +%Y-%m-%dT%H:%M:%SZ]"
story: "[from $ARGUMENTS — the error description]"
branch: "[from git branch --show-current]"
next_action: "Reproduce error and trace root cause"
files_modified: []
---
## Context
Error: [error description]
Root cause: not yet identified
Hypothesis: none
Fix attempts: 0
Files investigated: [list as investigation proceeds]At each phase transition: Update the frontmatter fields: phase, phase_name, next_action, and append to files_modified. Update the Context section with investigation progress (root cause, hypothesis, fix attempts).
On successful fix (Phase 5 complete): Delete .failure-state.md — clean state means no failure to recover from.
Phase 1: Root Cause Investigation (MANDATORY)
Do NOT skip this phase. Do NOT jump to a fix.
1a. Understand the Error
- Read the FULL error message — every line, including stack trace
- What is the exact error? (copy it verbatim)
- Where does it occur? (file:line from stack trace)
- When does it occur? (always, intermittently, under specific conditions)
1b. Reproduce Consistently
Run the relevant test or command to reproduce:
# Run the failing test or trigger the errorIf it cannot be reproduced, gather more context before proceeding.
1c. Check Recent Changes and ADR Constraints
git log --oneline -10
git diff HEAD~3Did a recent change introduce this? Use git bisect for non-obvious regressions.
<IF condition="docs/adr/ contains accepted ADR files">
Check if the error area is governed by an accepted ADR. If so, the fix MUST respect that decision — propose a fix within the ADR's constraints rather than working around the architectural choice. If the ADR itself is the root cause, flag it for supersession rather than silently violating it.
</IF>1d. Trace Backward from Symptom
Apply the failure_diagnosis reasoning tool from .claude/skills/story-cycle/references/reasoning-tools.md:
- Read the FULL error output — every line, including stack trace and surrounding context
- Identify: what was expected vs. what actually happened
- Trace backward: which function produced the wrong result? What were its inputs?
- If inputs are correct: the bug is in this function — inspect its logic
- If inputs are wrong: trace one level further back — where do those inputs come from?
- Repeat until you find the point where correct data becomes incorrect
For multi-component systems, trace across component boundaries — check API calls, database queries, event handlers.
See references/root-cause-tracing.md — search for ## Steps for the detailed backward trace procedure.
<HARD-GATE>
Do NOT attempt any fix until the root cause is identified with evidence. "I think it might be X" without evidence is NOT identification. Show: where the bug is, why it happens, and what incorrect state or logic causes it.
</HARD-GATE>DO / DON'T:
- DO trace backward from the symptom to the source before forming a hypothesis.
- DON'T jump to a fix based on the error message alone — the message describes the symptom, not the cause.
- DO add temporary logging to confirm data flow before changing logic.
- DON'T change multiple things at once hoping one will fix it.
Phase 2: Pattern Analysis
- Find a WORKING example of similar functionality in the codebase
- Compare the working example against the broken code line by line
- Identify specific differences — which difference explains the bug?
- Understand the dependency chain — are all dependencies correct and available?
2b. Search for Known Issues (Optional)
<IF condition="error involves a third-party dependency or library">
Search for known issues before deep analysis — someone may have already solved this:- Identify the dependency name and version from
package.json,requirements.txt, or equivalent - Use WebSearch to search for:
"[dependency] [error message or key phrase]" - If a known issue or fix is found, verify it applies to your version and context
- If no results: proceed to Phase 3 — the bug is likely project-specific
</IF>
Phase 3: Hypothesis and Testing
Form a Single Hypothesis
Based on evidence from Phases 1-2, state:
- Hypothesis: "The bug is caused by [specific cause] because [evidence]"
- Prediction: "If I change [specific thing], the error should [specific expected change]"
Test Minimally
- Change ONE variable at a time
- Run the reproduction command after each change
- If the hypothesis is wrong, REVERT the change and form a new hypothesis
Stopping Points — STOP If:
| Situation | Action |
| 3+ fix attempts have failed | STOP. Question the approach. Are you fixing the right thing? |
| "Just try X and see if it works" | STOP. Form a hypothesis first. |
| Making multiple changes at once | STOP. One variable at a time. |
| "It's probably X" without evidence | STOP. Gather evidence. |
| Fix works but you don't understand why | STOP. Understand before committing. |
<HALT reason="exceeded fix attempts">
After 3 failed fix attempts: STOP. Return to Phase 1 and re-trace from scratch. The root cause identification was likely wrong. Consult `references/error-recovery.md` — search for `## Phase 3`.
</HALT>See references/condition-based-waiting.md — search for ## Patterns by Language and load only your language's section.
Phase 4: Fix Implementation (TDD)
- Write a test that reproduces the bug (MUST fail before fix)
- Verify the test fails for the RIGHT reason (matches reported behavior)
- Implement the MINIMAL fix — change as little as possible
- Verify the reproduction test passes
- Run the FULL test suite for regressions
Phase 4.5: Error Learning
If the root cause was initially misdiagnosed or the fix required changing approach, invoke the record-failure micro-component from .claude/prompts/record-failure.md to record the pattern in docs/context/error-patterns.md. This helps future sessions avoid the same diagnostic mistakes.
Phase 5: Verify and Document
- All tests pass (show output)
- The original error is no longer reproducible
- The fix addresses the root cause, not just the symptom
- Commit message explains what caused the bug and why
git add <files>
git commit -m "fix(<scope>): <what was fixed>
Root cause: <explanation>
Co-Authored-By: Claude <noreply@anthropic.com>"Skill metrics: Emit a completion event:
echo "{\"type\":\"skill\",\"event\":\"end\",\"skill\":\"debug-session\",\"outcome\":\"success\",\"ts\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"}" >> docs/sessions/.activity-log.jsonlExample
Input: /debug-session "TypeError: Cannot read properties of undefined (reading 'map')"
Output: Phase 1 → traced to `fetchUsers()` returning `undefined` when API returns 404
Phase 3 → hypothesis: missing error handling for non-200 responses
Phase 4 → added guard clause + regression test
Phase 5 → commit: "fix(api): handle non-200 response in fetchUsers"
Next Steps:
→ /story-cycle "[next story]" — continue with the next story
→ /sprint-end — if the fix was the last item in the sprint
→ /handoff — if ending the sessionRecovery
For phase-specific error recovery, consult references/error-recovery.md — search for the relevant ## Phase N section.
General recovery:
- Cannot reproduce: Gather more context. Check environment differences. Ask user for exact reproduction steps.
- Root cause unclear after investigation: Document findings so far. Ask user for additional context. Do NOT guess.
- Fix introduces new failures: Revert the fix. The original bug is better than two bugs.
- Timing/race condition: See
references/condition-based-waiting.md. Replace arbitrary sleeps with condition polling.
Rules
- NEVER apply a fix without understanding the root cause
- NEVER make multiple changes at once — one hypothesis, one change, one verification
- NEVER weaken or delete tests to make them pass
- NEVER say "it should work now" without showing test output
- If 3+ fixes fail, STOP and discuss the approach with the user
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
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.

