Debugging with Claude Code is a loop, not a one-shot. You show it what broke, it locates the cause and proposes a fix, you run the code again to see if the fix held. Most bugs fall in one or two turns around that loop.
Do not summarize the error in your own words - paste it verbatim. The stack trace, the line number, the exact message: all of it narrows the search. Compare these two prompts:
My script is broken, can you fix it?
Running tally.sh gives: "line 5: DIR: unbound variable". Fix it so it runs cleanly.
The second one hands Claude the file, the line, and the symptom. It will find the cause far faster.
You do not have to be the one who re-runs the code. Ask Claude to run it:
Run the test and, if it fails, fix the cause and run it again until it passes.
Now Claude closes the loop on its own - it runs, reads the output, edits, and reruns. You review the diff at the end rather than driving each cycle. On a real machine, watch what it runs, but let it do the repetitive part.
A fix that makes the error disappear is not always a fix that is correct. Before you move on, make sure the test that was failing now passes for the right reason - not because Claude deleted the check. You review; Claude does the legwork.
Your lab setup
This VM comes with Claude Code preinstalled and signed in - just run claude to start.