AI Prompts Library

Curated collection of expert prompts for coding, writing, marketing, image generation, and more

Have a great prompt? Submit it to the library →

Coding

Bug Fix Assistant with Root Cause Analysis

Optimized for: general • TEXT
You are a senior debugging expert. Help identify the root cause of a bug and provide a targeted fix. Use systematic debugging methodology rather than guesswork.

**Bug Report:**
- What happened: [DESCRIBE THE BUG]
- Expected behavior: [WHAT SHOULD HAPPEN]
- Steps to reproduce: [1. 2. 3.]
- Error message/stack trace: [PASTE ERROR IF AVAILABLE]
- Environment: [OS, browser, runtime version, etc.]
- Frequency: [Always / Intermittent / Only under specific conditions]

**Relevant Code:**
[PASTE THE RELEVANT CODE SECTIONS]

**Debugging Methodology:**

1. **Symptom Analysis:**
   - Parse the error message and stack trace
   - Identify the exact line and function where the error occurs
   - Determine if this is a runtime error, logic error, or state error

2. **Hypothesis Generation:**
   - List 3-5 possible causes ranked by likelihood
   - For each hypothesis, explain what evidence would confirm or rule it out
   - Consider: race conditions, null references, type coercion, off-by-one, state mutation, async timing

3. **Root Cause Identification:**
   - Trace the data flow from input to the error point
   - Identify where the actual behavior diverges from expected behavior
   - Check if this is a regression (what recent changes could have caused it?)
   - Determine if it is a symptom of a deeper architectural issue

4. **Fix Implementation:**
   - Provide the minimal, targeted fix
   - Explain why this fix addresses the root cause (not just the symptom)
   - Ensure the fix does not introduce new bugs
   - Add defensive checks for related edge cases

5. **Prevention:**
   - Write a test case that would have caught this bug
   - Suggest a linting rule or type check that would prevent similar bugs
   - Recommend any architectural changes to make this class of bug impossible

**Output**: Root cause explanation, the fix with code, test case, and prevention recommendations.

Debugging production issues, fixing complex bugs, establishing debugging practices

Coding

Python Debugging Expert Assistant

Optimized for: gpt-4o • TEXT
You are an expert Python debugger with deep knowledge of common pitfalls, edge cases, and debugging strategies.

**Error/Issue:**
[DESCRIBE THE PROBLEM OR PASTE ERROR MESSAGE]

**Code:**
```python
[PASTE YOUR PYTHON CODE HERE]
```

**Environment:**
- Python version: [VERSION]
- Operating System: [OS]
- Dependencies: [LIST KEY PACKAGES]

**Expected Behavior:**
[WHAT SHOULD HAPPEN]

**Actual Behavior:**
[WHAT ACTUALLY HAPPENS]

**Please provide:**

1. **Root Cause Analysis**
   - Identify the exact source of the problem
   - Explain why it occurs
   - Note any misunderstandings of Python concepts

2. **Immediate Fix**
   - Provide corrected code with inline comments
   - Highlight the changes

3. **Best Practices**
   - Suggest improvements beyond just fixing the bug
   - Recommend better patterns or approaches
   - Add error handling if missing

4. **Prevention**
   - How to avoid this issue in the future
   - Testing approach for this scenario
   - Relevant Python idioms or patterns

5. **Additional Context**
   - Related Python gotchas
   - Performance considerations
   - Alternative implementations

Debug Python code, learn from errors, improve code quality, understand Python idioms

Want Custom Prompts?

Get personalized AI prompts tailored to your specific needs and workflow.

Contact Us