LESSON 2 of 6 Beginner
Components of a Good Prompt
The building blocks: role, task, constraints, examples, and format.
5 min read
β’ 3 quiz questions
Think of a prompt like building with LEGO: each piece adds something important.
The main pieces (simple):
- Role β Who should the model pretend to be? Example: βYou are a friendly teacher.β This helps set tone and knowledge.
- Task β What do you want it to do? Example: βExplain what a prompt is in one sentence.β This is the action you ask for.
- Constraints / Format β Tell the model the rules. Example: βUse only 2 sentences and simple words.β Or: βReturn JSON with keys βtitleβ and βsummaryβ.β
- Examples (few-shot) β Show one or two sample input/output pairs so the model can copy the style.
- Context β Any background facts the model needs (short text, list of facts, or a link). Only include what matters.
Quick reusable template (fill the blanks):
βYou are a {role}. {Task}. {Constraints (length, tone, format)}. Example: {show one short sample}.β
Small tips:
- Put the role and task first so the model knows what to focus on.
- Keep constraints short and exact: numbers (e.g., 3 bullets), character limits, or exact keys for JSON.
- Use examples when the format or style is tricky β 1β3 examples usually work best.
When you combine these pieces clearly, the model understands you better and gives more useful answers.
Quick Quiz
Test what you just learned. Pick the best answer for each question.
Q1 Which part of a prompt tells the model what format to return?
Q2 What does giving the model a 'role' do?
Q3 Why include examples in a prompt?