debug-detective

Systematic debugging approach for ANY codebase, ANY language, ANY bug type. Use when facing unexpected behavior, crashes, performance issues, or intermittent problems.

16 stars

Best use case

debug-detective is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Systematic debugging approach for ANY codebase, ANY language, ANY bug type. Use when facing unexpected behavior, crashes, performance issues, or intermittent problems.

Teams using debug-detective should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/debug-detective/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/development/debug-detective/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/debug-detective/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How debug-detective Compares

Feature / Agentdebug-detectiveStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Systematic debugging approach for ANY codebase, ANY language, ANY bug type. Use when facing unexpected behavior, crashes, performance issues, or intermittent problems.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Debug Detective - Systematic Bug Hunting

## 🎯 When to Use This Skill

Use when facing ANY bug:

- Unexpected behavior
- Crashes or errors
- Performance issues
- Intermittent problems
- "Works on my machine" issues

## ⚡ Quick Start (Find bugs in 5 steps)

### The Universal Debug Protocol:

1. **REPRODUCE** - Can you make it happen again?
2. **ISOLATE** - Where exactly is it breaking?
3. **UNDERSTAND** - Why is it breaking?
4. **FIX** - Apply minimal solution
5. **VERIFY** - Confirm fix works

## 🔍 Step 1: REPRODUCE

### WITH MCP Tools:

```
"Help me create a minimal reproduction for this bug: [describe bug]"
```

### WITHOUT MCP:

```bash
# Document the exact steps:
echo "=== BUG REPRODUCTION ===" > bug_report.md
echo "1. Start the app with: [command]" >> bug_report.md
echo "2. Navigate to: [location]" >> bug_report.md
echo "3. Perform action: [action]" >> bug_report.md
echo "4. Expected: [what should happen]" >> bug_report.md
echo "5. Actual: [what actually happens]" >> bug_report.md

# Try to reproduce 3 times - is it consistent?
```

### Quick Tests:

```bash
# Different environments
NODE_ENV=production npm start  # Production mode?
npm start --debug              # Debug mode?
docker run ...                 # Container issue?

# Different data
# - With empty database
# - With large dataset
# - With special characters
# - With null/undefined values
```

## 🎯 Step 2: ISOLATE

### WITH MCP (Architecture Analyzer):

```
"Trace the execution flow for [feature name]"
"Find all places where [variable/function] is used"
```

### WITHOUT MCP:

#### Binary Search Method:

```bash
# Cut the problem in half repeatedly
# 1. Add midpoint log
console.log('=== MIDPOINT: Data here:', data);

# 2. Did error occur before or after?
# 3. Repeat in that half
```

#### Breadcrumb Trail:

```javascript
// Add numbered checkpoints
console.log('🔍 1: Starting process');
console.log('🔍 2: Data loaded:', data);
console.log('🔍 3: Processing complete');
console.log('🔍 4: Saving results');
// Where does it stop?
```

#### Git Bisect (for regressions):

```bash
git bisect start
git bisect bad HEAD           # Current version is broken
git bisect good v1.2.3         # This version worked
# Git will help find the breaking commit
```

## 🧠 Step 3: UNDERSTAND

### WITH MCP (Smart Reviewer):

```
"Analyze this function for potential issues: [paste code]"
"What could cause [error message]?"
```

### WITHOUT MCP:

#### The 5 Whys Technique:

```
Problem: App crashes on user login
Why? → Authentication fails
Why? → Token is invalid
Why? → Token expired
Why? → Refresh mechanism broken
Why? → API endpoint changed
Root cause found!
```

#### Common Bug Patterns Check:

**Race Conditions:**

```javascript
// Look for async without await
someAsyncCall(); // Missing await?
doSomethingElse(); // This runs immediately!

// Fix:
await someAsyncCall();
doSomethingElse();
```

**Off-by-One Errors:**

```javascript
// Check loop boundaries
for (let i = 0; i <= array.length; i++)  // Should be < not <=
```

**Type Mismatches:**

```javascript
// Check for type coercion issues
'1' + 1 === '11'; // String concatenation
'1' - 1 === 0; // Number coercion
```

**Null/Undefined:**

```javascript
// Add defensive checks
const result = data?.user?.name ?? 'default';
```

## 🔧 Step 4: FIX

### WITH MCP (Refactor Assistant):

```
"Fix this bug with minimal changes: [describe issue and paste code]"
```

### WITHOUT MCP:

#### Minimal Fix Approach:

1. **Smallest possible change** that fixes the issue
2. **Don't refactor** while fixing (separate concerns)
3. **Add defensive code** to prevent recurrence
4. **Document the fix** with a comment

#### Fix Template:

```javascript
// BUG FIX: [Issue description]
// Problem: [What was wrong]
// Solution: [What this fixes]
// Date: [Today's date]
// TODO: Consider refactoring in future

// Original problematic code (commented):
// if (user.role == 'admin') {

// Fixed code:
if (user && user.role === 'admin') {
  // Added null check and strict equality
}
```

## ✅ Step 5: VERIFY

### WITH MCP (Test Generator):

```
"Generate a test that verifies this bug is fixed"
```

### WITHOUT MCP:

#### Verification Checklist:

```bash
# 1. Original bug fixed?
[Run reproduction steps]

# 2. No new bugs introduced?
npm test
npm run lint

# 3. Edge cases handled?
# - Null inputs
# - Empty arrays
# - Large numbers
# - Special characters

# 4. Performance unchanged?
time npm start  # Basic performance check
```

#### Regression Test:

```javascript
// Add a test to prevent this bug from returning
describe('Bug #123 - Login crash', () => {
  it('should handle expired tokens gracefully', () => {
    const expiredToken = generateExpiredToken();
    expect(() => authenticate(expiredToken)).not.toThrow();
    expect(authenticate(expiredToken)).toBe(false);
  });
});
```

## 🚨 Emergency Debug Tools

### Universal Quick Checks:

#### Memory Issues:

```bash
# Node.js
node --inspect app.js  # Open chrome://inspect

# Python
python -m memory_profiler script.py

# Java
jmap -dump:file=heap.bin <pid>
```

#### CPU Issues:

```bash
# Linux/Mac
top -p <pid>

# Node.js
node --prof app.js
node --prof-process isolate-*.log
```

#### Network Issues:

```bash
# Check requests
curl -v https://api.example.com
netstat -an | grep LISTEN
tcpdump -i any port 3000
```

## 🎯 Debug Strategies by Bug Type

### "Works on my machine":

1. Check environment variables
2. Compare dependency versions
3. Check OS-specific code
4. Verify file paths (case sensitivity!)
5. Check timezone/locale differences

### Intermittent bugs:

1. Add extensive logging
2. Check race conditions
3. Monitor resource usage
4. Check external dependencies
5. Use stress testing

### Performance degradation:

1. Profile before/after
2. Check database queries
3. Look for N+1 problems
4. Check caching
5. Monitor memory leaks

## 💡 Pro Tips

### The Rubber Duck Method:

```markdown
1. Explain the bug to a rubber duck (or colleague)
2. Step through the code line by line
3. Often, you'll spot the issue while explaining
```

### Fresh Eyes Technique:

```bash
# After 30 minutes stuck:
git stash          # Save work
git checkout main  # Fresh perspective
# Take a 5-minute break
git stash pop      # Return with fresh eyes
```

### Sanity Checks:

```bash
# Is it plugged in?
- Server running?
- Database connected?
- Correct branch?
- Dependencies installed?
- Environment variables set?
```

## 📝 Debug Log Template

Keep a debug log for complex issues:

```markdown
## Bug: [Description]

**Date:** [Date]
**Severity:** Critical/High/Medium/Low

### Symptoms:

-

### Reproduction:

1.

### Hypotheses Tested:

- [ ] Hypothesis 1: [Result]
- [ ] Hypothesis 2: [Result]

### Solution:

-

### Lessons Learned:

-
```

Remember: Every bug is a learning opportunity! 🐛→📚

Related Skills

debugging-workflow

16
from diegosouzapw/awesome-omni-skill

Systematic debugging workflow with parallel agent exploration, root cause analysis, and fix verification. Adapted from feature-dev methodology for bug investigation.

debugging-toolkit-smart-debug

16
from diegosouzapw/awesome-omni-skill

Use when working with debugging toolkit smart debug

debugging-strategies

16
from diegosouzapw/awesome-omni-skill

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 iss...

debugging

16
from diegosouzapw/awesome-omni-skill

Debugging techniques for Python, JavaScript, and distributed systems. Activate for troubleshooting, error analysis, log investigation, and performance debugging. Includes extended thinking integration for complex debugging scenarios.

debugging-methodology

16
from diegosouzapw/awesome-omni-skill

Systematic debugging methodology following reproduce → locate → hypothesize → verify → fix → regression workflow. Use when debugging issues, investigating bugs, troubleshooting problems, or when asked about debugging process, problem-solving, or issue investigation.

debugging-master

16
from diegosouzapw/awesome-omni-skill

Systematic debugging methodology - scientific method, hypothesis testing, and root cause analysis that works across all technologiesUse when "bug, debugging, not working, broken, investigate, root cause, why is this happening, figure out, troubleshoot, doesn't work, unexpected behavior, debugging, root-cause, hypothesis, scientific-method, troubleshooting, bug-hunting, investigation, problem-solving" mentioned.

debug

16
from diegosouzapw/awesome-omni-skill

Debug container agent issues. Use when things aren't working, container fails, authentication problems, or to understand how the container system works. Covers logs, environment variables, mounts, and common issues.

debug-validator-checkpoint-inconsistency

16
from diegosouzapw/awesome-omni-skill

Debug validator checkpoint inconsistencies where some validators are behind others. Use when alerts mention "checkpoint inconsistency", "validators behind", or "inconsistent latest checkpoints", or when asked to debug validator sets, investigate validator delays, or troubleshoot metadata fetch failures for a chain. Defaults to default_ism app context if not specified.

debug-log-patterns

16
from diegosouzapw/awesome-omni-skill

Language-specific debug logging patterns and best practices. Reference when adding instrumentation for Dart/Flutter, Kotlin/Android, Swift/iOS, or JavaScript/TypeScript applications.

debug:angular

16
from diegosouzapw/awesome-omni-skill

Debug Angular applications systematically with expert-level diagnostic techniques. This skill provides comprehensive guidance for troubleshooting dependency injection errors, change detection issues (NG0100), RxJS subscription leaks, lazy loading failures, zone.js problems, and common Angular runtime errors. Includes structured four-phase debugging methodology, Angular DevTools usage, console debugging utilities (ng.probe), and performance profiling strategies for modern Angular applications.

cc-debugging

16
from diegosouzapw/awesome-omni-skill

Guide systematic debugging using scientific method: STABILIZE -> HYPOTHESIZE -> EXPERIMENT -> FIX -> TEST -> SEARCH. Two modes: CHECKER audits debugging approach (outputs status table with violations/warnings), APPLIER guides when stuck (outputs stabilization strategy, hypothesis formation, fix verification). Use when encountering ANY bug, error, test failure, crash, wrong output, flaky behavior, race condition, regression, timeout, hang, or code behavior differing from intent. Triggers on: debug, fix, broken, failing, investigate, figure out why, not working, it doesn't work, something's wrong.

architect-detective

16
from diegosouzapw/awesome-omni-skill

⚡ PRIMARY TOOL for: 'what's the architecture', 'system design', 'how are layers organized', 'find design patterns', 'audit structure', 'map dependencies'. Uses claudemem v0.3.0 AST structural analysis with PageRank. GREP/FIND/GLOB ARE FORBIDDEN.