Day 5
Debugging & Problem Solving
Use Claude as your pair debugging partner — paste errors, trace logic, and get actionable fixes.
0 / 5 tasks
Claude as a debugger
Claude excels at debugging because it can hold your entire codebase context, understand error messages deeply, and trace logic across files. The key is giving it enough context — the error, the relevant code, and what you expected.
Debug a traceback
bash
# Paste the traceback and ask for root cause + fix
claude
> Here's an error I'm getting:
>
> Traceback (most recent call last):
> File "app.py", line 47, in process
> result = db.query(User).filter_by(id=user_id).first()
> sqlalchemy.exc.InvalidRequestError: This Session's transaction
> has been rolled back due to a previous exception
>
> The relevant code is in models.py. What's the root cause and how do I fix it?
Performance debugging
bash
claude
> This function is slow (takes 3+ seconds for 10k records).
> Here's the code: [paste code]
> Profile it mentally and suggest optimizations.
> Then rewrite it to be as fast as possible.
Always provide the full traceback AND the code that triggers it. Half the debugging context is often the call stack.