Prompt Engineering: Structure, Context and Constraints
You can build a prompt with role, task, format and constraints.
Why this lesson matters
You now know that a good prompt is more than a question. But how do you build such a prompt? Is there a structure that always works?
Yes. There's a framework you can use as a blueprint for almost any prompt. Whether you want an email, a report, an analysis or a presentation, the framework is the same. In this lesson you'll learn it by heart.
The Prompt Framework
Every strong prompt contains up to five building blocks:
| Building block | What it does | Example |
|---|---|---|
| Persona | Gives the AI a role and expertise | "You're a senior financial analyst" |
| Task | What exactly the AI has to do | "Write a quarterly report" |
| Context | Background and relevant details | "For an SME with €5M revenue" |
| Format | What the result should look like | "Use a table with 4 columns" |
| Constraints | Limits and conditions | "Max 500 words, no jargon" |
You don't always need all five building blocks. For a simple question, Task + Context is often enough. But the more complex the assignment, the more building blocks you need.
Building block 1: Persona
By giving the AI a role, you steer the tone, the knowledge level and the angle of the answer.
Compare:
Explain inflation.vs.
You're an economics lecturer at a university of applied sciences. Explain inflation to first-year students who have no background in economics.The first answer turns into a Wikipedia article. The second turns into an understandable explanation at the right level.
Good personas:
Keep reading
Leave your name and email address and you can read the rest
You get the whole lesson right away, and every other lesson stays open after that. No password, no confirmation email.
- "You're an experienced project manager in the IT sector"
- "You're a communications adviser at a local council"
- "You're a data analyst who reports to management"
Building block 2: Task
The task is the heart of your prompt. Be as concrete as you can here.
Weak: "Help me with a presentation"
Strong: "Create an outline for a 10-slide presentation on the migration to cloud software. Each slide has a title and 3 bullet points."
Use active verbs: write, analyse, create, compare, summarise, assess. This gives the AI a clear action point.
Building block 3: Context
Context is everything that helps the AI understand your situation. Without context, AI gives a generic answer. With context, you get something tailored.
Types of context:
- Type and size of the business
- Audience for the result
- Reason or problem
- Earlier attempts or the current situation
Building block 4: Format
Tell the AI exactly what the result should look like:
- Bullet points or running text?
- A table with specific columns?
- Numbered steps?
- Email format with a subject line?
- Maximum length?
Example:
Give the result as a table with the columns: Risk | Likelihood (high/medium/low) | Impact | MeasureBuilding block 5: Constraints
Constraints are your guardrails. They stop the AI from wandering off too far.
Examples of constraints:
- "Don't use technical jargon"
- "Base yourself only on the data provided"
- "Maximum 300 words"
- "Don't name any competitors"
- "Write in Dutch"
Example: the complete framework in action
Say you want a financial report written:
[Persona] You're a senior financial controller at a mid-sized manufacturing company.
[Task] Write a management summary of the quarterly report for Q3 2024.
[Context] The company had revenue of €12M in Q3, which is 8% below budget. Margin rose from 22% to 25% thanks to lower purchasing costs. Staff costs are 5% above budget because of 3 extra FTEs.
[Format] Structure:
1. Key figures (table)
2. Analysis of deviations (max 200 words)
3. Three concrete action points
[Constraints] Max 400 words in total. No jargon: the report goes to the board, who have no financial background. Write in Dutch.Quiz
You want Claude to write an email to an unhappy customer. Which building block is missing from this prompt: "Write an email to a customer. Maximum 200 words."?
Which order is most effective when building a prompt?
Want to keep your progress, get the practice files and sign up for the free evening? Create a free account. All you do is click a link in your email.
Create a free account