skills/avad-debug/SKILL.md
Systematic debugging with root cause investigation. Four phases: investigate, analyze, hypothesize, implement. Iron Law: no fixes without root cause. Use when asked to "debug this", "fix this bug", "why is this broken", "investigate this error", or "root cause analysis". Proactively suggest when the user reports errors, unexpected behavior, or is troubleshooting why something stopped working.
npx skillsauth add agwacom/avadbot avad-debugInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST.
Fixing symptoms creates whack-a-mole debugging. Every fix that doesn't address root cause makes the next bug harder to find. Find the root cause, then fix it.
Gather context before forming any hypothesis.
Collect symptoms: Read the error messages, stack traces, and reproduction steps. If the user hasn't provided enough context, ask ONE question at a time via AskUserQuestion.
Read the code: Trace the code path from the symptom back to potential causes. Use Grep to find all references, Read to understand the logic.
Check recent changes:
git log --oneline -20 -- <affected-files>
Was this working before? What changed? A regression means the root cause is in the diff.
Reproduce: Can you trigger the bug deterministically? If not, gather more evidence before proceeding.
Output: "Root cause hypothesis: ..." — a specific, testable claim about what is wrong and why.
After forming your root cause hypothesis, strongly consider locking edits to the affected module to prevent scope creep. This is the #1 way debug sessions go sideways — a fix in one area triggers "while I'm here" changes elsewhere.
[ -x "${CLAUDE_SKILL_DIR}/../avad-freeze/bin/check-freeze.sh" ] && echo "FREEZE_AVAILABLE" || echo "FREEZE_UNAVAILABLE"
If FREEZE_AVAILABLE: Identify the narrowest directory containing the affected files and suggest it to the user:
Scope lock recommended. The affected files are in
<detected-directory>/. Run/avad-freezeto restrict edits to that directory for this debug session. This prevents accidental changes to unrelated code. Run/avad-unfreezeto remove the restriction when done.
If the bug spans the entire repo or the scope is genuinely unclear, skip the lock and note why.
If FREEZE_UNAVAILABLE: Skip scope lock. Edits are unrestricted.
Check if this bug matches a known pattern:
| Pattern | Signature | Where to look | |---------|-----------|---------------| | Race condition | Intermittent, timing-dependent | Concurrent access to shared state | | Nil/null propagation | NoMethodError, TypeError | Missing guards on optional values | | State corruption | Inconsistent data, partial updates | Transactions, callbacks, hooks | | Integration failure | Timeout, unexpected response | External API calls, service boundaries | | Configuration drift | Works locally, fails in staging/prod | Env vars, feature flags, DB state | | Stale cache | Shows old data, fixes on cache clear | Redis, CDN, browser cache, Turbo |
Also check:
TODOS.md for related known issuesgit log for prior fixes in the same area — recurring bugs in the same files are an architectural smell, not a coincidenceExternal pattern search: If the bug doesn't match a known pattern above, WebSearch for:
If WebSearch is unavailable, skip this search and proceed with hypothesis testing. If a documented solution or known dependency bug surfaces, present it as a candidate hypothesis in Phase 3.
Before writing ANY fix, verify your hypothesis.
Confirm the hypothesis: Add a temporary log statement, assertion, or debug output at the suspected root cause. Run the reproduction. Does the evidence match?
If the hypothesis is wrong: Before forming the next hypothesis, consider searching for the error. Sanitize first — strip hostnames, IPs, file paths, SQL fragments, customer identifiers, and any internal/proprietary data from the error message. Search only the generic error type and framework context: "{component} {sanitized error type} {framework version}". If the error message is too specific to sanitize safely, skip the search. If WebSearch is unavailable, skip and proceed. Then return to Phase 1. Gather more evidence. Do not guess.
3-strike rule: If 3 hypotheses fail, STOP. Use AskUserQuestion:
3 hypotheses tested, none match. This may be an architectural issue
rather than a simple bug.
A) Continue investigating — I have a new hypothesis: [describe]
B) Escalate for human review — this needs someone who knows the system
C) Add logging and wait — instrument the area and catch it next time
Red flags — if you see any of these, slow down:
Once root cause is confirmed:
Fix the root cause, not the symptom. The smallest change that eliminates the actual problem.
Minimal diff: Fewest files touched, fewest lines changed. Resist the urge to refactor adjacent code.
Write a regression test that:
Run the full test suite. Paste the output. No regressions allowed.
If the fix touches >5 files: Use AskUserQuestion to flag the blast radius:
This fix touches N files. That's a large blast radius for a bug fix.
A) Proceed — the root cause genuinely spans these files
B) Split — fix the critical path now, defer the rest
C) Rethink — maybe there's a more targeted approach
Fresh verification: Reproduce the original bug scenario and confirm it's fixed. This is not optional.
Run the test suite and paste the output.
Output a structured debug report:
DEBUG REPORT
════════════════════════════════════════
Symptom: [what the user observed]
Root cause: [what was actually wrong]
Fix: [what was changed, with file:line references]
Evidence: [test output, reproduction attempt showing fix works]
Regression test: [file:line of the new test]
Related: [TODOS.md items, prior bugs in same area, architectural notes]
Status: DONE | DONE_WITH_CONCERNS | BLOCKED
════════════════════════════════════════
data-ai
Clear the freeze boundary set by /avad-freeze, allowing edits to all directories again. Use when you want to widen edit scope without ending the session. Use when asked to "unfreeze", "unlock edits", "remove freeze", or "allow all edits".
testing
Ship workflow: validate branch state, sync with target branch, run tests, pre-landing review, push, and create PR. Project-aware — reads target branch, test commands, and review checklist from docs/GIT_WORKFLOW.md.
development
Pre-landing code review. Analyzes diff for structural issues using a project-specific checklist. Two modes: local (review current branch) or PR (review and comment on a GitHub PR by number). Proactively suggest when the user is about to merge or land code changes.
development
Weekly engineering retrospective. Analyzes commit history, work patterns, and code quality metrics with persistent history and trend tracking. Team-aware: breaks down per-person contributions with praise and growth areas.