claude-code-framework/essential/skills/workflow/systematic-debugging/SKILL.md
Methodical debugging using reproducible steps, instrumentation, and root-cause analysis. Use when something is broken and you don't know why. Triggers on "bug", "broken", "not working", "error", "fails intermittently", "regression", "unexpected behavior".
npx skillsauth add tokenized2027/claude-initilization-v7 systematic-debuggingInstall 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.
Debug methodically, not randomly. Every bug has a root cause — find it through structured investigation, not guessing.
Random debugging ("let me try changing this...") wastes hours. Agents especially burn through tokens and context windows guessing. This skill enforces a reproducible investigation flow.
Before touching any code:
# Capture the exact error
# Run the failing command/test and save full output
[COMMAND] 2>&1 | tee /tmp/debug-output.txt
Checklist:
If the bug is intermittent:
# Run the operation N times and count failures
for i in $(seq 1 20); do [COMMAND] && echo "PASS" || echo "FAIL"; done
Narrow down WHERE the bug lives. Work from outside in:
Network layer: Is the request reaching the server?
curl -v [ENDPOINT] 2>&1 | head -30
Application layer: Is the right code path executing?
# Add temporary logging at entry points
console.log('[DEBUG] handler reached', { params, timestamp: Date.now() })
Data layer: Is the data what you expect?
# Query the database directly
docker exec -it [DB_CONTAINER] psql -U [USER] -d [DB] -c "SELECT * FROM [TABLE] WHERE [CONDITION] LIMIT 5;"
Dependency layer: Did an external service change?
# Check dependency versions
npm ls [PACKAGE]
pip show [PACKAGE]
Write ONE sentence: "I believe the bug is caused by [X] because [evidence]."
Good hypothesis: "The API returns 500 because the database query times out when the results exceed 1000 rows — the error only occurs on the /analytics endpoint with date ranges > 30 days."
Bad hypothesis: "Something is wrong with the database."
Design a test that proves or disproves your hypothesis. The test should:
# Example: Test if the timeout is the issue
# Temporarily increase timeout to 60s
# If the bug disappears → hypothesis confirmed
# If the bug persists → hypothesis disproven, return to Step 2
npm test # or pytest, etc.
Write a brief for the memory system:
## Bug Report: [Short Description]
- **Symptom:** [What the user/system saw]
- **Root Cause:** [Why it happened]
- **Fix:** [What was changed]
- **Prevention:** [How to avoid this class of bug]
- **Files Changed:** [List]
# Check environment variables
docker exec [CONTAINER] env | sort > /tmp/docker-env.txt
env | sort > /tmp/local-env.txt
diff /tmp/local-env.txt /tmp/docker-env.txt
# Check file permissions
docker exec [CONTAINER] ls -la /app/
# Check DNS resolution
docker exec [CONTAINER] nslookup [SERVICE_NAME]
# Find what changed
git log --oneline --since="yesterday" --all
git diff HEAD~5 --stat
# Binary search for the breaking commit
git bisect start
git bisect bad HEAD
git bisect good [LAST_KNOWN_GOOD_COMMIT]
# Run test at each step
# Trace the data flow
# 1. Check what the client sends
curl -X POST [URL] -d '[PAYLOAD]' -v 2>&1
# 2. Check what the server receives (add request logging)
# 3. Check what the database returns (query directly)
# 4. Check what the server sends back (response logging)
# 5. Check what the client receives (browser devtools / curl output)
# For Node.js
node --inspect [SCRIPT]
# Then connect Chrome DevTools to chrome://inspect
# For Python
python -m cProfile -s cumtime [SCRIPT]
# For Docker containers
docker stats [CONTAINER]
When invoked by the orchestrator:
fix: [description] — root cause: [cause]✅ Use systematic-debugging when:
❌ Don't use systematic-debugging for:
| Step | Action | Output | |------|--------|--------| | 1. Reproduce | Trigger the bug on demand | Exact error + reproduction steps | | 2. Isolate | Narrow to layer + component | "Bug is in [X]" | | 3. Hypothesize | One sentence theory | "Caused by [X] because [Y]" | | 4. Test | Change one thing | Confirmed or disproven | | 5. Fix | Minimal change | Working code + passing tests | | 6. Document | Root cause report | Memory entry for prevention |
development
Optimize prompts for Claude Code agents, API calls, and multi-agent orchestration. Use when writing system prompts, agent instructions, or refining LLM interactions. Triggers on "improve prompt", "write a prompt", "agent instructions", "system prompt", "prompt not working", "LLM output quality".
tools
Structured ideation and design review before any creative or constructive work. Use before building features, components, architecture, dashboards, or automation workflows. Triggers on "plan this", "design this", "brainstorm", "think through", "what should we build", "how should I approach".
testing
Generates test files for components and functions with setup, basic tests, and mocks. Use when user says "add tests", "create test", "test this component", or mentions testing.
development
Generates React components with TypeScript, props interface, and example usage. Use when user says "create component", "new component", "add React component", or mentions creating UI elements.