Setting the Scene Effectively
Framing techniques: 'You are...', 'Given that...', 'The goal is...'.
Setting the Scene Effectively is a free AI Prompt Engineering lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the AI Prompt Engineering learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Opening Frames That Work
The first sentence of your prompt is the most important. It sets the model's operating context — the lens through which it will interpret everything that follows.
Effective opening frames include: You are..., The context is..., Given that..., and The goal is.... Each activates a different dimension of context before the actual task begins.
The 'You Are...' Frame
The You are... frame assigns a persona to the model. This activates the vocabulary, reasoning style, and priorities associated with that role.
Key: be specific. 'You are an expert' is weak. 'You are a senior Python engineer with 10 years of experience who prioritizes readability over cleverness' is strong.
Persona frames work best when the persona implies a specific way of thinking and communicating that you need.
import anthropic
client = anthropic.Anthropic(api_key='sk-ant-your-key-here')
persona_prompts = [
'You are a Socratic philosophy professor. Ask 3 probing questions about this claim: AI will replace programmers.',
'You are a skeptical venture capitalist who has seen 500 pitches. Give brutal feedback on this pitch: We are building an AI writing assistant.',
'You are a patient kindergarten teacher. Explain what a computer does in 3 sentences for 5-year-olds.'
]
for prompt in persona_prompts:
response = client.messages.create(
model='claude-opus-4-5',
max_tokens=150,
messages=[{'role': 'user', 'content': prompt}]
)
print(f'--- Persona ---')
print(prompt[:80] + '...')
print(response.content[0].text.strip())
print()The 'You Are...' Frame in System Messages
The most effective place for a persona frame is the system message, not the user turn. System message personas stay active for the entire conversation — you do not need to repeat them.
A well-crafted system persona can completely transform how an AI assistant responds across dozens of follow-up questions.
import openai
client = openai.OpenAI(api_key='sk-your-key-here')
# Persona set once in system; stays active for all turns
system_persona = (
'You are Marcus, a senior software architect at a Fortune 500 company. '
'You have 20 years of experience with distributed systems. '
'Your communication style: direct, pragmatic, no buzzwords. '
'You always ask about scale and failure modes before giving architecture advice. '
'If a question lacks context, ask one clarifying question before answering.'
)
response = client.chat.completions.create(
model='gpt-4o',
messages=[
{'role': 'system', 'content': system_persona},
{'role': 'user', 'content': 'Should we use microservices for our new product?'}
]
)
print(response.choices[0].message.content)The 'The Context Is...' Frame
The The context is... frame sets the situational background without assigning a persona. Use it when you need the model to reason about your specific situation rather than adopt a character.
It is particularly effective for technical and analytical tasks where you want the model to reason as itself but with full awareness of your constraints.
import anthropic
client = anthropic.Anthropic(api_key='sk-ant-your-key-here')
response = client.messages.create(
model='claude-opus-4-5',
max_tokens=300,
messages=[{
'role': 'user',
'content': (
'The context is: we are a 5-person startup with $2M in seed funding. '
'Our Python monolith handles 10,000 users and is starting to show performance issues. '
'We have one backend engineer and cannot hire more for 6 months. '
'We need to choose between refactoring the monolith vs migrating to microservices.\n\n'
'Give a recommendation with 3 supporting reasons. Be direct.'
)
}]
)
print(response.content[0].text)The 'Given That...' Frame
The Given that... frame sets a premise or assumption that shapes the entire response. Use it to establish facts the model must treat as true for the purpose of the task.
This is powerful for hypothetical analysis, conditional planning, and scenario-based writing where you need the model to reason from a specific starting point.
import openai
client = openai.OpenAI(api_key='sk-your-key-here')
scenarios = [
'Given that our user base will grow 10x in 6 months, what architecture changes should we make today?',
'Given that we must launch in 2 weeks with the current team, which features should we cut from the MVP?',
'Given that our API key was exposed publicly for 3 hours, what steps should we take in the next 24 hours?'
]
for scenario in scenarios:
response = client.chat.completions.create(
model='gpt-4o',
max_tokens=120,
messages=[{
'role': 'user',
'content': scenario + ' (Answer in 3 bullet points.)'
}]
)
print(f'Scenario: {scenario[:60]}...')
print(response.choices[0].message.content.strip())
print()The 'The Goal Is...' Frame
The The goal is... frame states the downstream purpose of the output. It is different from the task instruction — it explains why you need this output and what it must accomplish.
This frame helps the model make better micro-decisions: what level of persuasion to use, what objections to preempt, what details to include or omit.
import anthropic
client = anthropic.Anthropic(api_key='sk-ant-your-key-here')
goal_frames = [
(
'The goal is to get the reader to schedule a 30-minute demo call. '
'Write a 100-word cold outreach email for our AI data pipeline tool '
'targeting data engineers at e-commerce companies.'
),
(
'The goal is to help the reader pass a senior Python interview at a FAANG company. '
'Explain Python decorators with one conceptual explanation and one practical code example.'
)
]
for prompt in goal_frames:
response = client.messages.create(
model='claude-opus-4-5',
max_tokens=200,
messages=[{'role': 'user', 'content': prompt}]
)
print('--- Goal Frame ---')
print(prompt[:80] + '...')
print(response.content[0].text.strip())
print()Combining Opening Frames
The most powerful prompts combine multiple opening frames before the task instruction. A typical high-performance structure:
- You are... [persona]
- The context is... [situation]
- The goal is... [downstream purpose]
- Given that... [key assumption or constraint]
- [Task instruction]
Each frame adds a layer of orientation. Together they leave the model with very little guesswork to do.
import openai
client = openai.OpenAI(api_key='sk-your-key-here')
combined_frame_prompt = (
'You are a senior product manager with 10 years of B2B SaaS experience.\n'
'The context is: our team is debating whether to build a native mobile app '
'or keep investing in our responsive web app.\n'
'The goal is: to help our leadership team make a clear go/no-go decision at '
'next week\'s board meeting.\n'
'Given that: we have 3 engineers, $300k runway, and 85% of current users are on desktop.\n\n'
'Write a 250-word recommendation memo with a clear position (build or wait) '
'and 3 supporting arguments. End with one risk to monitor.'
)
response = client.chat.completions.create(
model='gpt-4o',
messages=[{'role': 'user', 'content': combined_frame_prompt}]
)
print(response.choices[0].message.content)Framing for Tone and Voice
Opening frames can also set tone and voice without using the word 'tone' at all. Describing the persona and situation implicitly sets the register:
- 'You are a warm, patient mentor speaking to a struggling student' → automatically warm and encouraging
- 'You are a no-nonsense military logistics officer' → automatically direct and precise
- 'You are a witty tech journalist writing for Wired' → automatically clever and accessible
import anthropic
client = anthropic.Anthropic(api_key='sk-ant-your-key-here')
frames = [
'You are a warm, patient mentor. Explain why learning to code is hard but worth it.',
'You are a no-nonsense military logistics officer. Explain why learning to code is hard but worth it.',
'You are a witty tech journalist writing for Wired. Explain why learning to code is hard but worth it.'
]
for frame in frames:
response = client.messages.create(
model='claude-opus-4-5',
max_tokens=80,
messages=[{'role': 'user', 'content': frame + ' (2 sentences only)'}]
)
print(f'Frame: {frame[:55]}...')
print(response.content[0].text.strip())
print()Framing for Analytical Rigor
When you need rigorous, critical analysis rather than enthusiastic agreement, open with a frame that explicitly activates a skeptical or analytical mindset:
- 'You are a critical reviewer whose job is to find flaws...'
- 'Play devil's advocate and challenge the following...'
- 'Assume the opposite of the conventional wisdom and argue...'
- 'Steelman the weakest argument against...'
import openai
client = openai.OpenAI(api_key='sk-your-key-here')
analytical_frames = [
'You are a critical reviewer whose job is to find fatal flaws. Review this startup idea: a subscription box for AI prompt templates.',
'Play devil\'s advocate. Challenge this claim: AI will make every knowledge worker 10x more productive.',
'Steelman the weakest argument against remote work, then give the strongest counter-argument.'
]
for frame in analytical_frames:
response = client.chat.completions.create(
model='gpt-4o',
max_tokens=120,
messages=[{'role': 'user', 'content': frame + ' (3 sentences max)'}]
)
print(f'Frame type: analytical/critical')
print(f'Prompt: {frame[:60]}...')
print(response.choices[0].message.content.strip())
print()When NOT to Use a Persona Frame
Persona frames are not always the right tool. Avoid them when:
- You need objective data extraction — a persona adds bias
- You are processing structured data — personas are distracting
- The task is purely mechanical — no reasoning involved
- You want the model's genuine assessment — a persona shapes the opinion
For tasks like 'convert this CSV to JSON' or 'count the number of sentences in this paragraph', no frame is needed — just the instruction.
import anthropic
client = anthropic.Anthropic(api_key='sk-ant-your-key-here')
# Persona frame is unhelpful here — just adds tokens
prompt_with_unnecessary_frame = (
'You are an expert data processing specialist with years of experience. '
'Convert the following to JSON: Name: Alice, Age: 30, City: London'
)
# Clean, direct instruction
prompt_direct = (
'Convert to a JSON object with keys name, age, city:\n'
'Name: Alice, Age: 30, City: London'
)
for label, prompt in [('WITH UNNECESSARY FRAME', prompt_with_unnecessary_frame), ('DIRECT', prompt_direct)]:
response = client.messages.create(
model='claude-opus-4-5',
max_tokens=50,
messages=[{'role': 'user', 'content': prompt}]
)
print(f'[{label}]')
print(response.content[0].text.strip())
print()Testing Your Frames
The best way to learn which frames work for your use case is to run A/B tests: same task, different opening frames, compare outputs.
Test these dimensions:
- No frame vs persona frame
- Vague persona vs specific persona
- Context frame only vs context + goal frame
- One frame vs combined frames
Keep a log of which frames produce the best outputs for each task category in your work.
import openai
client = openai.OpenAI(api_key='sk-your-key-here')
task = 'Explain the pros and cons of using TypeScript over JavaScript.'
frames = {
'No frame': task,
'Persona frame': f'You are a TypeScript advocate who also knows JavaScript deeply. {task}',
'Goal frame': f'The goal is to help a JavaScript developer decide if switching to TypeScript is worth it. {task}',
'Combined frame': f'You are a pragmatic senior engineer. The goal is to help a JavaScript developer decide. {task} Give a balanced view in 3 bullet points.'
}
for label, prompt in frames.items():
response = client.chat.completions.create(
model='gpt-4o', max_tokens=80,
messages=[{'role': 'user', 'content': prompt}]
)
print(f'[{label}]: {response.choices[0].message.content.strip()[:120]}...')
print()Knowledge Check
A developer wants the AI to give critical, harsh feedback on their startup pitch deck — not encouraging, not balanced, purely adversarial critique. Which opening frame achieves this best?
Setting the Scene — Recap
Opening frames orient the model before it reads your task instruction. The four most effective frames:
- 'You are...': assigns a persona with specific expertise, communication style, and priorities
- 'The context is...': sets situational background without a persona
- 'Given that...': establishes premises or constraints the model must treat as true
- 'The goal is...': defines the downstream purpose of the output
Combine frames for complex tasks. Use no frame for purely mechanical tasks. Test frame variations to find what works best for your use case.
Frequently asked questions
Is the “Setting the Scene Effectively” lesson free?
Yes — the full text of “Setting the Scene Effectively” is free to read here on the web, and the AI Prompt Engineering course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the AI Prompt Engineering course, upgrade to CoddyKit PRO.
What will I learn in “Setting the Scene Effectively”?
Framing techniques: 'You are...', 'Given that...', 'The goal is...'. You practise AI Prompt Engineering with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start AI Prompt Engineering?
No prior experience is required. AI Prompt Engineering on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Setting the Scene Effectively” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this AI Prompt Engineering lesson?
Yes. Every AI Prompt Engineering lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- What Context Means in AI Prompting
- Providing Background Information
- Setting the Scene Effectively
- Context Length and Relevance