agentleFS
bhaumikmaanbhaumikmaan/claude-code-master-skills/skills/systematic-debugging/SKILL.md

systematic-debugging

Skill3 starsChanged 7 months agoMITView on GitHub

Structured diagnosis of bugs, errors, and stuck processes. Maps symptoms to hypotheses, uses bounded log reading, and produces actionable reports. Use when debugging errors, investigating stuck processes, diagnosing performance issues, or when something isn't working as expected.

190 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use chinese-code-review, chinese-commit-conventions and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • Leodorareluctant259Skill

    chinese-code-review

    中文代码审查规范——在保持专业严谨的同时,用符合国内团队文化的方式给出有效反馈

    Also in 8 projects that use this

  • Leodorareluctant259Skill

    chinese-commit-conventions

    中文 Git 提交规范 — 适配国内团队的 commit message 规范和 changelog 自动化

    Also in 8 projects that use this

  • obraSkill

    diagnosing-superpowers

    Use when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.

    Also in 20 projects that use this

  • mjunaidcaSkill

    building-chatgpt-apps

    Guides creation of ChatGPT Apps with interactive widgets using OpenAI Apps SDK and MCP servers. Use when building ChatGPT custom apps with visual UI components, embedded widgets, or rich interactive experiences. Covers widget architecture, MCP server setup with FastMCP, response metadata, and Developer Mode configuration. NOT when building standard MCP servers without widgets (use building-mcp-servers skill instead).

    Also in 4 projects that use this

  • mjunaidcaSkill

    building-chat-interfaces

    Build AI chat interfaces with custom backends, authentication, and context injection. Use when integrating chat UI with AI agents, adding auth to chat, injecting user/page context, or implementing httpOnly cookie proxies. Covers ChatKitServer, useChatKit, and MCP auth patterns. NOT when building simple chatbots without persistence or custom agent integration.

    Also in 4 projects that use this

  • +2 more from Leodorareluctant259
  • +5 more from mjunaidca

The file

Show its rules and text

We split this skill into the rules it gives an agent

28 rules. 0 are common, 21 are distinctive, and 7 are very specific to this project.

  • 0

    Common

    Most of the 177 edited versions we read keep these.

  • 21

    Distinctive

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Don't report when healthy.

    line 14
  2. Distinctive:

    Don't kill or signal processes unless explicitly asked.

    line 15
  3. Distinctive:

    Read errors before guessing causes.

    line 16
  4. Distinctive:

    Start here. Match the symptom to candidate hypotheses, then investigate:

    line 21
  5. Distinctive:

    Read the error message / stack trace carefully.

    line 39
  6. Distinctive:

    Check recent changes: git log --oneline -10 and git diff — was something just changed?

    line 40
  7. Distinctive:

    Read relevant log files. Use bounded reading: tail the last 50-100 lines, don't read the entire log.

    line 41
  8. Distinctive:

    If the issue isn't visible in current logs:

    line 44
  9. Distinctive:

    Ask the user to reproduce the issue

    line 46
  10. Distinctive:

    Run the most discriminating check first.

    line 52
  11. Distinctive:

    If the first hypothesis is disproven, move to the next — don't cling to your initial guess.

    line 53
  12. Very specific:

    Use Grep with -C 5 context to search for error patterns in logs and code without reading entire files.

    line 56
  13. Very specific:

    Use head_limit on Grep to avoid drowning in results.

    line 57
  14. Distinctive:

    Only Read full files after Grep confirms they're relevant.

    line 58
  15. Distinctive:

    When debugging spans >5 files, spawn a subagent via the Agent tool for isolated investigation.

    line 59
  16. Distinctive:

    Verify the fix by reproducing the original failure scenario — it should now succeed.

    line 63
  17. Distinctive:

    Check for regressions in related functionality.

    line 64
  18. Distinctive:

    If you can't verify (no repro, no test), say so explicitly.

    line 65
  19. Distinctive:

    Tail first: Read the last 50-100 lines to find recent errors.

    line 71
  20. Very specific:

    Grep for severity: Search for [ERROR], [WARN], FATAL, panic, Exception, traceback across the full file.

    line 72
  21. Distinctive:

    Use offset/limit: When you find a relevant line number, read just that region with surrounding context.

    line 73
  22. Distinctive:

    Check file size first: If a log is >1MB, definitely use targeted reads, not full file reads.

    line 74
  23. Distinctive:

    When reporting findings, use this two-part structure:

    line 78
  24. Distinctive:

    When investigating stuck or slow processes:

    line 97
  25. Very specific:

    Use codebase-exploration patterns to trace code paths during investigation.

    line 118
  26. Very specific:

    Use effective-tool-use patterns when running diagnostic commands safely.

    line 119
  27. Very specific:

    After fixing, apply code-verification patterns to prove the fix works.

    line 120
  28. Very specific:

    If user-config.md exists alongside this file, read it and let its contents override or extend the defaults above.

    line 124

“Common” is measured: kept by at least 6 in 10 of the 177 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Systematic Debugging

CRITICAL: This is a diagnostic skill. Investigate first, fix second. Don't guess — gather evidence.

Diagnostic Mindset

  • Don't report when healthy. If everything looks fine, say so directly — don't manufacture issues.
  • Don't kill or signal processes unless explicitly asked. This is diagnostic only.
  • Read errors before guessing causes. The error message is the first evidence.
  • Reproduce before fixing. A fix you can't verify is a guess.

Symptom-to-Hypothesis Map

Start here. Match the symptom to candidate hypotheses, then investigate:

SymptomLikely HypothesesFirst Investigation
High CPU (≥90% sustained)Infinite loop, runaway regex, tight pollingSample twice 1-2s apart to confirm sustained; check stack/profile
Process in D state (uninterruptible sleep)I/O hang, disk full, NFS stall, lock contentionCheck dmesg, disk usage, mount status
Process in T state (stopped)Accidental Ctrl+Z, debugger attachedCheck parent process, fg to resume
Zombie process (Z state)Parent not reaping childrenCheck parent PID, signal parent
High memory (≥4GB RSS)Memory leak, unbounded cache, large dataset loadedCheck growth over time, heap snapshot if available
Slow responseN+1 queries, blocking I/O on hot path, missing indexProfile request, check DB query count and timing
Hung child processWaiting for stdin, deadlock, network timeoutpgrep -lP <pid>, check child's full command line
Intermittent failureRace condition, resource exhaustion, DNS flakeCheck timing patterns, add logging, reproduce under load
Build failureDependency version mismatch, stale cache, missing env varClean build, check lock file, diff with working state
Test failure (flaky)Shared state, timing dependency, order dependencyRun test in isolation, check setup/teardown, look for shared mutable state

Investigation Steps

1. Gather Context

  • Read the error message / stack trace carefully. Most errors tell you exactly what's wrong.
  • Check recent changes: git log --oneline -10 and git diff — was something just changed?
  • Read relevant log files. Use bounded reading: tail the last 50-100 lines, don't read the entire log.

2. Enable Logging If Needed

If the issue isn't visible in current logs:

  • Enable debug/verbose logging for the affected component
  • Ask the user to reproduce the issue
  • Re-read the log after reproduction

3. Form and Test Hypotheses

  • Based on symptoms and gathered evidence, form 1-3 hypotheses ranked by likelihood.
  • For each hypothesis, identify one specific check that would confirm or eliminate it.
  • Run the most discriminating check first.
  • If the first hypothesis is disproven, move to the next — don't cling to your initial guess.

4. Narrow Down

  • Use Grep with -C 5 context to search for error patterns in logs and code without reading entire files.
  • Use head_limit on Grep to avoid drowning in results.
  • Only Read full files after Grep confirms they're relevant. Glob (near-zero tokens) → Grep (lightweight) → Read (heavy).
  • When debugging spans >5 files, spawn a subagent via the Agent tool for isolated investigation.

5. Fix and Verify

  • Make the minimal fix that addresses the root cause, not the symptom.
  • Verify the fix by reproducing the original failure scenario — it should now succeed.
  • Check for regressions in related functionality.
  • If you can't verify (no repro, no test), say so explicitly.

Bounded Log Reading

Logs can be enormous. Never read an entire log file.

  • Tail first: Read the last 50-100 lines to find recent errors.
  • Grep for severity: Search for [ERROR], [WARN], FATAL, panic, Exception, traceback across the full file.
  • Use offset/limit: When you find a relevant line number, read just that region with surrounding context.
  • Check file size first: If a log is >1MB, definitely use targeted reads, not full file reads.

Bug Report Format

When reporting findings, use this two-part structure:

Short Summary (1-2 sentences)

What's wrong, which component, and the severity. This is what the reader sees first.

Example: "Auth service returning 500 on /login — null pointer at session.validate()
when session cookie is expired but token is still cached."

Detailed Thread

  • Symptom: What was observed (exact error messages, status codes, behavior)
  • Root cause: What's actually wrong and why (with evidence — file paths, line numbers, log excerpts)
  • Evidence: Commands run and their output (copy-paste, not paraphrased)
  • Fix: What was changed or what should be changed (specific files and lines)
  • Verification: How the fix was verified, or why it couldn't be verified

Process Diagnostics

When investigating stuck or slow processes:

# List processes with CPU, memory, state, and uptime
ps -axo pid=,pcpu=,rss=,etime=,state=,comm=,command= | grep -E '<process_name>'

# Check child processes
pgrep -lP <pid>

# Sample CPU usage (confirm sustained, not transient)
# Check twice with 1-2s gap
  • Filter to relevant processes. Don't dump the entire process table.
  • Sample CPU twice to confirm sustained high usage (transient spikes are normal).
  • For hung children, get the full command line: ps -p <child_pid> -o command=

CRITICAL REMINDER: Investigate before fixing. Bound your log reads. Report only real issues — don't manufacture problems from healthy systems. Reproduce, then fix, then verify.

Related Skills

  • Use codebase-exploration patterns to trace code paths during investigation.
  • Use effective-tool-use patterns when running diagnostic commands safely.
  • After fixing, apply code-verification patterns to prove the fix works.

Project Customization

If user-config.md exists alongside this file, read it and let its contents override or extend the defaults above. Common customizations:

  • Project-specific log locations and formats
  • Common failure modes for this system
  • Diagnostic commands specific to the tech stack
  • Escalation procedures for production issues

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.