Course contents
Fix a few mistakes
Debug without reading code: reproduce the bug, collect the exact error, give the agent evidence, ask for the cause before the fix, and test the edge cases.
Every app has bugs, and agents create their share. You don't need to read code to get them fixed. You need evidence. An agent given the exact error message and the steps that cause it fixes most bugs on the first try. An agent told “it's broken” guesses, and guesses often break something else.
Four bugs you'll probably meet
| Symptom | Usual cause | Evidence to collect |
|---|---|---|
| A section is blank | A JavaScript error stopped the script, or the data file has a typo | The red error in the browser console |
| Works on your laptop, broken online | File names differ in capital letters, such as Bun.jpg and bun.jpg. Macs and Windows usually ignore the difference; most web hosts don't | The live address, and the missing file's name from the console |
| The badge says “Open” on a Monday | Logic: JavaScript numbers the days from 0, starting on Sunday, which makes off-by-one mistakes easy | The day and time you tested, and what the badge said |
| A price shows as 4.5 instead of $4.50 | The number isn't formatted as money | A screenshot of the wrong price |
Open the browser console
The console is where the browser writes errors. Right-click the page, choose Inspect, and click the Console tab. Red lines are errors. You don't need to understand them: copy them exactly and paste them to the agent. The first red line usually matters most, because later errors are often knock-on effects of the first.
The specials section is blank. Here's the console. Click the lines worth pasting to the agent.
The bug report an agent needs
- What you did: “I added a pumpkin bun to specials.json and reloaded.”
- What you expected: “The new item appears.”
- What happened: “The whole specials section is blank.”
- The evidence: the exact console error, a screenshot, or the live address.
- What you want: “Explain the cause first, then fix it.”
Put the debugging loop in order.
- Read the explanation, then approve the fix
- Send a bug report and ask for the cause before the fix
- Commit the fix with a message that names the bug
- Reproduce the bug so you can see it happen
- Repeat your steps to confirm the bug is gone
- Collect the evidence: the exact error, your steps, a screenshot
The quick fix
The Open now badge throws an error every Sunday.
The agent proposes: “I'll wrap the badge code in a try/catch so the error doesn't show.”
Break the data on purpose
Open
specials.jsonin any text editor, delete one comma between two items, save, and reload the page with the console open.VerifyThe specials section is blank, and the console shows a red SyntaxError.Report it like a pro
Send a bug report with the exact error lines.
promptThe specials section is blank since I edited specials.json. Console error: [paste the red error line, and the line under it] Explain the cause in one sentence first. Then fix it, and tell me how to avoid this next time.VerifyThe agent names the missing comma and where it was, then fixes it. The specials are back.Let the agent plant a bug
Ask the agent to hide one realistic bug for you to find. This is the safest way to practice: you know a bug exists, and the agent knows the answer.
promptPlant one realistic bug somewhere in this site's JavaScript, the kind a beginner's project might really have. Don't tell me what it is or where. Don't commit it. I'm going to find it.VerifySomething on the site is now wrong. Look in the browser and the console for a clue.Find it and fix it
Use the console and the visitor check to find the symptom. Send a bug report with the evidence and ask for the cause before the fix.
VerifyThe bug is gone when you repeat your steps, and the agent confirms it was the one it planted.Test the edge cases, then commit
Ask the agent to check the badge at specific times. It can do this without waiting for the clock, by testing the logic with chosen dates.
promptCheck the "Open now" badge at each of these local times and show me what it says for each: Sunday 12:00, Monday 12:00, Tuesday 6:59, Tuesday 7:00, Tuesday 14:59, Tuesday 15:00. Expected: open, closed, closed, open, open, closed.VerifyAll six moments match the expected results. Commit, then push.
Plain-English definitions from the AI Coding Dictionary.