systematic-debugging
Skill9 starsChanged 8 months agoMITView on GitHub
**Systematic Debugging Methodology**: Provides structured approaches to diagnose and fix bugs in any technology stack. Covers scientific debugging method, binary search for bugs, log analysis, memory/performance debugging, distributed system debugging, and production incident investigation. Use whenever the user is stuck debugging, says 'I can't figure out this bug', 'why is this failing', 'this doesn't work', 'help me debug', 'what's wrong with this code', 'error investigation', 'production issue', 'intermittent bug', 'flaky test', 'memory leak', 'race condition', or is dealing with any kind of software defect they need help diagnosing.
191 other projects use a version of this.
Adopted by
Most recently taken up by
- ctaxnagomi/agent-kd-skilltheir own version, first seen Nov 29, 2026
- Dannykkh/skill-olympustheir own version, first seen Nov 29, 2026
- hybridlabor-api/aostheir own version, first seen Nov 29, 2026
- autohandai/community-skillstheir own version, first seen Nov 29, 2026
- MorningStar0709/trae-agent-enhancementstheir own version, first seen Nov 29, 2026
- genfeedai/genfeed.aitheir own version, first seen Nov 29, 2026
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.
Leodorareluctant259Skillchinese-code-review
中文代码审查规范——在保持专业严谨的同时,用符合国内团队文化的方式给出有效反馈
Also in 8 projects that use this
Leodorareluctant259Skillchinese-commit-conventions
中文 Git 提交规范 — 适配国内团队的 commit message 规范和 changelog 自动化
Also in 8 projects that use this
obraSkilldiagnosing-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 21 projects that use this
SethGammonSkillascii-diagram
Generate perfectly aligned ASCII diagrams — architecture, flow, sequence, box-and-arrow. Uses a programmatic character-grid approach so alignment is guaranteed by math, not token prediction. Includes post-render verification.
Also in 4 projects that use this
mjunaidcaSkillbuilding-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
mjunaidcaSkillbuilding-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
- +4 more from mjunaidca
Other versions191 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 191
- obra/superpowers★ 314ksame name
- NousResearch/hermes-agent★ 267ksame name
- open-metadata/OpenMetadata★ 16ksame name
- mdiri-ai/SoduWork★ 9.1ksame name
- jnMetaCode/superpowers-zh★ 8.6ksame name
- openai/plugins★ 8.4ksame name
- vudovn/ag-kit★ 8.2ksame name
- vudovn/antigravity-kit★ 8.2ksame name
- ChrisWiles/claude-code-showcase★ 6.1ksame name
- farm-fe/farm★ 5.6ksame name
181 more not listed
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 repository53 other files it gives its agents.
- adrSkill
- ai-ml-engineeringSkill
- api-documentationSkill
- api-gateway-patternsSkill
- architecture-review-boardSkill
- backend-reviewSkill
- chaos-engineeringSkill
- code-reviewSkill
- compliance-reviewSkill
- cost-optimizationSkill
- csharp-dotnet-reviewSkill
- database-reviewSkill
- data-engineeringSkill
- design-patternsSkill
- developer-experienceSkill
- devops-infraSkill
- domain-modelingSkill
- elixir-reviewSkill
- engineering-budgetSkill
- engineering-metricsSkill
- event-driven-architectureSkill
- feature-flagsSkill
- flutter-reviewSkill
- frontend-reviewSkill
- full-reviewSkill
- git-flowSkill
- go-reviewSkill
- graphql-reviewSkill
- health-checkSkill
- incident-postmortemSkill
- kubernetes-reviewSkill
- migration-strategySkill
- multi-tenancySkill
- observabilitySkill
- on-call-designSkill
- one-on-oneSkill
- pentestSkill
- performance-profilingSkill
- pr-descriptionSkill
- python-reviewSkill
- quality-standardSkill
- rust-reviewSkill
- security-reviewSkill
- sprint-planningSkill
- swift-reviewSkill
- team-scalingSkill
- tech-debt-prioritizationSkill
- technical-interviewSkill
- tech-specSkill
- terraform-iacSkill
- testing-strategySkill
- ux-reviewSkill
- vendor-evaluationSkill
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 7 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 178 edited versions we read keep these.
7
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 27
Never skip steps. The most common debugging failure is jumping from OBSERVE to a fix without testing the hypothesis.
- Distinctive: line 31
Before touching code, answer these questions:
- Distinctive: line 88
When you don't know where the bug is, use divide-and-conquer:
- Distinctive: line 111
If the bug only affects certain inputs:
- Distinctive: line 114
Remove data fields one by one until it stops
- Distinctive: line 196
When you can't reproduce locally:
- Distinctive: line 199
Read-only database queries to inspect state
“Common” is measured: kept by at least 6 in 10 of the 178 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
Systematic Debugging Methodology
You are a senior engineer helping debug issues methodically. The biggest debugging mistake is jumping to conclusions — resist the urge to guess and instead follow a structured process. Every bug is logical; the code is doing exactly what it was told to do.
The Scientific Debugging Method
1. OBSERVE → Gather symptoms and data
2. HYPOTHESIZE → Form a testable theory
3. PREDICT → What would be true if the hypothesis is correct?
4. TEST → Run an experiment to confirm or refute
5. CONCLUDE → Either fix it or form a new hypothesisNever skip steps. The most common debugging failure is jumping from OBSERVE to a fix without testing the hypothesis.
Step 1: Observe — Gather Information
Before touching code, answer these questions:
What is the expected behavior?
- What should happen according to the spec/user story?
- Did this ever work? When did it stop?
What is the actual behavior?
- Exact error message (not paraphrased)
- Stack trace (full, not truncated)
- HTTP status code, response body
- Console output, log entries
What are the conditions?
- Reproducible or intermittent?
- Steps to reproduce (minimal set)
- Which environment? (local, staging, production)
- Which users/accounts/data affected?
- What changed recently? (deploy, config, dependency update)
Collect evidence:
# Recent changes
git log --oneline -20
git log --since="3 days ago" --oneline
# Recent deploys
# (check your CI/CD system)
# Relevant logs
# Tail application logs, filter by error level
# Check for correlation: timestamp of first occurrence vs deploys
# System state
# CPU, memory, disk, network
# Database connections, queue depth
# Cache hit ratesStep 2: Hypothesize — Form Theories
List possible causes ranked by likelihood. Consider:
Common bug categories:
- State bug — Variable has unexpected value at some point
- Timing bug — Race condition, async ordering, timeout
- Data bug — Corrupt input, encoding issue, null/undefined
- Integration bug — API contract mismatch, version incompatibility
- Configuration bug — Wrong env var, missing secret, feature flag
- Resource bug — Memory leak, connection pool exhaustion, disk full
Ask yourself:
- What's the simplest explanation?
- What changed between "it worked" and "it broke"?
- Is this a new bug or a latent bug exposed by new conditions?
Step 3: Narrow Down — Binary Search
When you don't know where the bug is, use divide-and-conquer:
In code (bisect the execution path)
Add a log/breakpoint at the midpoint of the suspected code path.
Is the state correct at this point?
YES → Bug is in the second half. Move midpoint forward.
NO → Bug is in the first half. Move midpoint backward.
Repeat until you find the exact line where state goes wrong.In time (git bisect)
git bisect start
git bisect bad # Current commit is broken
git bisect good abc123 # This commit was working
# Git checks out middle commit — test it
git bisect good # or git bisect bad
# Repeat until Git identifies the breaking commit
git bisect reset # When doneIn data
If the bug only affects certain inputs:
- Does it happen with the smallest possible input?
- Does it happen with a different user/account?
- Remove data fields one by one until it stops
Step 4: Common Debugging Patterns
Async / Timing Bugs
Symptoms: "Works sometimes", "works locally but not in CI", "works on retry"
Checklist:
- Are you awaiting all promises? (missing await)
- Are callbacks firing in the expected order?
- Is there a race between two concurrent operations?
- Are you relying on execution speed rather than explicit ordering?
- Is there a timeout that's too short for the environment?
- Connection pool exhaustion under load?Technique: Add timestamps to logs to see actual execution order vs expected.
Null / Undefined Bugs
Symptoms: "Cannot read property X of undefined", NullPointerException
Trace backward:
1. WHAT is null/undefined? (the variable name)
2. WHERE does it get its value? (assignment, function return, API response)
3. WHY is the source returning null? (missing data, wrong query, timing)Memory Leaks
Symptoms: Increasing memory over time, OOM kills, degrading performance
Usual suspects:
- Event listeners not cleaned up
- Growing arrays/maps never pruned (caches without eviction)
- Closures holding references to large objects
- Database connections not released
- Streams not properly closed
Investigation:
- Take heap snapshots at intervals, compare what's growing
- Check for objects that should be garbage collected but aren't
- Look for patterns: does memory correlate with requests, time, or data volume?Distributed System Bugs
Symptoms: "Works with one instance", inconsistent behavior, data inconsistency
Checklist:
- Is the operation idempotent? (what happens on retry?)
- Is there a distributed lock/ordering needed?
- Are you assuming single-instance state? (in-memory cache, local files)
- Network partitions: what happens when service B is unreachable?
- Message ordering: are events processed in the expected sequence?
- Clock skew: are you comparing timestamps across servers?
Technique: Trace requests with correlation IDs across services.Flaky Tests
Symptoms: "Passes locally, fails in CI", "fails 1 in 10 runs"
Common causes:
- Test order dependency (shared state between tests)
- Time-dependent logic (timezone, "now" in tests)
- Async operations without proper waits
- External dependency (database, API, file system)
- Resource contention (port conflict, parallel tests hitting same DB)
Fix: Run the failing test in isolation, then with different test orderings.Step 5: Production Debugging
When you can't reproduce locally:
Safe investigation techniques:
- Read-only database queries to inspect state
- Log analysis with correlation IDs
- Distributed tracing (Jaeger, DataDog, X-Ray)
- Feature flags to isolate code paths
- Canary deploys to test fixes on a subset
Avoid in production:
- Attaching debuggers (use only as last resort with coordination)
- Making schema changes to investigate
- Adding verbose logging without log level controls
- Running load generators against production
Debugging Checklist Template
# Bug Investigation: [Title]
## Symptoms
- [ ] Error message:
- [ ] Stack trace collected:
- [ ] Reproduction steps:
- [ ] Environment:
- [ ] First occurrence:
- [ ] Frequency: consistent / intermittent
## Context
- [ ] Recent deploys:
- [ ] Recent config changes:
- [ ] Affected users/scope:
- [ ] Related logs:
## Hypotheses
1. [Most likely cause] — Test: [how to verify]
2. [Alternative cause] — Test: [how to verify]
3. [Long shot] — Test: [how to verify]
## Investigation Log
| Time | Action | Result |
|------|--------|--------|
| | | |
## Root Cause
[What actually caused the bug]
## Fix
[What was changed and why]
## Prevention
[How to prevent this class of bug in the future — test, lint rule, monitoring, etc.]Golden Rules
- Read the error message — The answer is often right there. Read it slowly, word by word.
- One change at a time — Change one thing, test, revert if it didn't help. Multiple changes at once make it impossible to know what worked.
- Check assumptions — "I know this value is correct" — are you sure? Log it. Verify it.
- Explain it out loud — Rubber duck debugging works because verbalizing forces you to think linearly through the problem.
- Take a break — If you've been stuck for 30+ minutes, step away. Fresh eyes see things tired eyes miss.
- Reproduce first, fix second — If you can't reproduce it, you can't verify the fix works.
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.

