• Practice
  • About 15 min
  • 5 practice questions

Effective prompts: role, task, format and examples, zero-shot and few-shot

Build prompts from role, task, format and examples, turn weak prompts into strong ones, choose between zero-shot and few-shot prompting, and ask for step-by-step working that you can check.

If something looks wrong, please tell us.

By the end of this lesson you can

  • Write a prompt with a clear role, task, format and, where useful, examples.
  • Diagnose what a weak prompt is missing and rewrite it as a strong one.
  • Choose zero-shot or few-shot prompting and use step-by-step requests to check reasoning.

A chatbot answers the question you actually typed, not the one in your head. A vague prompt gets a generic answer; a precise prompt gets an answer you can use straight away. Writing prompts well - often called prompt engineering - is a practical skill, and exam questions now ask you to spot what a prompt is missing or which prompt will work best.

Four building blocks

A strong prompt

  • Role Who to act as
  • Task The exact job to do - must always be clear
  • Format The shape and size of the answer
  • Examples A sample of the output you want
PartWhat it tells the AIExample line
RoleWho to act asYou are a patient maths teacher for competitive-exam students.
TaskThe exact job to doExplain how to find a discounted price.
FormatThe shape and size of the answerFive numbered steps, then one worked example in rupees, under 150 words.
ExamplesA sample of the output you wantWrite each item like this: Benevolent - kind and generous - The benevolent officer helped every applicant.

The task must always be clear; role, format and examples are added as the job needs them. (Background, audience and limits - the context - are covered in the next lesson.) One job per prompt works better than five jobs at once.

Weak prompts and how to strengthen them

Weak promptWhat is missingStronger prompt
Tell me about GSTTask, level, formatExplain GST to a beginner in five short points, then give one simple example of a shop bill.
Write about riversScope and formatMake a revision table of six peninsular rivers of India with columns River, Where it rises, Where it drains.
Make questionsTopic, number, type, answersMake 5 MCQs on the Fundamental Rights, four options each, with answers and one-line reasons listed at the end.
Explain thisWhat 'this' is, the levelExplain the paragraph below in simple English for a Class 8 student, in under 120 words: ...

Zero-shot and few-shot

A prompt with no examples is zero-shot: "Translate this sentence into Hindi." A prompt that includes one or a few samples is few-shot. Few-shot helps when you need a particular style or a fixed set of labels that the model cannot guess. The examples guide that reply only - they do not retrain the model.

Zero-shot and few-shot

  • Zero-shot
    • No examples in the prompt
    • e.g. "Translate this sentence into Hindi."
  • Few-shot
    • One or a few samples in the prompt
    • Helps when a style or fixed labels cannot be guessed
    • The samples guide that reply only - no retraining

Asking for step-by-step working

For reasoning and arithmetic, add "solve step by step and show each step" (sometimes called chain-of-thought prompting). Writing out the working often makes the reasoning more careful and, more importantly, lets you check each step. It does not guarantee correctness: a step can still be wrong, so recompute anything that matters.

Worked example 1: a quiz prompt built from the four parts

  1. Role: "You are a quiz-maker for students preparing for competitive exams."
  2. Task: "Write 5 multiple-choice questions on the water cycle."
  3. Format: "Four options each. Do not mark answers under the questions; list the answers with a one-line reason at the end."
  4. Example: "Match this style: Which process turns water vapour into droplets? (condensation)"

Holding the answers back lets you attempt the quiz honestly first. You must still check each answer key against your textbook, because a generated key can be wrong.

Worked example 2: few-shot for a fixed format

A student wants vocabulary notes in one fixed pattern. A zero-shot request ("give me 10 difficult words") returns a different layout each time. The few-shot version gives two samples - "Benevolent - kind and generous - The benevolent officer helped every applicant." and "Diligent - hard-working and careful - The diligent clerk checked every file." - then asks for ten more "in exactly this format". The samples show the pattern better than a description could. Meanings should still be checked in a good dictionary.

Worked example 3: checking step-by-step working

Prompt: "A shirt is marked ₹800 and sold at a 15% discount. Find the selling price step by step." Suppose the reply shows: Step 1: 15% of 800 = 120. Step 2: 800 − 120 = 700. Checking each step: step 1 is right (10% = 80, 5% = 40, total 120), but step 2 is wrong - 800 − 120 = 680. Because the working was shown, the slip took seconds to find. The correct selling price is ₹680.

Strong prompt = Role + Task + Format (+ Examples). Zero-shot = no examples; few-shot = a few samples. Ask for step-by-step working so you can check it - not because it is guaranteed right.

Key takeaways: make the task unmistakable, then add a role, a format and examples as needed. Fix weak prompts by naming the topic, level, size and layout. Use few-shot prompting when you need a particular style or set of labels, and ask for step-by-step working so that every step can be checked.

Check your understanding

  1. 1. In the prompt line "Give the answer as a table with columns Term and Meaning", which building block is being supplied?

    1. Role
    2. Example
    3. Task
    4. Format
    Show answer

    Answer: D. It describes the shape of the answer - a table with named columns - which is the format. A role says who to act as, the task is the job itself, and an example is a sample of the output.

  2. 2. A student pastes two sample questions into a prompt and asks for ten more in the same style. This technique is called:

    1. Few-shot prompting
    2. Zero-shot prompting
    3. Retraining the model
    4. Raising the temperature
    Show answer

    Answer: A. Supplying a few samples to guide the answer is few-shot prompting. Zero-shot means no examples. Samples in a prompt guide only that reply; they do not retrain the model.

  3. 3. Which of these prompts is zero-shot?

    1. Here are two labelled headlines; label the next five the same way
    2. Translate this sentence into Hindi: The meeting is postponed.
    3. Using these three sample letters as a model, write a fourth
    4. Follow this example answer and write five more like it
    Show answer

    Answer: B. A zero-shot prompt gives the task with no examples. The translation request supplies no sample, while the other three all include samples, which makes them few-shot.

  4. 4. A chatbot shows this working: "Step 1: 20% of 650 = 130. Step 2: 650 − 130 = 530." What should the student conclude?

    1. Both steps are right, so the answer is 530
    2. Step 1 is wrong; 20% of 650 is 13
    3. Step 2 is wrong; 650 − 130 = 520, so the answer is 520
    4. Step-by-step answers cannot be checked
    Show answer

    Answer: C. Step 1: 10% of 650 = 65, so 20% = 130, which is right. Step 2: 650 − 130 = 520, not 530. Shown working is useful exactly because each step can be checked like this.

  5. 5. Which rewrite best strengthens the weak prompt "Make questions"?

    1. Make questions please
    2. MAKE QUESTIONS NOW
    3. Make questions, questions, questions
    4. Make 5 MCQs on the Fundamental Rights, four options each, with answers and one-line reasons listed at the end
    Show answer

    Answer: D. The strong version names the topic, the number, the question type and how answers are given. Politeness, capital letters or repetition add no information the model can use.

Privacy · Terms · Refunds · Delivery