🐛

Bug Investigation

Featured

Systematic approach to investigating and diagnosing bugs. Provides a structured framework for root cause analysis.

by Claude Hub
Updated about 7 hours ago

Bug Investigation Prompt

A systematic approach to investigating and diagnosing bugs.

The Prompt

I'm experiencing a bug and need help investigating it.

## Bug Description
[What's happening vs. what should happen]

## Steps to Reproduce
1. [Step 1]
2. [Step 2]
3. [Step 3]

## Environment
- OS: [Operating system]
- Language/Framework version: [Version]
- Related dependencies: [List]

## Error Messages
[Paste any error messages or stack traces]

## What I've Tried
- [Attempt 1]
- [Attempt 2]

## Relevant Code
[Paste relevant code sections]

---

Please help me:
1. Identify the most likely root cause
2. Explain why this is happening
3. Suggest debugging steps to confirm
4. Provide a fix or workaround

Investigation Framework

1. Reproduce Consistently

  • Can you reproduce it every time?
  • What's the minimum reproduction case?

2. Isolate the Problem

  • When did it start working/stop working?
  • What changed recently?
  • Does it happen in other environments?

3. Gather Evidence

  • Check logs at the time of failure
  • Add strategic console.log/print statements
  • Use debugger to inspect state

4. Form Hypotheses

  • List possible causes
  • Rank by likelihood
  • Test each systematically

5. Verify the Fix

  • Confirm the bug is actually fixed
  • Ensure no regressions
  • Add test to prevent recurrence

Common Bug Categories

Category Common Causes
State Race conditions, stale data, improper initialization
Logic Off-by-one, wrong operator, missing case
Type Null/undefined, wrong type coercion
Async Missing await, callback order, timeout
Environment Version mismatch, missing dependency, config

Raw Content

# Bug Investigation Prompt

A systematic approach to investigating and diagnosing bugs.

## The Prompt

```markdown
I'm experiencing a bug and need help investigating it.

## Bug Description
[What's happening vs. what should happen]

## Steps to Reproduce
1. [Step 1]
2. [Step 2]
3. [Step 3]

## Environment
- OS: [Operating system]
- Language/Framework version: [Version]
- Related dependencies: [List]

## Error Messages
[Paste any error messages or stack traces]

## What I've Tried
- [Attempt 1]
- [Attempt 2]

## Relevant Code
[Paste relevant code sections]

---

Please help me:
1. Identify the most likely root cause
2. Explain why this is happening
3. Suggest debugging steps to confirm
4. Provide a fix or workaround
```

## Investigation Framework

### 1. Reproduce Consistently
- Can you reproduce it every time?
- What's the minimum reproduction case?

### 2. Isolate the Problem
- When did it start working/stop working?
- What changed recently?
- Does it happen in other environments?

### 3. Gather Evidence
- Check logs at the time of failure
- Add strategic console.log/print statements
- Use debugger to inspect state

### 4. Form Hypotheses
- List possible causes
- Rank by likelihood
- Test each systematically

### 5. Verify the Fix
- Confirm the bug is actually fixed
- Ensure no regressions
- Add test to prevent recurrence

## Common Bug Categories

| Category | Common Causes |
|----------|--------------|
| **State** | Race conditions, stale data, improper initialization |
| **Logic** | Off-by-one, wrong operator, missing case |
| **Type** | Null/undefined, wrong type coercion |
| **Async** | Missing await, callback order, timeout |
| **Environment** | Version mismatch, missing dependency, config |