Manuals / AI Coding with Cursor / Chapter 7
B · Review & Test · intermediate · ~30 min · Chapter 7 of 11
Debugging with AI: paste errors, not vibes
When stuck, paste the exact error, the relevant code, and what you already tried. "It does not work" produces garbage.
Path progress59%
Step 1 of 2
Error sandwich prompt
Error message + relevant code + expected behavior + what you tried.
Example
## Error
TypeError: Cannot read properties of undefined (reading 'map')
at UserList.jsx:14
## Code (UserList.jsx lines 1-20)
[paste]
## Expected
List renders user names from API response
## Tried
- Added optional chaining on line 14
- Still fails on first render before data loadsDo this now
Take a real error from your terminal. Use the sandwich. Compare to "fix this."
Was this step clear?
Chapter learning outcomes
- Error-driven debugging
- Minimal repro
- Iterative fix loops
Clear these before you leave
Side quest
Debug log
Log 3 bugs you fixed with AI. Note which prompt structure worked best.