๐ Context Setting
Context setting is the practice of giving the AI background information before asking your question. It's answering the who, what, when, where, and why before the how. The more relevant context you provide, the more tailored and useful the AI's response becomes.
Think of it like calling a doctor. You wouldn't just say "I feel bad." You'd say "I'm 30, I've had a headache for two days, I took ibuprofen but it didn't help, and I work at a computer all day." That context completely changes the advice you get.
Why This Mattersโ
AI has no memory of your life, your job, or your situation unless you tell it. Every conversation starts from zero. If you don't set the context, the AI will make assumptions โ and those assumptions are almost always wrong.
Context transforms generic answers into personalized solutions:
| Without Context | With Context |
|---|---|
| Generic email template | Email tailored to your specific situation |
| Textbook explanation | Explanation matched to your skill level |
| One-size-fits-all advice | Advice that fits your constraints |
| Vague code suggestion | Code that fits your tech stack |
The Who/What/When/Where/Why Frameworkโ
Before writing any prompt, answer these five questions:
1. WHO are you?โ
Your role, experience level, and position shape what kind of help you need.
"I'm a junior developer at a startup..." "I'm a small business owner with no technical background..."
2. WHAT is the situation?โ
What's happening right now? What problem are you facing?
"Our website traffic dropped 40% last month..." "I need to present quarterly results to the board tomorrow..."
3. WHEN is this relevant?โ
Timing and deadlines change the advice dramatically.
"The deadline is in 2 hours..." "We're planning for Q3 next year..."
4. WHERE does this apply?โ
The environment, platform, or market matters.
"This is for a US-based e-commerce site..." "Our team works remotely across 4 time zones..."
5. WHY does this matter?โ
The goal or motivation behind your request changes the approach.
"We need to reduce customer churn..." "I want to pass my AWS certification exam..."
How Context Windows Workโ
Every AI model has a context window โ the maximum amount of text it can process at once. This means you need to be strategic about which context you include:
- Include: Details that directly affect the answer
- Exclude: Irrelevant background that wastes tokens
- Prioritize: Put the most important context first
Prompt Exampleโ
Context: I'm a project manager at a software company (team of 8 developers).
We're building a healthcare app that must comply with HIPAA regulations.
We use Agile/Scrum with 2-week sprints.
Situation: One of our key developers just resigned, and we have a major
release deadline in 6 weeks. The remaining features include: patient data
encryption, appointment scheduling, and billing integration.
Task: Create a revised sprint plan that accounts for the reduced team.
Prioritize features by regulatory requirement and suggest which features
could be moved to a v1.1 release. Format as a table with columns:
Feature, Priority (P0/P1/P2), Sprint, Risk Level, Notes.
โ Bad Exampleโ
Write an email
Write an email to whom? About what? In what tone? For what purpose? The AI has zero context and will produce something completely generic and useless.
โ Improved Exampleโ
Context: I'm a project manager at a web development agency. My client
(a restaurant chain) was supposed to deliver their menu content and photos
by last Friday, but they haven't responded to two follow-up messages.
Situation: Without their content, our design team is blocked, and we risk
missing the website launch date (March 15). We have a good relationship
with this client, and I don't want to damage it.
Task: Write a professional but firm email to the client requesting an
update on the content delivery. The email should:
- Acknowledge the delay without being accusatory
- Clearly state the impact on the timeline
- Propose a new deadline (this Wednesday)
- Offer to help if they're having trouble gathering content
- Keep the tone warm but direct
- Max 150 words
๐งช Try It Yourself
Edit the prompt and click Run to see the AI response.
Practice Challengeโ
Task: You want the AI to help you prepare for a job interview. Write a prompt that includes full context:
- Who you are โ your current role, experience level, and skills
- What the situation is โ the company, the job title, the interview format
- When โ how soon is the interview
- Where โ is it remote, in-person, a specific industry
- Why โ why you want this job specifically
Write this prompt and compare the response to simply asking: "Help me prepare for a job interview."
Bonus: After getting the initial response, add one more piece of context (e.g., "I'm nervous about behavioral questions") and see how the answer adapts.
Real-World Scenarioโ
Scenario: A developer needs help debugging an error in their application.
Without context:
"My app is crashing. How do I fix it?"
The AI can't help with this. It doesn't know the language, framework, error message, or what the app does.
With context:
"I'm building a React 18 app with TypeScript and Next.js 14 (App Router). When I navigate from the dashboard page to the settings page, I get this error:
TypeError: Cannot read properties of undefined (reading 'user'). The error happens inSettingsPage.tsxat line 24 where I callsession.user.name. I'm using NextAuth.js for authentication. The dashboard page works fine and shows the user data correctly. This started happening after I upgraded NextAuth from v4 to v5 yesterday."
Now the AI has everything: the tech stack, the exact error, where it happens, what works, and what changed. It can give a precise, actionable fix.
Interview Questionโ
Q: How does providing context in a prompt affect AI output, and what framework can you use to structure context effectively?
A: Providing context transforms AI output from generic to personalized by giving the model the background information it needs to tailor its response. Without context, the AI must make assumptions that are usually wrong. An effective framework for structuring context is the Who/What/When/Where/Why approach: (1) Who you are (role, experience), (2) What the situation is (problem, current state), (3) When it's relevant (deadlines, timeline), (4) Where it applies (platform, environment, market), and (5) Why it matters (goal, motivation). This framework ensures you provide the right details while keeping the prompt focused and efficient within the model's context window.
Summaryโ
- Context setting gives the AI background information to personalize its response
- Without context, AI makes wrong assumptions and gives generic answers
- Use the Who/What/When/Where/Why framework to structure your context
- Who: Your role and experience level
- What: The current situation or problem
- When: Deadlines and timeline
- Where: Platform, environment, or market
- Why: Your goal or motivation
- Be strategic about what context to include โ focus on what directly affects the answer
- Put the most important context first in your prompt
- Context + clear instructions = highly tailored, useful AI output