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?