// Expert in systematic debugging across all languages and frameworks. Use when debugging issues, troubleshooting errors, investigating bugs, analyzing logs, using debuggers, or when the user mentions debugging, troubleshooting, errors, bugs, or issues.
| name | Debugging Wizard |
| description | Expert in systematic debugging across all languages and frameworks. Use when debugging issues, troubleshooting errors, investigating bugs, analyzing logs, using debuggers, or when the user mentions debugging, troubleshooting, errors, bugs, or issues. |
A specialized skill for systematic debugging and troubleshooting across all programming languages and frameworks.
Understand the problem
Reproduce the issue
Investigate systematically
Fix and verify
# Node.js debugger
node --inspect app.js
# VS Code debugger (launch.json)
{
"type": "node",
"request": "launch",
"name": "Debug Program",
"program": "${workspaceFolder}/app.ts",
"outFiles": ["${workspaceFolder}/dist/**/*.js"]
}
# Chrome DevTools
# Add 'debugger;' statement in code
debugger;
# Console debugging
console.log('Value:', value);
console.table(arrayOfObjects);
console.trace('Execution path');
# Built-in debugger
import pdb; pdb.set_trace() # Python < 3.7
breakpoint() # Python >= 3.7
# IPython debugger
from IPdb import set_trace; set_trace()
# Logging
import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
logger.debug(f"Variable value: {var}")
# Print debugging
print(f"DEBUG: {variable}")
import pprint
pprint.pprint(complex_object)
// Delve debugger
dlv debug main.go
// Print debugging
import "fmt"
fmt.Printf("DEBUG: %+v\n", variable)
// Log debugging
import "log"
log.Printf("Value: %v", value)
Error: Cannot read property 'name' of undefined
at getUserName (app.js:45:18)
at processUser (app.js:32:10)
at main (app.js:15:3)
# cURL with verbose output
curl -v https://api.example.com/users
# Network tab in browser DevTools
# Check: Status code, Headers, Response, Timing
# Proxy tools
# Charles Proxy, Fiddler, mitmproxy
-- Add EXPLAIN to understand query execution
EXPLAIN ANALYZE
SELECT * FROM users WHERE email = 'test@example.com';
-- Check slow query log
-- Enable query logging in development
// Problem: Race condition
let data = null;
fetchData().then(d => data = d);
console.log(data); // null - fetchData not done yet
// Solution: Await the promise
const data = await fetchData();
console.log(data); // Correct value
// Problem: Event listener not cleaned up
useEffect(() => {
window.addEventListener('resize', handleResize);
// Missing cleanup!
}, []);
// Solution: Cleanup in effect
useEffect(() => {
window.addEventListener('resize', handleResize);
return () => window.removeEventListener('resize', handleResize);
}, []);
# Problem: Missing last item
for i in range(len(items) - 1): # Missing last item!
process(items[i])
# Solution: Correct range
for i in range(len(items)):
process(items[i])
# Better: Iterate directly
for item in items:
process(item)