After this lesson, you will be able to: Use AI to explain errors, generate unit tests, review code, and write deployment configurations, and recognize when AI's suggestions are wrong.
AI tools shine in three under-appreciated areas: debugging (explaining errors and proposing fixes), testing (drafting unit tests for code that has none), and DevOps (writing the boilerplate config files that new projects always need). This lesson covers all three, and how to tell when AI is hallucinating.
When you hit a confusing error, paste both the code AND the full error message into Claude or Copilot Chat. Ask: "Why is this failing?" Then verify the explanation by tracing it through the code yourself, don't just trust the answer.
Always include the error AND the surrounding code, not just one or the other.
Here's the error I'm getting:TypeError: Cannot read properties of undefined (reading 'map')at /pages/posts.tsx:14:32Here's the relevant code in posts.tsx:const Posts = ({ posts }) => {return posts.map(p => <Post key={p.id} post={p} />);};Why is posts undefined? How do I fix it without breaking other callers?
Hand AI a function and ask: "write Jest unit tests covering the happy path and these edge cases: empty input, very large input, malformed input." AI is good at generating the boilerplate; you tweak the assertions. The result is more tests than you'd write by hand, faster.
Dockerfiles, GitHub Actions workflows, vercel.json, .env.example, README files, all of this is high-template, low-judgment work. AI nails the first draft. You read it, tweak the specifics for your project, and ship.
Pick a function from one of your earlier projects.
Open Claude or Copilot Chat
Paste a function from your wd-04 or wd-09 work
Ask: "write Jest tests covering the happy path, edge cases, and any inputs that should error"
Copy the test file into your project (npm install -D jest)
Run the tests and fix any that fail, note whether the test is wrong or the function is wrong
Hint: don't just ask the same AI to verify itself.
Sign in and purchase access to unlock this lesson.