Debug with AI

Module 2: Work with AI on a real codebase

Course outline

Quick check

Guess first, no penalty. Your app throws KeyError: 'user_id' in production. Which message to the AI gets the most useful answer?

A stack trace is the list of function calls that led to an error, printed with the error itself. It's the most useful thing you can paste, so paste all of it.

A good debugging request has five parts:

  • The exact error and stack trace.
  • The code involved: the function, and how it's called.
  • Expected vs actual: what should happen, and what does.
  • What you've tried, so it doesn't suggest the same thing.
  • The ask: likely causes, ranked, and how to confirm each one. Not a patch yet.

Asking for causes before a patch matters. A patch for a cause nobody confirmed can hide the symptom and leave the bug in place. So confirm the root cause first, with a test that fails for exactly that reason. Then accept a fix only when that test passes.

The rest of this lesson is part of Learn Pro

The first module of every course is free. Learn Pro opens every lesson in every course for $10 a month. All JobRise tools stay free.