Debug with Claude
When something breaks, Claude is your debug partner
⏱ Est. ~7 min
01 · Read
Things break. That's not a failure — that's normal when building software. The difference between a beginner and an experienced engineer isn't that experienced people never make mistakes. It's that they know how to describe the problem clearly and find the fix efficiently.
Claude Code is a great debug partner. But it can only help if you tell it what's wrong. Vague descriptions like "it's not working" give Claude very little to go on. Specific descriptions like "the form submits but the success message never shows up" point Claude straight at the problem.
The key pattern for reporting a bug: Expected X, got Y, here's what I tried.
02 · Prompt template
When you see an error in the terminal, copy-paste the exact error message to Claude. Don't paraphrase — the exact text has important clues, like filenames, line numbers, and error codes.
I got this error when I ran the server: {{error_message}}03 · Prompt template
Not every bug has an error message. Sometimes it just looks wrong in the browser. For visual bugs, describe what you see vs. what you expected.
The {{element}} is currently {{problem}}, but it should be {{expected}}04 · Quiz
When reporting a bug to Claude, what should you always include?
- Your operating system
- Your editor name
- The exact error message
- What time it is
05 · Fill in the blank
When describing a bug, use the pattern: "Expected _____, got Y".
06 · Read
Describing a problem clearly is a real skill — and one that makes you better at working with both AI and human teammates.
Key points
- Clear problem description is the most important debug skill
- Magic pattern: "Expected X, got Y, here's what I tried"
- Copy the exact error message — don't paraphrase
- For visual bugs, describe what you see vs. what you expected
- Include context: what were you doing when it broke?
07 · Quiz
Your web page has a button that should show a success message when clicked, but nothing happens. Which bug report helps Claude fix it fastest?
- The button doesn't work
- There's a problem on my page, can you fix it?
- Please fix the JavaScript
- The submit button in index.html doesn't respond when clicked — I expected a success message to appear below the form, but no message shows up. No errors in the console.
Other lessons in this chapter
⚠ The full interactive experience needs JavaScript. Please enable it and reload.
※ This is an independent Traditional Chinese teaching project — not an official Anthropic product. Claude™ is a trademark of Anthropic, PBC.