Debugging with an AI Assistant
Find and fix bugs faster by giving an assistant the right evidence and testing its theories one at a time
A taste of a lesson
I get 'TypeError: cannot read properties of undefined' and the assistant's fixes haven't worked. What should I do?
That error means some value you expected to be an object is undefined when the code tries to read a property from it. The fixes are probably guesses because the assistant does not know which value. Look at the stack trace: find the first line in your own code and note the exact expression, like user.profile.name. Add a log just before it to print each part. Once you know which part is undefined, ask why it has no value at that moment. Which line does the trace point to?
Written by the teacher as an example. In your lesson the tutor answers your own questions, and like any AI it can be wrong.
What you will be able to do
- Follow a debugging method: reproduce, read, isolate, hypothesise, test, fix, confirm
- Read error messages and stack traces to find where your code fails
- Give an assistant complete evidence and ask questions that test theories
- Recognise when an assistant is guessing and recover from loops
Lesson plan
- 1 Reproduce first Make the bug happen reliably before trying to fix it. Start
- 2 Reading errors and stack traces Extract the clues from error messages yourself. Start
- 3 Isolating the problem Shrink the failing case to the smallest version that still breaks. Start
- 4 Hypotheses and tests Work with the assistant to form and test one theory at a time. Start
- 5 Fix, confirm and prevent Fix the real cause and make sure it stays fixed. Start
Try asking
About this tutor
For newer developers and students who reach for an assistant whenever something breaks and get mixed results. Assistants can be excellent debugging partners when they get real evidence: the full error, the code involved, what you expected and what you tried. They can also lead you in circles with confident guesses. You will learn a debugging method that works with or without AI: reproduce, read the error, isolate, form a hypothesis, test it, fix and confirm. Along the way you will learn what to paste, what to ask, and how to tell a good theory from a guess.
Reviews
4.7
3 ratingsSample
- Imogen R.Sample
I used to paste errors and pray. Now I read the stack trace first and my questions to the assistant are much better. The minimal reproduction lesson is gold.
- Sakura N.Sample
I am a bootcamp student and this made debugging feel less scary. Adding a test after each fix is now a habit.
- Tunde O.Sample
Patient and clear. The warning signs of guessing were exactly what I had been experiencing.
About the teacher
I teach developers and beginners the daily habits that make AI coding assistants useful instead of risky
9 tutors 411 lessons taught Sample
I am a software developer who teaches the working habits around AI coding assistants: how to describe a task, how to pair with an assistant without losing the thread, how to use a terminal based coding agent, and how to write project instruction files that keep it on track. I teach from the keyboard. We open a small project, try...
See Jude's profile and tutorsMore like this
Other tutors on the same or nearby topics.