Thuta Learning
IntermediateAIbeginner

Giving the AI the Right Context

Relax. We'll talk through this in plain words — no textbook voice.

What you'll walk away with

  • Understand how to give the right context, without the intimidation
  • Get hands-on and try it yourself
  • Learn to spot and dodge the easy mistakes, with a smile

The AI guesses at anything it can't see. Learn which file to open, which error to paste in, and which example to give it.

Take a moment to think about it this way

The context window has limits. Telling the AI to "read the whole project" sometimes makes things worse, not better. The right context is small and relevant: the file to be edited, a similar example file, the full error message, and a description of what the current UI looks like. The more unrelated files you throw in, the more confused the AI gets.

Let's connect this to everyday life

Want to change a button style? Just open Button.tsx and the one page that uses it. Got an API error? Copy the request URL, status code, and response body. "It's not working" on its own isn't context. In Cursor you can attach a file with @. In chat, just paste the relevant function. Never include secrets, .env files, or user data.

Let's try it hands-on, together

text
Paste this, not “it is broken”:

File: apps/web/src/app/api/notes/route.ts
Action: POST /api/notes
Status: 400
Body: { "error": "title required" }
Expected: empty title shows inline error, not a blank page
You should see
Be able to put together a context bundle the AI can actually use to understand a bug.

5-minute try-it

Pick a bug you've actually run into. In 8 lines or fewer, write down the file, the action, the expected result, and the actual result. Double-check that no secrets are included.

One quick warning

Never treat AI output as the final, correct answer. Read through code, secrets, and user data yourself, test it, and only then put it to use.

Easy traps

  • Dumping the entire repo in as context
  • Pasting a screenshot containing an API key into chat

Now try it yourself

Pick a bug you've actually run into. In 8 lines or fewer, write down the file, the action, the expected result, and the actual result. Double-check that no secrets are included.

You'll know it worked when: Be able to put together a context bundle the AI can actually use to understand a bug.

Giving the AI the Right Context | Thuta Learning