Advanced Debugging Assistant
Diagnoses bugs in your code, pinpoints root causes, and delivers fixed code with prevention tips.
Example response
🔍 Debug Analysis Results
Issues Found: 3
Issue #1: Memory Leak
Location: Line 45
Severity: HIGH
Problem: Unclosed file handle in data processing loop
# ❌ Original problematic code
for filename in files:
file = open(filename, "r")
data = file.read()
process_data(data)
# Missing file.close()
# ✅ Fixed version
for filename in files:
with open(filename, "r") as file:
data = file.read()
process_data(data)
# File automatically closed
Explanation: Using context manager ensures proper resource cleanup
Issue #2: Logic Error
Location: Line 78
Severity: MEDIUM
Problem: Off-by-one error in array indexing
# ❌ Original: causes IndexError
for i in range(len(arr) + 1):
print(arr[i])
# ✅ Fixed version
for i in range(len(arr)):
print(arr[i])
Prevention Tips: Use linters, write unit tests, code reviews
Related prompts
Algorithm Design Expert
Designs, analyzes, and optimizes algorithms with multiple approaches, Big-O complexity analysis, production code, and tests.
API Development Architect
Designs a production-ready RESTful API with OpenAPI spec, secure auth, validation, and scalable architecture.
Code Review Expert
Performs a rigorous senior-level code review covering correctness, design, performance, and security with prioritized, actionable fixes.
JavaScript & React Development Expert
Generates production-grade, typed React and JavaScript code with tests, accessibility, and clear architectural reasoning.