debug-session
Skill0 starsChanged 5 months agoMITView on GitHub
Use when something is broken and the cause isn't obvious. Trigger on: "it's not working", "tests are failing", "the build is broken", "nothing is running", "something weird is happening", "it worked before", "I don't know what changed", "rollback this", any error, crash, unexpected output, or regression. Also trigger when an agent made autonomous changes that need auditing or reversing. NOT for design reviews or refactoring — use code-review-session or refactor-session instead. Never assume cause — always diagnose before fixing.
- Reads credentials
- Deletes or force-pushes
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
- joris887/exosuittheir own version, first seen Aug 20, 2026
- pathorsAI/skillstheir own version, first seen Jul 20, 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
- joris887/exosuit★ 9same name
- manastalukdar/ai-devstudio★ 1same name
- jars-demo/jars-skills★ 0same name
- pathorsAI/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 repository10 other files it gives its agents.
- code-review-sessionSkill
- decision-logSkill
- devil-advocateSkill
- judge-panelSkill
- performance-tuningSkill
- pre-mortemSkill
- refactor-sessionSkill
- security-auditSkill
- spec-driven-devSkill
- tdd-workflowSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
36 rules. 0 are common, 31 are distinctive, and 5 are very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
31
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
- Distinctive: line 29
Before starting, route to the right approach:
- Distinctive: line 40
If a debug session isolates the problem to a UI behavior (not a code crash), stop and switch to browser-level investigation.
- Distinctive: line 46
Before investigating the specific bug, categorize it:
- Distinctive: line 55
If data: validate inputs first, check the pipeline upstream
- Distinctive: line 56
If logic: find the smallest reproducing case, binary-search for the breaking change
- Distinctive: line 57
If state: add logging at every state transition, check for concurrent access
- Distinctive: line 58
If environment: compare environments systematically (versions, configs, env vars)
- Distinctive: line 59
If integration: test the external dependency in isolation first
- Distinctive: line 69
Before asking the user anything, run these immediately:
- Distinctive: line 86
If the user gives a vague "it's broken" — run git commands first, then ask only the questions you can't self-answer.
- Distinctive: line 105
Don't debug what you can't reproduce.
- Distinctive: line 107
Run the exact failing command / interaction
- Distinctive: line 110
If intermittent → note the conditions that trigger it
- Distinctive: line 112
If it can't be reproduced:
- Distinctive: line 113
Check if it was a one-time environment issue
- Distinctive: line 114
Check for race conditions or async timing issues
- Distinctive: line 154
Before forming a hypothesis, collect raw evidence:
- Very specific: line 156
Log raw API response shape: Don't assume the shape — log JSON.stringify(response) or print(response) and read the actual output
- Very specific: line 158
Verify immutability: If state looks wrong in a UI framework, check for direct mutation (state.x = y instead of an immutable update)
- Distinctive: line 161
Only after collecting this evidence, proceed to form a hypothesis.
- Distinctive: line 190
Read the diff — what did it actually change vs what it said it changed?
- Distinctive: line 193
If an agent may have caused the bug, read the project's "Off-Limits" / "Hard Rules" sections first — these contain constraints agents …
- Distinctive: line 199
Only after Steps 3–5 are complete.
- Distinctive: line 204
Don't refactor while fixing — add that to a TODO
- Very specific: line 205
Add a comment if the fix is non-obvious: # Fixes: [what was wrong and why]
- Distinctive: line 208
Test in paper/sandbox mode first, always
- Distinctive: line 209
If fixing execution logic: write a unit test before applying the fix
- Distinctive: line 210
Never go live to "test" a fix
- Distinctive: line 219
Run the test suite: does anything new break?
- Very specific: line 221
Commit with a clear message: fix: [what was broken and what fixed it]
- Distinctive: line 229
After resolving, capture what happened so it doesn't repeat:
- Distinctive: line 233
Add a test: if the bug is reproducible and no test would have caught it
- Distinctive: line 243
Was the agent the cause?: Ask explicitly: "Did the agent produce the bug (wrong edit, wrong approach, wrong assumption)?" If yes, record …
- Distinctive: line 282
If changes broke things and you want to revert:
- Distinctive: line 301
Always confirm with the user before running git reset --hard — it discards changes permanently.
- Very specific: line 307
If the bug is elusive after 2+ hypotheses, suggest a different model's perspective (e.g.
“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
Hard Rules
- High-stakes systems first: Any issue touching irreversible side effects (live order execution, payments, production data writes, anything in a live-money or production financial system) is CRITICAL regardless of apparent severity. Stop and assess before proceeding.
- Never assume cause — always diagnose before fixing. State a hypothesis BEFORE changing any code.
- Fix one thing at a time — never bundle multiple fixes or refactor while fixing.
Debug Session — Systematic Root-Cause Diagnosis
A disciplined diagnose-before-fix workflow. The goal is to find the root cause, not patch the first symptom, and to leave the codebase with a regression test plus a captured insight so the same bug can't recur.
Routing: Debug vs. Browser/UI Testing
Before starting, route to the right approach:
| Situation | Use |
| App won't start, build fails, crash on load | This skill (debug-session) |
| Runtime error, logic bug, wrong data | This skill (debug-session) |
| "UI isn't doing what I expect visually" | Browser-automation testing (Playwright) |
| "Verify a specific UI interaction works" | Browser-automation testing (Playwright) |
| "Take a screenshot of the app" | Browser-automation testing (Playwright) |
| "Why isn't my button/form/component working?" | Start here → if no code error found, hand off to browser-automation testing |
If a debug session isolates the problem to a UI behavior (not a code crash), stop and switch to browser-level investigation.
Step 0: Step Back (before any diagnosis)
Before investigating the specific bug, categorize it:
- What category of failure is this?
- Data issue (wrong input, corrupt data, missing values, type mismatch)
- Logic error (wrong condition, off-by-one, incorrect algorithm)
- State bug (race condition, stale cache, incorrect initialization)
- Environment mismatch (works locally, fails in CI; dependency version; config difference)
- Integration failure (API changed, schema drift, timeout, auth expired)
- What general debugging principle applies?
- If data: validate inputs first, check the pipeline upstream
- If logic: find the smallest reproducing case, binary-search for the breaking change
- If state: add logging at every state transition, check for concurrent access
- If environment: compare environments systematically (versions, configs, env vars)
- If integration: test the external dependency in isolation first
- What's the most common cause for this category in this codebase? (Check any local record of past bugs/known failure modes if one exists.)
This narrows the search space BEFORE you read code. The category determines your strategy.
Step 1: Get the Situation
Before asking the user anything, run these immediately:
git diff # what changed in the working tree
git log --oneline -5 # recent commit historyFallback: If
git difffails (git not found, not a repo, or permission error), skip it and ask: "What changed since it last worked? Any recent file edits, installs, or commands?"
Prior-insight retrieval: Before diagnosing, check whatever local notes exist (project notes, prior-decisions file, persistent insight log) for past learnings in this domain. Grep for keywords from the error (module names, error types, domain tags). If a past insight matches, state it: "Previously learned: [insight]. Checking if it applies here." This prevents re-discovering the same root cause.
Then collect only what you still can't answer from context:
- What broke? (error message, wrong behavior, crash — exact output if possible)
- When did it last work? (last commit, last action, "never worked")
- What changed? — answer from
git diff/git logfirst; only ask if unclear - Can you reproduce it? — run the failing command directly first; only ask if intermittent
If the user gives a vague "it's broken" — run git commands first, then ask only the questions you can't self-answer.
Step 2: Triage — How Bad Is It?
| Severity | Definition | Action |
| 🔴 Critical | App won't start / data at risk / irreversible side effects affected | Stop everything, stabilize first |
| 🟠 High | Core feature broken, tests failing, build fails | Fix before new work |
| 🟡 Medium | Feature degraded, visual bug, non-critical test fail | Fix in current session |
| 🟢 Low | Minor cosmetic, edge case, nice-to-have | Log and schedule |
High-stakes note: Any issue touching live execution / payments / production writes = 🔴 Critical regardless of apparent severity. Stop and assess before proceeding.
Step 3: Reproduce
Don't debug what you can't reproduce. Steps:
- Run the exact failing command / interaction
- Capture the full error output (not just the last line)
- Confirm it's reproducible (not a fluke)
- If intermittent → note the conditions that trigger it
If it can't be reproduced:
- Check if it was a one-time environment issue
- Check for race conditions or async timing issues
- Try a clean restart (clear cache, restart dev server, fresh virtual environment)
Step 4: Isolate
Narrow down where the problem lives before touching code.
Frontend / web UI checklist:
- Capture browser console output via a browser-automation tool (agents can't open browser devtools directly)
- Network requests failing?
- Which component throws? (error-boundary message)
- Does it fail with mock data too, or only with live data?
- Does a clean dependency install + dev-server restart fix it?
- Any missing env vars?
Backend / service checklist:
- Full traceback — read the bottom of the stack trace first
- Which module raises? Is it your code or a library?
- Does it fail in isolation (unit test) or only in the full pipeline?
- Environment issue? (runtime version, virtual environment active, deps installed)
- Any
.envvars missing or misread? - If it's a financial/trading system: does it fail in paper/sandbox mode? (if so, don't test in live mode)
An agent made changes and broke something:
- Run
git diffto see exactly what changed - Run
git log --oneline -10to find the last known-good commit - Were there session notes describing what was being built?
Step 5: Diagnose
Root cause, not symptoms. Don't fix the first thing that looks wrong. Ask "Why did this happen?" at least twice. The first answer is usually a symptom. Infrastructure bugs especially tend to have a structural cause that recurs if you only patch the symptom. (Classic example: a series of "contamination" fixes that were all symptoms of one structural problem — a shared working directory.)
Step 5a: Gather Diagnostic Evidence
IMPORTANT: Log your hypothesis BEFORE running reproduce attempts. Without a hypothesis first, you're guessing — not debugging.
Before forming a hypothesis, collect raw evidence:
- Add temporary logging:
console.log('DEBUG:', variable)/print(f"DEBUG: {variable}")at the point of failure - Log raw API response shape: Don't assume the shape — log
JSON.stringify(response)orprint(response)and read the actual output - Check async/await coverage: Scan the call chain — every async function needs an
await; a missing one returns a Promise/coroutine object instead of the value - Verify immutability: If state looks wrong in a UI framework, check for direct mutation (
state.x = yinstead of an immutable update) - Check if the bug exists in isolation: Comment out surrounding code — does the issue persist with minimal input?
Only after collecting this evidence, proceed to form a hypothesis.
Form a hypothesis before writing any fix. State it explicitly:
"I think the issue is [X] because [evidence Y]. If I'm right, fixing [Z] should resolve it."
Evidence that supports a hypothesis > instinct. Common root causes by type:
Import / dependency errors:
- Missing package → install it
- Version mismatch → check the dependency manifest (
package.json/requirements.txt/ lockfile) - Circular import → restructure the module
Config / env errors:
- Missing
.envvar → add it - Wrong path → verify by printing/logging it
- Wrong port / host → check the config file
Logic errors:
- Off-by-one, wrong condition, inverted boolean
- Async timing (promise not awaited, callback order)
- State mutation (state directly mutated instead of via the framework's setter)
Data errors:
- API response shape changed
- Null/undefined where a value was expected
- Type mismatch (string vs number)
Agent-introduced errors:
- Read the diff — what did it actually change vs what it said it changed?
- Did it touch a file it shouldn't have? (cross-reference project rules / off-limits paths)
- Did it change shared utilities, breaking other things?
- If an agent may have caused the bug, read the project's "Off-Limits" / "Hard Rules" sections first — these contain constraints agents sometimes miss.
Step 6: Fix
Only after Steps 3–5 are complete.
Fix rules:
- Fix one thing at a time — don't bundle multiple fixes
- Make the smallest change that addresses the root cause
- Don't refactor while fixing — add that to a TODO
- Add a comment if the fix is non-obvious:
# Fixes: [what was wrong and why]
For high-stakes (trading/financial/production) fixes:
- Test in paper/sandbox mode first, always
- If fixing execution logic: write a unit test before applying the fix
- Never go live to "test" a fix
Step 7: Verify
After the fix:
- Reproduce the original failure → confirm it no longer occurs
- Run the test suite: does anything new break?
- Spot-check adjacent behavior — did the fix have side effects?
- Commit with a clear message:
fix: [what was broken and what fixed it]
Don't mark as resolved until verified.
Step 8: Capture
After resolving, capture what happened so it doesn't repeat:
- Add a project rule (in your agent-instructions file, e.g.
CLAUDE.md/AGENTS.md) if an agent was the cause or this is a common mistake to avoid - Log it in your project changelog/journal: what broke, what caused it, how it was fixed
- Add a test if the bug is reproducible and no test would have caught it
- Update
.claude/rules/(or equivalent rules dir) if there's a pattern to prevent - Persist the pattern to whatever cross-session memory you keep so future sessions don't repeat the diagnosis. Format:
"[BUG PATTERN]: [cause] → [fix]"— e.g.,"[API KeyError]: response shape changed in v2 → access data['result']['price'], not data['price']" - Extract a compact insight to your persistent notes, tagged with the relevant domain. Before writing, scan existing entries for the same tag — consolidate rather than duplicate. Format:
Tag with the domain (e.g.,[DATE] [tag] INSIGHT: [root cause in one sentence] [DATE] [tag] WHY: [why it wasn't obvious / what made it tricky][data],[ml],[api],[auth]) for future retrieval.
Was the agent the cause? Ask explicitly: "Did the agent produce the bug (wrong edit, wrong approach, wrong assumption)?" If yes, record the mistake pattern, check whether it's a repeat, and promote repeats into your hard-rules file so they can't recur.
Platform-Specific Checks (when on Windows)
- Encoding: prefix Python scripts with
PYTHONUTF8=1(cp1252 vs UTF-8 mismatches) - Paths: use forward slashes or raw strings; never backslash in Python imports
- Signal handlers: use
try/except, notadd_signal_handler(not supported on Windows) - Shell: verify
which bashworks; PowerShell behaves differently for shell scripts
Quick Reference: Common Errors
Frontend / web UI
| Error | Likely Cause | Quick Fix |
| White screen / blank render | UI framework crash — check console | Capture console output via browser automation |
Cannot read properties of undefined | Data not loaded before render | Add loading state / null check |
| Styles missing | Utility class not in config | Check class name, check the CSS/build config |
| API 404 | Wrong endpoint or dev server not running | Confirm the dev server is running |
| Stale UI after change | Hot reload failed | Hard refresh (Ctrl+Shift+R) |
Backend / service
| Error | Likely Cause | Quick Fix |
ModuleNotFoundError | Package not installed | Install it / activate the correct virtual environment |
KeyError on API response | API response shape changed | Print the raw response and inspect |
| Logic not triggering | Condition / branch not met | Add debug logging where the condition is evaluated |
| Request rejected by an external service | Input exceeds a limit | Check the relevant limit/config value |
AttributeError on config | Missing key or wrong default | Check the config module and class defaults |
Bug appears in two repos at once: Likely a shared dependency. Debug each repo independently first; check shared tooling (runtime, package manager, git, virtual environment) last.
Rollback Procedure
If changes broke things and you want to revert:
# See what changed
git diff HEAD
# Unstage (keeps working-tree changes)
git reset HEAD
# Discard all working-tree changes
git reset --hard HEAD
# Revert a specific file only
git checkout HEAD -- path/to/file.py
# Go back to a specific commit
git log --oneline -10 # find the commit hash
git reset --hard <hash> # go back to itAlways confirm with the user before running git reset --hard — it discards changes permanently.
Second Opinion
If the bug is elusive after 2+ hypotheses, suggest a different model's perspective (e.g. codex exec 'Find the bug in this diff'). If the bug involves an external API/library behaving unexpectedly, suggest verifying the documented behavior with a grounded search tool (e.g. gemini -p 'Does [API/function] actually work this way? Check the docs.').
Trigger Conditions
- "It's not working", "tests are failing", "the build is broken", "nothing is running"
- "Something weird is happening", "it worked before", "I don't know what changed"
- "Rollback this" / any request to audit or reverse autonomous agent changes
- Any error, crash, unexpected output, or regression where the cause isn't obvious
Out of Scope
- An agent produced structurally wrong output (missed requirements, ignored instructions, added unwanted scope) → that's a reasoning bug, not a code bug; analyze the prompt/response instead
- "You missed the point", "that's not what I asked" → reasoning analysis, not this skill
- Design reviews → use code-review-session
- Refactoring → use refactor-session
- This skill is for CODE bugs (crashes, test failures, broken builds), not model-reasoning failures.
Common Traps
- Chasing symptoms instead of root cause: A
TypeErroron line 50 may be caused by bad data on line 12. Trace the data flow backward from the error site before fixing at the crash point. - Tests pass but prod fails: Tests often use mocked data or a clean environment. Bugs that only appear with real data, stale cache, or platform-specific behavior (encoding, timezone) won't be caught by unit tests. Reproduce in the closest-to-prod environment available.
- Fixing two things at once: Bundling a "quick cleanup" with a bug fix makes it impossible to tell which change resolved the issue — and if it regresses, you can't bisect cleanly.
- Assuming the error message is the bug: Error messages describe what failed, not why. "Connection refused" might be a missing env var, not a network issue. Read the full stack trace and check preconditions before trusting the message.
- Skipping diagnostic evidence (Step 5a): Jumping to a hypothesis without logging actual values leads to "I thought it was X" debugging loops. Always add temporary logging and read real output before forming a theory.
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.

