Master systematic debugging techniques, profiling tools

Debugging strategies

by wshobson · MIT license · ★ 39,857 on GitHub · updated Sep 21

Debugging strategies cover

Master systematic debugging techniques, profiling tools, and root cause analysis to efficiently track down bugs across any codebase or technology stack. Use when investigating bugs, performance issues, or unexpected behavior.

---
name: debugging-strategies
description: Master systematic debugging techniques, profiling tools, and root cause analysis to efficiently track down bugs across any codebase or technology stack. Use when investigating bugs, performance issues, or unexpected behavior.
---

# Debugging Strategies

Transform debugging from frustrating guesswork into systematic problem-solving with proven strategies, powerful tools, and methodical approaches.

## When to Use This Skill

- Tracking down elusive bugs
- Investigating performance issues
- Understanding unfamiliar codebases
- Debugging production issues
- Analyzing crash dumps and stack traces
- Profiling application performance
- Investigating memory leaks

Overview

Transform debugging from frustrating guesswork into systematic problem-solving with proven strategies, powerful tools, and methodical approaches.

Manual install (npx, ZIP)
Claude Codenpx skills add wshobson/agents --skill debugging-strategies -g -a claude-code
Claude Code (manual)mkdir -p ~/.claude/skills && curl -sL https://codeload.github.com/wshobson/agents/tar.gz/4236bb91f839 \ | tar -xz -C ~/.claude/skills --strip-components=4 agents-4236bb91f839/plugins/developer-essentials/skills/debugging-strategies
Windows (PowerShell)New-Item -ItemType Directory -Force "$HOME\.claude\skills" | Out-Null; Invoke-WebRequest "https://m.agentalley.io/zip/ebf1178540a9829dd85b/debugging-strategies.zip" -OutFile "$env:TEMP\debugging-strategies.zip"; Expand-Archive "$env:TEMP\debugging-strategies.zip" -DestinationPath "$HOME\.claude\skills" -Force
Claude.ai / desktopDownload the ZIP and upload it under Settings → Capabilities → Skills.
Codex, Cursor, other agentsPoint them at SKILL.md. The other files are plain text.

Connects with Agent Alley MCP · agentalley.io/mcp

Files included

  • SKILL.md11.6 KB
Read the files here
wshobson/4236bb91 file
SKILL.md
Show the full text528 lines

Debugging Strategies

Transform debugging from frustrating guesswork into systematic problem-solving with proven strategies, powerful tools, and methodical approaches.

When to Use This Skill

  • Tracking down elusive bugs
  • Investigating performance issues
  • Understanding unfamiliar codebases
  • Debugging production issues
  • Analyzing crash dumps and stack traces
  • Profiling application performance
  • Investigating memory leaks
  • Debugging distributed systems

Core Principles

1. The Scientific Method

1. Observe: What's the actual behavior? 2. Hypothesize: What could be causing it? 3. Experiment: Test your hypothesis 4. Analyze: Did it prove/disprove your theory? 5. Repeat: Until you find the root cause

2. Debugging Mindset

Don't Assume:

  • "It can't be X" - Yes it can
  • "I didn't change Y" - Check anyway
  • "It works on my machine" - Find out why

Do:

  • Reproduce consistently
  • Isolate the problem
  • Keep detailed notes
  • Question everything
  • Take breaks when stuck
3. Rubber Duck Debugging

Explain your code and problem out loud (to a rubber duck, colleague, or yourself). Often reveals the issue.

Systematic Debugging Process

Phase 1: Reproduce
## Reproduction Checklist

1. **Can you reproduce it?**
   - Always? Sometimes? Randomly?
   - Specific conditions needed?
   - Can others reproduce it?

2. **Create minimal reproduction**
   - Simplify to smallest example
   - Remove unrelated code
   - Isolate the problem

3. **Document steps**
   - Write down exact steps
   - Note environment details
   - Capture error messages
Phase 2: Gather Information
## Information Collection

1. **Error Messages**
   - Full stack trace
   - Error codes
   - Console/log output

2. **Environment**
   - OS version
   - Language/runtime version
   - Dependencies versions
   - Environment variables

3. **Recent Changes**
   - Git history
   - Deployment timeline
   - Configuration changes

4. **Scope**
   - Affects all users or specific ones?
   - All browsers or specific ones?
   - Production only or also dev?
Phase 3: Form Hypothesis
## Hypothesis Formation

Based on gathered info, ask:

1. **What changed?**
   - Recent code changes
   - Dependency updates
   - Infrastructure changes

2. **What's different?**
   - Working vs broken environment
   - Working vs broken user
   - Before vs after

3. **Where could this fail?**
   - Input validation
   - Business logic
   - Data layer
   - External services
Phase 4: Test & Verify
## Testing Strategies

1. **Binary Search**
   - Comment out half the code
   - Narrow down problematic section
   - Repeat until found

2. **Add Logging**
   - Strategic console.log/print
   - Track variable values
   - Trace execution flow

3. **Isolate Components**
   - Test each piece separately
   - Mock dependencies
   - Remove complexity

4. **Compare Working vs Broken**
   - Diff configurations
   - Diff environments
   - Diff data

Debugging Tools

JavaScript/TypeScript Debugging
// Chrome DevTools Debugger
function processOrder(order: Order) {
  debugger; // Execution pauses here

  const total = calculateTotal(order);
  console.log("Total:", total);

  // Conditional breakpoint
  if (order.items.length > 10) {
    debugger; // Only breaks if condition true
  }

  return total;
}

// Console debugging techniques
console.log("Value:", value); // Basic
console.table(arrayOfObjects); // Table format
console.time("operation");
/* code */ console.timeEnd("operation"); // Timing
console.trace(); // Stack trace
console.assert(value > 0, "Value must be positive"); // Assertion

// Performance profiling
performance.mark("start-operation");
// ... operation code
performance.mark("end-operation");
performance.measure("operation", "start-operation", "end-operation");
console.log(performance.getEntriesByType("measure"));

VS Code Debugger Configuration:

// .vscode/launch.json
{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Debug Program",
      "program": "${workspaceFolder}/src/index.ts",
      "preLaunchTask": "tsc: build - tsconfig.json",
      "outFiles": ["${workspaceFolder}/dist/**/*.js"],
      "skipFiles": ["<node_internals>/**"]
    },
    {
      "type": "node",
      "request": "launch",
      "name": "Debug Tests",
      "program": "${workspaceFolder}/node_modules/jest/bin/jest",
      "args": ["--runInBand", "--no-cache"],
      "console": "integratedTerminal"
    }
  ]
}
Python Debugging
# Built-in debugger (pdb)
import pdb

def calculate_total(items):
    total = 0
    pdb.set_trace()  # Debugger starts here

    for item in items:
        total += item.price * item.quantity

    return total

# Breakpoint (Python 3.7+)
def process_order(order):
    breakpoint()  # More convenient than pdb.set_trace()
    # ... code

# Post-mortem debugging
try:
    risky_operation()
except Exception:
    import pdb
    pdb.post_mortem()  # Debug at exception point

# IPython debugging (ipdb)
from ipdb import set_trace
set_trace()  # Better interface than pdb

# Logging for debugging
import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)

def fetch_user(user_id):
    logger.debug(f'Fetching user: {user_id}')
    user = db.query(User).get(user_id)
    logger.debug(f'Found user: {user}')
    return user

# Profile performance
import cProfile
import pstats

cProfile.run('slow_function()', 'profile_stats')
stats = pstats.Stats('profile_stats')
stats.sort_stats('cumulative')
stats.print_stats(10)  # Top 10 slowest
Go Debugging
// Delve debugger
// Install: go install github.com/go-delve/delve/cmd/dlv@latest
// Run: dlv debug main.go

import (
    "fmt"
    "runtime"
    "runtime/debug"
)

// Print stack trace
func debugStack() {
    debug.PrintStack()
}

// Panic recovery with debugging
func processRequest() {
    defer func() {
        if r := recover(); r != nil {
            fmt.Println("Panic:", r)
            debug.PrintStack()
        }
    }()

    // ... code that might panic
}

// Memory profiling
import _ "net/http/pprof"
// Visit http://localhost:6060/debug/pprof/

// CPU profiling
import (
    "os"
    "runtime/pprof"
)

f, _ := os.Create("cpu.prof")
pprof.StartCPUProfile(f)
defer pprof.StopCPUProfile()
// ... code to profile

Advanced Debugging Techniques

Technique 1: Binary Search Debugging
# Git bisect for finding regression
git bisect start
git bisect bad                    # Current commit is bad
git bisect good v1.0.0            # v1.0.0 was good

# Git checks out middle commit
# Test it, then:
git bisect good   # if it works
git bisect bad    # if it's broken

# Continue until bug found
git bisect reset  # when done
Technique 2: Differential Debugging

Compare working vs broken:

## What's Different?

| Aspect       | Working     | Broken         |
| ------------ | ----------- | -------------- |
| Environment  | Development | Production     |
| Node version | 18.16.0     | 18.15.0        |
| Data         | Empty DB    | 1M records     |
| User         | Admin       | Regular user   |
| Browser      | Chrome      | Safari         |
| Time         | During day  | After midnight |

Hypothesis: Time-based issue? Check timezone handling.
Technique 3: Trace Debugging
// Function call tracing
function trace(
  target: any,
  propertyKey: string,
  descriptor: PropertyDescriptor,
) {
  const originalMethod = descriptor.value;

  descriptor.value = function (...args: any[]) {
    console.log(`Calling ${propertyKey} with args:`, args);
    const result = originalMethod.apply(this, args);
    console.log(`${propertyKey} returned:`, result);
    return result;
  };

  return descriptor;
}

class OrderService {
  @trace
  calculateTotal(items: Item[]): number {
    return items.reduce((sum, item) => sum + item.price, 0);
  }
}
Technique 4: Memory Leak Detection
// Chrome DevTools Memory Profiler
// 1. Take heap snapshot
// 2. Perform action
// 3. Take another snapshot
// 4. Compare snapshots

// Node.js memory debugging
if (process.memoryUsage().heapUsed > 500 * 1024 * 1024) {
  console.warn("High memory usage:", process.memoryUsage());

  // Generate heap dump
  require("v8").writeHeapSnapshot();
}

// Find memory leaks in tests
let beforeMemory: number;

beforeEach(() => {
  beforeMemory = process.memoryUsage().heapUsed;
});

afterEach(() => {
  const afterMemory = process.memoryUsage().heapUsed;
  const diff = afterMemory - beforeMemory;

  if (diff > 10 * 1024 * 1024) {
    // 10MB threshold
    console.warn(`Possible memory leak: ${diff / 1024 / 1024}MB`);
  }
});

Debugging Patterns by Issue Type

Pattern 1: Intermittent Bugs
## Strategies for Flaky Bugs

1. **Add extensive logging**
   - Log timing information
   - Log all state transitions
   - Log external interactions

2. **Look for race conditions**
   - Concurrent access to shared state
   - Async operations completing out of order
   - Missing synchronization

3. **Check timing dependencies**
   - setTimeout/setInterval
   - Promise resolution order
   - Animation frame timing

4. **Stress test**
   - Run many times
   - Vary timing
   - Simulate load
Pattern 2: Performance Issues
## Performance Debugging

1. **Profile first**
   - Don't optimize blindly
   - Measure before and after
   - Find bottlenecks

2. **Common culprits**
   - N+1 queries
   - Unnecessary re-renders
   - Large data processing
   - Synchronous I/O

3. **Tools**
   - Browser DevTools Performance tab
   - Lighthouse
   - Python: cProfile, line_profiler
   - Node: clinic.js, 0x
Pattern 3: Production Bugs
## Production Debugging

1. **Gather evidence**
   - Error tracking (Sentry, Bugsnag)
   - Application logs
   - User reports
   - Metrics/monitoring

2. **Reproduce locally**
   - Use production data (anonymized)
   - Match environment
   - Follow exact steps

3. **Safe investigation**
   - Don't change production
   - Use feature flags
   - Add monitoring/logging
   - Test fixes in staging

Best Practices

  1. Reproduce First: Can't fix what you can't reproduce
  2. Isolate the Problem: Remove complexity until minimal case
  3. Read Error Messages: They're usually helpful
  4. Check Recent Changes: Most bugs are recent
  5. Use Version Control: Git bisect, blame, history
  6. Take Breaks: Fresh eyes see better
  7. Document Findings: Help future you
  8. Fix Root Cause: Not just symptoms

Common Debugging Mistakes

  • Making Multiple Changes: Change one thing at a time
  • Not Reading Error Messages: Read the full stack trace
  • Assuming It's Complex: Often it's simple
  • Debug Logging in Prod: Remove before shipping
  • Not Using Debugger: console.log isn't always best
  • Giving Up Too Soon: Persistence pays off
  • Not Testing the Fix: Verify it actually works

Quick Debugging Checklist

## When Stuck, Check:

- [ ] Spelling errors (typos in variable names)
- [ ] Case sensitivity (fileName vs filename)
- [ ] Null/undefined values
- [ ] Array index off-by-one
- [ ] Async timing (race conditions)
- [ ] Scope issues (closure, hoisting)
- [ ] Type mismatches
- [ ] Missing dependencies
- [ ] Environment variables
- [ ] File paths (absolute vs relative)
- [ ] Cache issues (clear cache)
- [ ] Stale data (refresh database)
1---
2name: debugging-strategies
3description: Master systematic debugging techniques, profiling tools, and root cause analysis to efficiently track down bugs across any codebase or technology stack. Use when investigating bugs, performance issues, or unexpected behavior.
4---
5 
6# Debugging Strategies
7 
8Transform debugging from frustrating guesswork into systematic problem-solving with proven strategies, powerful tools, and methodical approaches.
9 
10## When to Use This Skill
11 
12- Tracking down elusive bugs
13- Investigating performance issues
14- Understanding unfamiliar codebases
15- Debugging production issues
16- Analyzing crash dumps and stack traces
17- Profiling application performance
18- Investigating memory leaks
19- Debugging distributed systems
20 
21## Core Principles
22 
23### 1. The Scientific Method
24 
25**1. Observe**: What's the actual behavior?
26**2. Hypothesize**: What could be causing it?
27**3. Experiment**: Test your hypothesis
28**4. Analyze**: Did it prove/disprove your theory?
29**5. Repeat**: Until you find the root cause
30 
31### 2. Debugging Mindset
32 
33**Don't Assume:**
34 
35- "It can't be X" - Yes it can
36- "I didn't change Y" - Check anyway
37- "It works on my machine" - Find out why
38 
39**Do:**
40 
41- Reproduce consistently
42- Isolate the problem
43- Keep detailed notes
44- Question everything
45- Take breaks when stuck
46 
47### 3. Rubber Duck Debugging
48 
49Explain your code and problem out loud (to a rubber duck, colleague, or yourself). Often reveals the issue.
50 
51## Systematic Debugging Process
52 
53### Phase 1: Reproduce
54 
55```markdown
56## Reproduction Checklist
57 
581. **Can you reproduce it?**
59 - Always? Sometimes? Randomly?
60 - Specific conditions needed?
61 - Can others reproduce it?
62 
632. **Create minimal reproduction**
64 - Simplify to smallest example
65 - Remove unrelated code
66 - Isolate the problem
67 
683. **Document steps**
69 - Write down exact steps
70 - Note environment details
71 - Capture error messages
72```
73 
74### Phase 2: Gather Information
75 
76```markdown
77## Information Collection
78 
791. **Error Messages**
80 - Full stack trace
81 - Error codes
82 - Console/log output
83 
842. **Environment**
85 - OS version
86 - Language/runtime version
87 - Dependencies versions
88 - Environment variables
89 
903. **Recent Changes**
91 - Git history
92 - Deployment timeline
93 - Configuration changes
94 
954. **Scope**
96 - Affects all users or specific ones?
97 - All browsers or specific ones?
98 - Production only or also dev?
99```
100 
101### Phase 3: Form Hypothesis
102 
103```markdown
104## Hypothesis Formation
105 
106Based on gathered info, ask:
107 
1081. **What changed?**
109 - Recent code changes
110 - Dependency updates
111 - Infrastructure changes
112 
1132. **What's different?**
114 - Working vs broken environment
115 - Working vs broken user
116 - Before vs after
117 
1183. **Where could this fail?**
119 - Input validation
120 - Business logic
121 - Data layer
122 - External services
123```
124 
125### Phase 4: Test & Verify
126 
127```markdown
128## Testing Strategies
129 
1301. **Binary Search**
131 - Comment out half the code
132 - Narrow down problematic section
133 - Repeat until found
134 
1352. **Add Logging**
136 - Strategic console.log/print
137 - Track variable values
138 - Trace execution flow
139 
1403. **Isolate Components**
141 - Test each piece separately
142 - Mock dependencies
143 - Remove complexity
144 
1454. **Compare Working vs Broken**
146 - Diff configurations
147 - Diff environments
148 - Diff data
149```
150 
151## Debugging Tools
152 
153### JavaScript/TypeScript Debugging
154 
155```typescript
156// Chrome DevTools Debugger
157function processOrder(order: Order) {
158 debugger; // Execution pauses here
159 
160 const total = calculateTotal(order);
161 console.log("Total:", total);
162 
163 // Conditional breakpoint
164 if (order.items.length > 10) {
165 debugger; // Only breaks if condition true
166 }
167 
168 return total;
169}
170 
171// Console debugging techniques
172console.log("Value:", value); // Basic
173console.table(arrayOfObjects); // Table format
174console.time("operation");
175/* code */ console.timeEnd("operation"); // Timing
176console.trace(); // Stack trace
177console.assert(value > 0, "Value must be positive"); // Assertion
178 
179// Performance profiling
180performance.mark("start-operation");
181// ... operation code
182performance.mark("end-operation");
183performance.measure("operation", "start-operation", "end-operation");
184console.log(performance.getEntriesByType("measure"));
185```
186 
187**VS Code Debugger Configuration:**
188 
189```json
190// .vscode/launch.json
191{
192 "version": "0.2.0",
193 "configurations": [
194 {
195 "type": "node",
196 "request": "launch",
197 "name": "Debug Program",
198 "program": "${workspaceFolder}/src/index.ts",
199 "preLaunchTask": "tsc: build - tsconfig.json",
200 "outFiles": ["${workspaceFolder}/dist/**/*.js"],
201 "skipFiles": ["<node_internals>/**"]
202 },
203 {
204 "type": "node",
205 "request": "launch",
206 "name": "Debug Tests",
207 "program": "${workspaceFolder}/node_modules/jest/bin/jest",
208 "args": ["--runInBand", "--no-cache"],
209 "console": "integratedTerminal"
210 }
211 ]
212}
213```
214 
215### Python Debugging
216 
217```python
218# Built-in debugger (pdb)
219import pdb
220 
221def calculate_total(items):
222 total = 0
223 pdb.set_trace() # Debugger starts here
224 
225 for item in items:
226 total += item.price * item.quantity
227 
228 return total
229 
230# Breakpoint (Python 3.7+)
231def process_order(order):
232 breakpoint() # More convenient than pdb.set_trace()
233 # ... code
234 
235# Post-mortem debugging
236try:
237 risky_operation()
238except Exception:
239 import pdb
240 pdb.post_mortem() # Debug at exception point
241 
242# IPython debugging (ipdb)
243from ipdb import set_trace
244set_trace() # Better interface than pdb
245 
246# Logging for debugging
247import logging
248logging.basicConfig(level=logging.DEBUG)
249logger = logging.getLogger(__name__)
250 
251def fetch_user(user_id):
252 logger.debug(f'Fetching user: {user_id}')
253 user = db.query(User).get(user_id)
254 logger.debug(f'Found user: {user}')
255 return user
256 
257# Profile performance
258import cProfile
259import pstats
260 
261cProfile.run('slow_function()', 'profile_stats')
262stats = pstats.Stats('profile_stats')
263stats.sort_stats('cumulative')
264stats.print_stats(10) # Top 10 slowest
265```
266 
267### Go Debugging
268 
269```go
270// Delve debugger
271// Install: go install github.com/go-delve/delve/cmd/dlv@latest
272// Run: dlv debug main.go
273 
274import (
275 "fmt"
276 "runtime"
277 "runtime/debug"
278)
279 
280// Print stack trace
281func debugStack() {
282 debug.PrintStack()
283}
284 
285// Panic recovery with debugging
286func processRequest() {
287 defer func() {
288 if r := recover(); r != nil {
289 fmt.Println("Panic:", r)
290 debug.PrintStack()
291 }
292 }()
293 
294 // ... code that might panic
295}
296 
297// Memory profiling
298import _ "net/http/pprof"
299// Visit http://localhost:6060/debug/pprof/
300 
301// CPU profiling
302import (
303 "os"
304 "runtime/pprof"
305)
306 
307f, _ := os.Create("cpu.prof")
308pprof.StartCPUProfile(f)
309defer pprof.StopCPUProfile()
310// ... code to profile
311```
312 
313## Advanced Debugging Techniques
314 
315### Technique 1: Binary Search Debugging
316 
317```bash
318# Git bisect for finding regression
319git bisect start
320git bisect bad # Current commit is bad
321git bisect good v1.0.0 # v1.0.0 was good
322 
323# Git checks out middle commit
324# Test it, then:
325git bisect good # if it works
326git bisect bad # if it's broken
327 
328# Continue until bug found
329git bisect reset # when done
330```
331 
332### Technique 2: Differential Debugging
333 
334Compare working vs broken:
335 
336```markdown
337## What's Different?
338 
339| Aspect | Working | Broken |
340| ------------ | ----------- | -------------- |
341| Environment | Development | Production |
342| Node version | 18.16.0 | 18.15.0 |
343| Data | Empty DB | 1M records |
344| User | Admin | Regular user |
345| Browser | Chrome | Safari |
346| Time | During day | After midnight |
347 
348Hypothesis: Time-based issue? Check timezone handling.
349```
350 
351### Technique 3: Trace Debugging
352 
353```typescript
354// Function call tracing
355function trace(
356 target: any,
357 propertyKey: string,
358 descriptor: PropertyDescriptor,
359) {
360 const originalMethod = descriptor.value;
361 
362 descriptor.value = function (...args: any[]) {
363 console.log(`Calling ${propertyKey} with args:`, args);
364 const result = originalMethod.apply(this, args);
365 console.log(`${propertyKey} returned:`, result);
366 return result;
367 };
368 
369 return descriptor;
370}
371 
372class OrderService {
373 @trace
374 calculateTotal(items: Item[]): number {
375 return items.reduce((sum, item) => sum + item.price, 0);
376 }
377}
378```
379 
380### Technique 4: Memory Leak Detection
381 
382```typescript
383// Chrome DevTools Memory Profiler
384// 1. Take heap snapshot
385// 2. Perform action
386// 3. Take another snapshot
387// 4. Compare snapshots
388 
389// Node.js memory debugging
390if (process.memoryUsage().heapUsed > 500 * 1024 * 1024) {
391 console.warn("High memory usage:", process.memoryUsage());
392 
393 // Generate heap dump
394 require("v8").writeHeapSnapshot();
395}
396 
397// Find memory leaks in tests
398let beforeMemory: number;
399 
400beforeEach(() => {
401 beforeMemory = process.memoryUsage().heapUsed;
402});
403 
404afterEach(() => {
405 const afterMemory = process.memoryUsage().heapUsed;
406 const diff = afterMemory - beforeMemory;
407 
408 if (diff > 10 * 1024 * 1024) {
409 // 10MB threshold
410 console.warn(`Possible memory leak: ${diff / 1024 / 1024}MB`);
411 }
412});
413```
414 
415## Debugging Patterns by Issue Type
416 
417### Pattern 1: Intermittent Bugs
418 
419```markdown
420## Strategies for Flaky Bugs
421 
4221. **Add extensive logging**
423 - Log timing information
424 - Log all state transitions
425 - Log external interactions
426 
4272. **Look for race conditions**
428 - Concurrent access to shared state
429 - Async operations completing out of order
430 - Missing synchronization
431 
4323. **Check timing dependencies**
433 - setTimeout/setInterval
434 - Promise resolution order
435 - Animation frame timing
436 
4374. **Stress test**
438 - Run many times
439 - Vary timing
440 - Simulate load
441```
442 
443### Pattern 2: Performance Issues
444 
445```markdown
446## Performance Debugging
447 
4481. **Profile first**
449 - Don't optimize blindly
450 - Measure before and after
451 - Find bottlenecks
452 
4532. **Common culprits**
454 - N+1 queries
455 - Unnecessary re-renders
456 - Large data processing
457 - Synchronous I/O
458 
4593. **Tools**
460 - Browser DevTools Performance tab
461 - Lighthouse
462 - Python: cProfile, line_profiler
463 - Node: clinic.js, 0x
464```
465 
466### Pattern 3: Production Bugs
467 
468```markdown
469## Production Debugging
470 
4711. **Gather evidence**
472 - Error tracking (Sentry, Bugsnag)
473 - Application logs
474 - User reports
475 - Metrics/monitoring
476 
4772. **Reproduce locally**
478 - Use production data (anonymized)
479 - Match environment
480 - Follow exact steps
481 
4823. **Safe investigation**
483 - Don't change production
484 - Use feature flags
485 - Add monitoring/logging
486 - Test fixes in staging
487```
488 
489## Best Practices
490 
4911. **Reproduce First**: Can't fix what you can't reproduce
4922. **Isolate the Problem**: Remove complexity until minimal case
4933. **Read Error Messages**: They're usually helpful
4944. **Check Recent Changes**: Most bugs are recent
4955. **Use Version Control**: Git bisect, blame, history
4966. **Take Breaks**: Fresh eyes see better
4977. **Document Findings**: Help future you
4988. **Fix Root Cause**: Not just symptoms
499 
500## Common Debugging Mistakes
501 
502- **Making Multiple Changes**: Change one thing at a time
503- **Not Reading Error Messages**: Read the full stack trace
504- **Assuming It's Complex**: Often it's simple
505- **Debug Logging in Prod**: Remove before shipping
506- **Not Using Debugger**: console.log isn't always best
507- **Giving Up Too Soon**: Persistence pays off
508- **Not Testing the Fix**: Verify it actually works
509 
510## Quick Debugging Checklist
511 
512```markdown
513## When Stuck, Check:
514 
515- [ ] Spelling errors (typos in variable names)
516- [ ] Case sensitivity (fileName vs filename)
517- [ ] Null/undefined values
518- [ ] Array index off-by-one
519- [ ] Async timing (race conditions)
520- [ ] Scope issues (closure, hoisting)
521- [ ] Type mismatches
522- [ ] Missing dependencies
523- [ ] Environment variables
524- [ ] File paths (absolute vs relative)
525- [ ] Cache issues (clear cache)
526- [ ] Stale data (refresh database)
527```
528 
View all files on GitHub →

Details

Updated
Sep 21, 2026
License
MIT
Stars on the repo
★ 39,857
Checked
Source
wshobson/agents ↗
Creator
wshobson · 179 listings
View creator

Similar skills

See all →
MCPExpert debugging specialist for errors, test failuresDebugger AgentCloudAI-X/claude-workflow-v2 · by CloudAI-XExpert debugging specialist for errors, test failures, crashes, segmentation faults, memory leaks, timeouts, race conditions, deadlocks, and unexpected behavior. Use PROACTIVELY when encountering any error, exception, or failing test. Performs systematic root cause analysis.★ 1.4k GitHub starsSkillEncountering any bug, test failure, or unexpected behaviorSystematic debuggingobra/superpowers · by obraUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes★ 290k GitHub starsSkillRequires running verification commands and confirming outputVerification before completionobra/superpowers · by obraUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always★ 290k GitHub starsSkillGuides systematic root-cause debuggingDebugging and error recoveryaddyosmani/agent-skills · by addyosmaniGuides systematic root-cause debugging. Use when tests fail, builds break, something that worked yesterday broke, behavior doesn't match expectations, or you encounter any unexpected error. Use when you need to figure out what broke and why — a systematic approach to finding and fixing the root cause rather than guessing.★ 98.7k GitHub starsSkillMaster error handling patterns across languages includingwshobson/agents · by wshobsonMaster error handling patterns across languages including exceptions, Result types, error propagation, and graceful degradation to build resilient applications. Use when implementing error handling, designing APIs, or improving application reliability.★ 39.9k GitHub starsSkillCreate structured incident response runbooksIncident runbook templateswshobson/agents · by wshobsonCreate structured incident response runbooks with step-by-step procedures, escalation paths, and recovery actions. Use this skill when building a service outage runbook for a payment processing system; creating database incident procedures covering connection pool exhaustion, replication lag, and disk space alerts; onboarding new on-call engineers who need step-by-step recovery guides written for a 3 AM brain; or standardizing escalation matrices across multiple engineering teams.★ 39.9k GitHub stars

More from wshobson

SkillMaster C/.NET backend development patterns for buildingwshobson/agents · by wshobsonMaster C#/.NET backend development patterns for building robust APIs, MCP servers, and enterprise applications. Covers async/await, dependency injection, Entity Framework Core, Dapper, configuration, caching, and testing with xUnit. Use when developing .NET backends, reviewing C# code, or designing API architectures.★ 39.9k GitHub starsSkillImplement WCAG 2.2 compliant interfaces with mobileAccessibility compliancewshobson/agents · by wshobsonImplement WCAG 2.2 compliant interfaces with mobile accessibility, inclusive design patterns, and assistive technology support. Use when auditing accessibility, implementing ARIA patterns, building for screen readers, or ensuring inclusive user experiences.★ 39.9k GitHub starsSkillMaster Material Design 3 and Jetpack Compose patternsAndroid Mobile Designwshobson/agents · by wshobsonMaster Material Design 3 and Jetpack Compose patterns for building native Android apps. Use when designing Android interfaces, implementing Compose UI, or following Google's Material Design guidelines.★ 39.9k GitHub starsSkillMigrate from AngularJS to Angular using hybrid modeAngular migrationwshobson/agents · by wshobsonMigrate from AngularJS to Angular using hybrid mode, incremental component rewriting, and dependency injection updates. Use when upgrading AngularJS applications, planning framework migrations, or modernizing legacy Angular code.★ 39.9k GitHub starsSkillUnderstand anti-reversing, obfuscationAnti reversing techniqueswshobson/agents · by wshobsonUnderstand anti-reversing, obfuscation, and protection techniques encountered during software analysis. Use this skill when analyzing malware evasion techniques, when implementing anti-debugging protections for CTF challenges, when reverse engineering packed binaries, or when building security research tools that need to detect virtualized environments.★ 39.9k GitHub starsSkillBuild production Apache Airflow DAGs with best practicesApache Airflow DAG Patternswshobson/agents · by wshobsonBuild production Apache Airflow DAGs with best practices for operators, sensors, testing, and deployment. Use when creating data pipelines, orchestrating workflows, or scheduling batch jobs.★ 39.9k GitHub stars