Prompt Engineering for Beginners: Role, Task, Context and Format (with 5 Examples)
Generative AI course · Chapter 2 · Estimated reading time: 22 minutes
In the last chapter you wrote your first prompts and saw that a clear request gets a clear answer. In this chapter we make that skill solid. You will learn one simple formula with 4 parts: Role, Task, Context and Format. We will not start with theory. We will start with a bad answer and a good answer, side by side, and find out what made the difference. Then you will build 5 real prompts, one part at a time, and run them yourself. By the end you will have a template you can copy for any task, at college or at work.
What you will learn in this chapter
- Why some prompts get weak answers
- The 4 parts: Role, Task, Context, Format
- Build a client email one part at a time
- Get a table you can check in Excel
- Write the same offer in two styles
- Rewrite weak prompts into strong ones
- Run one prompt in 4 tools
- A copy-paste prompt template
- Which part to fix for each problem
1. Suppose we work in a food delivery support team
Suppose we are Neha, and we work in the customer support team of a food delivery app like Swiggy. A customer writes:
My biryani order is 40 minutes late and the app still says "preparing". This is the second time this week!
Our team uses an AI tool to draft replies. Two people on the team type two different prompts.
Person A types a weak prompt:
reply to customer
The AI writes something like this:
Thank you for contacting us. We apologise for any inconvenience caused.
Please let us know how we can help you.
That reply is polite, but useless. It does not say sorry for the late biryani. It asks the customer a question they already answered. The customer will be even more angry.
Person B types a strong prompt:
You are a friendly, calm customer support agent for a food delivery app in India.
Write a reply to a customer whose biryani order is 40 minutes late. The app still shows "preparing".
This is the customer's second late order this week, so they are upset.
We can offer a ₹75 coupon for the next order. Do not promise an exact delivery time.
Write 3 short sentences. No emojis. Start with an apology.
The AI writes something like this:
We are really sorry that your biryani is 40 minutes late, and we understand how frustrating this is, especially for the second time this week.
We have asked the restaurant to update your order right away, and we will message you as soon as it is picked up.
As an apology, we have added a ₹75 coupon to your account for your next order.
Same AI. Same customer. Very different answer. The only difference was the prompt.
What did Person B add?
Read Person B's prompt again, line by line:
- "You are a friendly, calm customer support agent…" tells the AI who to be. This is the Role.
- "Write a reply to a customer…" tells the AI what to do. This is the Task.
- "Biryani 40 minutes late, app says preparing, second time this week, ₹75 coupon, no exact time" gives the AI the facts and limits. This is the Context.
- "3 short sentences, no emojis, start with an apology" tells the AI how the answer should look. This is the Format.
Writing prompts like this, on purpose, is called prompt engineering. It sounds like a big word, but it only means: give the AI what it needs, so it does not have to guess.
2. The 4 parts of a good prompt
| Part | The question it answers | Example words | What goes wrong if you skip it |
|---|---|---|---|
| Role | Who should the AI be? | "You are a friendly support agent", "You are an Excel trainer" | The tone is general, like a robot |
| Task | What exactly should it do? | "Write a reply", "Summarise", "Make a table", "Explain" | The AI does something different from what you wanted |
| Context | What facts, limits and audience must it know? | Names, dates, numbers, "do not promise a time", "for a 12-year-old" | The AI invents details or gives a general answer |
| Format | How should the answer look? | "3 sentences", "a table with columns…", "bullet points", "under 80 words" | The answer is too long, too short or hard to use |
Ravindra Bagale's Tip
Many students write only the Task ("write an email") and then blame the AI for a bad answer. The Task is only one part out of four. Before you press Enter, ask yourself 4 quick questions: Who? What? Which facts? What shape? If any answer is missing, add one line for it.
Easy way to remember: think of giving work to a new intern on their first day. You tell them who they are acting as, what to do, the details they need, and how you want the result. The AI is that intern. It is fast, but it knows nothing about your situation until you tell it.
3. Worked example 1: build a client email one part at a time
Situation: suppose we are Arjun, a software engineer at Infosys. Our project for a client (a bank in the UK) is late by one week, because the client's test data arrived late. We must tell the client's manager, Ms. Clara Lewis, in a professional email.
We will add one part at a time and watch the answer improve. Run each step in ChatGPT, Gemini, Claude or Copilot. Start a new chat for each step so the AI does not remember the earlier step.
Step 1: Task only
Write an email about a project delay.
Expected output (yours will be similar, not the same):
Subject: Project Delay
Dear [Recipient],
I am writing to inform you that the project has been delayed due to unforeseen circumstances.
We apologise for the inconvenience and are working to complete it as soon as possible.
Best regards,
[Your Name]
Problem: "unforeseen circumstances" and "as soon as possible" tell the client nothing. A real client would be unhappy with this.
Step 2: Role + Task
You are a senior project manager at an Indian IT services company, writing to a client in the UK.
Write an email about a project delay.
Expected output (shortened):
Subject: Update on Project Timeline
Dear [Client Name],
I hope you are well. I would like to give you an update on our project timeline.
Due to some challenges, we expect a short delay in delivery...
Better: the tone is now professional and calm. But it is still general. The AI still does not know what happened.
Step 3: Role + Task + Context
You are a senior project manager at an Indian IT services company, writing to a client in the UK.
Write an email about a project delay.
Context:
- Client manager: Ms. Clara Lewis.
- Project: the new loan-approval screen for the bank's mobile app.
- Old delivery date: 24 October. New date: 31 October (one week later).
- Reason: the test data from the client's side arrived 6 days late.
- What we are doing: the team is testing on weekends to save time.
- Do not blame the client in a rude way. Be honest and polite.
Expected output (shortened):
Subject: Revised delivery date for the loan-approval screen: 31 October
Dear Ms. Lewis,
I am writing to update you on the loan-approval screen. Because the test data reached us
six days later than planned, we will not be able to deliver on 24 October as agreed.
Our new delivery date is 31 October...
Much better: real facts, the new date, and an honest reason. Now the answer is useful.
Step 4: Role + Task + Context + Format (the full prompt)
You are a senior project manager at an Indian IT services company, writing to a client in the UK.
Write an email about a project delay.
Context:
- Client manager: Ms. Clara Lewis.
- Project: the new loan-approval screen for the bank's mobile app.
- Old delivery date: 24 October. New date: 31 October (one week later).
- Reason: the test data from the client's side arrived 6 days late.
- What we are doing: the team is testing on weekends to save time.
- Do not blame the client in a rude way. Be honest and polite.
Format:
- A clear subject line that includes the new date.
- 3 short paragraphs: what changed, why, what we are doing.
- End with one question asking if a 15-minute call on Monday would help.
- Under 150 words. British English spelling.
Expected output:
Subject: Revised delivery date for the loan-approval screen: 31 October
Dear Ms. Lewis,
I am writing to let you know that the loan-approval screen will now be delivered on
31 October instead of 24 October.
The test data for this release reached us six days later than planned, and we need
this time to test every approval case properly before handing it over.
To keep the delay to one week, our team is also testing over the weekend. I will send
you a short progress note every Wednesday until delivery.
Would a 15-minute call on Monday be helpful to go through the new plan?
Kind regards,
Arjun
Project Manager
What changed at each step
| Step | Parts used | Result |
|---|---|---|
| 1 | Task | General, empty email |
| 2 | Role + Task | Professional tone, but no facts |
| 3 | Role + Task + Context | Real facts, honest reason, new date |
| 4 | All 4 parts | Ready to send after one read |
Ravindra Bagale's Tip
In a real company, check your company's AI policy before you paste project details into a public AI tool. Many companies give an approved tool (for example Microsoft Copilot with a work account). If you are not sure, replace names with placeholders like [CLIENT] and [PROJECT], and put the real names back yourself before sending.
4. Worked example 2: a weekly sales summary you can check in Excel
Situation: suppose we are Kavya, and we help run a small mobile accessories shop in Nashik. Every Monday the owner wants a short summary of last week's sales. We will ask the AI to make a table, and then we will check its numbers in Excel. This is important: AI is good at writing, but it can make mistakes with numbers.
- Open any of the four tools.
-
Copy and paste this full prompt:
Role: You are a careful sales analyst for a small shop. Task: Make a weekly sales summary from the data below. Context: These are last week's sales, Monday to Sunday, in rupees. Monday 4,200; Tuesday 3,800; Wednesday 5,100; Thursday 4,600; Friday 6,300; Saturday 9,800; Sunday 8,700. Do not add any data that is not given. Format: 1. A table with columns: Day, Sales (₹). 2. Below the table, the total for the week and the daily average. 3. Then 3 short bullet points: best day, weakest day, one simple idea for next week. -
Press Enter.
Expected output:
| Day | Sales (₹) |
|---|---|
| Monday | 4,200 |
| Tuesday | 3,800 |
| Wednesday | 5,100 |
| Thursday | 4,600 |
| Friday | 6,300 |
| Saturday | 9,800 |
| Sunday | 8,700 |
Total for the week: ₹42,500
Daily average: ₹6,071 (rounded)
- Best day: Saturday (₹9,800).
- Weakest day: Tuesday (₹3,800).
- Idea: weekends sell more than twice a weak weekday, so keep extra stock and one extra helper on Saturday and Sunday.
Now check the numbers in Excel (do not skip this)
- Open Excel (or Google Sheets).
- In cell
A1typeDay, and in cellB1typeSales. - In cells
A2toA8type the days, Monday to Sunday. - In cells
B2toB8type the sales numbers:4200,3800,5100,4600,6300,9800,8700. - In cell
B10type=SUM(B2:B8)and press Enter. You should see42500. - In cell
B11type=AVERAGE(B2:B8)and press Enter. You should see6071.43. - In cell
B12type=MAX(B2:B8). You should see9800. - In cell
B13type=MIN(B2:B8). You should see3800. - Compare each number with the AI's answer.
If the AI's total or average is different from Excel, Excel is right. Tell the AI in the same chat:
Your total is wrong. Excel shows the total as 42,500 and the average as 6,071.43. Please fix the summary.
Ravindra Bagale's Tip
Many students trust the AI's totals because the table looks neat. A neat table can still have a wrong number. For any number that goes to your boss, your client or your CA, check it with a formula in Excel. The AI writes the words; Excel checks the maths.
Why the prompt worked: the Context gave exact numbers and said "do not add any data". The Format asked for a table, a total, an average and 3 bullets, in that order. Nothing was left for the AI to guess.
5. Worked example 3: a Diwali WhatsApp offer for a kirana shop (two versions)
Situation: suppose Mr. Patil runs Patil Kirana Stores in Kothrud, Pune. For Diwali he wants to send a WhatsApp message to his regular customers. The same offer can be written in different styles. We only change the Role and the Format, and keep the Task and Context the same.
The shared Context (copy this into both prompts):
Shop: Patil Kirana Stores, Kothrud, Pune.
Offer: 10% off on dry fruits and sweets boxes, 20 to 26 October.
Free home delivery for orders above ₹999 within 3 km.
Order on WhatsApp at 98XXXXXX10. (Use this exact placeholder number.)
Version A: warm and simple, for older customers
Role: You are a friendly neighbourhood shopkeeper who knows his customers by name.
Task: Write a Diwali WhatsApp message announcing our offer.
Context: [paste the shared Context here]
Format: 5 short lines. Simple English. Start with a Diwali greeting. One diya emoji at the start only. End with "Patil Kaka".
Expected output:
🪔 Happy Diwali to you and your family!
This Diwali, get 10% off on dry fruits and sweets boxes at Patil Kirana Stores, Kothrud.
Offer valid from 20 to 26 October.
Free home delivery within 3 km on orders above ₹999.
To order, just WhatsApp us at 98XXXXXX10. – Patil Kaka
Version B: short and punchy, for young customers
Role: You are a social media writer for a modern local shop.
Task: Write a Diwali WhatsApp message announcing our offer.
Context: [paste the shared Context here]
Format: 3 lines only. Line 1 is a catchy hook under 8 words. Use 3 emojis in total. Put the offer dates in line 2. End with a clear call to action.
Expected output:
✨ Diwali gifting sorted in 2 minutes! ✨
10% OFF dry fruits and sweets boxes, 20 to 26 Oct, plus free delivery above ₹999 (within 3 km).
WhatsApp "DIWALI" to 98XXXXXX10 now 🎁
Compare the two versions
| Version A | Version B | |
|---|---|---|
| Role | Friendly shopkeeper | Social media writer |
| Format | 5 lines, 1 emoji, signed "Patil Kaka" | 3 lines, 3 emojis, catchy hook |
| Feels like | A message from someone you know | An advert |
| Best for | Older, regular customers | Young customers who scroll fast |
| Task and Context | Same | Same |
The facts did not change. Only the Role and the Format changed, and the message became completely different. This is a big lesson: Role controls the voice, Format controls the shape.
Ravindra Bagale's Tip
Check every fact after the AI writes an offer: the dates, the discount and the phone number. AI sometimes changes "20 to 26 October" into "till 26 October" or rounds ₹999 to ₹1,000. One wrong number in a shop offer means angry customers at the counter.
6. Worked example 4: three weak prompts and their rewrites
Here are 3 prompts that beginners often type, and a strong rewrite for each. Run the weak one first, then the strong one, and compare.
Weak prompt 1: "explain cloud computing"
Problem: no audience, no length, no shape. You get a long, textbook answer.
Rewrite:
Role: You are a patient computer teacher.
Task: Explain what cloud computing is.
Context: The learner is a commerce student who has never used a server. Use one example from daily life in India, like renting vs buying a house, and one example from a real app like Netflix.
Format: 5 short bullet points, then one line that starts with "In one sentence:".
Expected output (shortened):
- Cloud computing means using someone else's computers over the internet, instead of buying your own.
- It is like renting a flat instead of buying a house: you pay only for what you use, and the owner does the repairs.
- Netflix does not keep millions of videos on your phone. The videos are stored on cloud servers and stream to you.
- ...
In one sentence: cloud computing is renting computers over the internet and paying only for what you use.
Weak prompt 2: "make my resume better" (with a resume pasted)
Problem: "better" means different things. The AI may rewrite everything, add skills you do not have, or make it 2 pages long.
Rewrite:
Role: You are an HR recruiter who hires freshers for accounts jobs in Pune.
Task: Improve only the "Projects" section of my resume, pasted below.
Context: I am applying for a Junior Accountant role. Keep every fact true. Do not add any skill or tool I did not mention.
Format: Keep the same 2 projects. For each, write 2 bullet points that start with an action verb (Prepared, Reconciled, Built). Show a number where I gave one.
[paste your Projects section here]
Why it is better: the Role is a real hiring person, the Task is only one section, the Context protects the truth, and the Format fixes the shape.
Weak prompt 3: "give me ideas for a YouTube channel"
Problem: the AI does not know your skill, language, time or goal, so you get 10 general ideas that everyone already has.
Rewrite:
Role: You are a YouTube growth coach for Indian creators.
Task: Suggest 5 channel ideas for me.
Context: I am a 2nd-year engineering student in Nagpur. I am good at Excel and explaining things simply. I can make 2 videos a week, in English. I have only a phone and a laptop.
Format: A table with columns: Channel idea, Who will watch, First 3 video titles, Why it suits me.
Summary of the 3 rewrites
| Weak prompt | Main missing part | What the rewrite added |
|---|---|---|
| "explain cloud computing" | Context, Format | Audience, two examples, 5 bullets and a one-line summary |
| "make my resume better" | Task, Context | Only one section, keep facts true, a fixed bullet style |
| "give me ideas for a YouTube channel" | Context, Format | Your skills, time and tools, and a comparison table |
7. Worked example 5: the same prompt in all 4 tools
Do good prompts work only in ChatGPT? No. Let us test it.
- Open 4 browser tabs:
chatgpt.com,gemini.google.com,claude.aiandcopilot.microsoft.com. - Sign in to each (see the previous chapter if you need help).
-
Copy this prompt and paste it into all four tabs:
Role: You are a careful career counsellor in India. Task: Compare 3 entry-level jobs for a BCom graduate: Junior Accountant, Data Entry Operator and Sales Executive. Context: The student lives in Pune, knows Excel and Tally, and wants a job with good growth in 5 years. Do not give exact salary numbers; say "check current job portals" instead. Format: A table with columns: Job, Daily work, Skills needed, Growth in 5 years. Then one line of advice. -
Press Enter in each tab.
- Fill in this checklist for each tool:
| Check | ChatGPT | Gemini | Claude | Copilot |
|---|---|---|---|---|
| Did it make a table with the 4 columns? | ☐ | ☐ | ☐ | ☐ |
| Did it cover all 3 jobs? | ☐ | ☐ | ☐ | ☐ |
| Did it avoid exact salary numbers? | ☐ | ☐ | ☐ | ☐ |
| Did it end with one line of advice? | ☐ | ☐ | ☐ | ☐ |
What you will usually see: all four follow the 4 parts well. The style changes a little: one adds bold headings, one writes longer cells, one adds web links. Because our prompt was clear, every tool gave a usable answer. That is the real power of prompt engineering: your skill works in any tool, today and in the future.
Ravindra Bagale's Tip
If one tool ignores part of your Format (for example it writes salaries even after you said not to), do not switch tools at once. Reply in the same chat: You added salary numbers. Remove them, as I asked. Learning to correct the AI with a short follow-up is half of prompt engineering.
8. Your copy-paste prompt template
Save this template in your phone notes or a text file. Fill in the 4 parts every time.
Role: You are a [who: teacher / recruiter / support agent / analyst / shopkeeper].
Task: [one clear action: write / explain / summarise / compare / make a table of] [what].
Context:
- Who it is for: [audience]
- Facts to use: [names, dates, numbers]
- Rules: [what to avoid, what must be true]
Format: [length], [shape: bullets / table with columns ... / email with subject], [tone].
Example using the template (a college notice):
Role: You are the student council secretary of a college in Pune.
Task: Write a notice about the annual sports day.
Context:
- Who it is for: all students and teachers
- Facts to use: 14 November, 8 am, college ground, last date to register 7 November, register with the class representative
- Rules: do not add events or prizes that are not given
Format: Under 100 words, a title in capital letters, then 4 bullet points, formal tone.
9. Which part should I fix? (a quick problem table)
When an answer is not good, do not rewrite everything. Find the problem below and fix only that part.
| Problem with the answer | Part to fix | Line to add |
|---|---|---|
| The tone is wrong (too casual, too formal, robotic) | Role | "You are a friendly / formal / senior …" |
| It did something different from what I wanted | Task | Use one clear action word: "summarise", "compare", "rewrite" |
| It is general and does not fit my situation | Context | Add names, dates, numbers and who it is for |
| It invented facts | Context | "Use only the facts below. Do not add anything else." |
| It is too long or too short | Format | "Under 100 words" or "at least 8 bullet points" |
| It is hard to use (one big paragraph) | Format | "A table with columns …" or "numbered steps" |
| The words are too hard | Context + Format | "For a beginner. Very simple English. Short sentences." |
| It added things I said not to add | Context (then a follow-up) | "Do not include X." Then: "You included X. Remove it." |
10. Beginner mistakes and quick fixes
| Mistake | What happens | Fix |
|---|---|---|
| Writing only the Task | A general, empty answer | Add Role, Context and Format |
| Putting too many tasks in one prompt ("write an email, a poster and a speech") | Each part is weak | One prompt, one task. Ask for the next task in a follow-up |
| Giving no numbers or names | The AI invents them, or uses [placeholders] |
Give the exact facts in Context |
| Asking for "better" or "good" | The AI changes things you wanted to keep | Say what "better" means: shorter, more formal, with numbers |
| Trusting totals in a table | Wrong numbers go to your boss | Check sums in Excel with =SUM() and =AVERAGE() |
| Pasting private data | Privacy and job risk | Use [CLIENT], [AMOUNT] placeholders |
| Starting a new chat for every small fix | You lose the earlier details | Fix with a short follow-up in the same chat |
11. Try at home
Try at home
Task 1: build it one part at a time
- Choose a real email you need to write (to a teacher, a manager or a customer).
- Write the Task only and run it. Save the answer.
- Add the Role and run it again in a new chat.
- Add the Context and run it again.
- Add the Format and run it again.
- Write one line about what improved at each step.
Task 2: two voices, one offer
- Pick any small business near your home (a tea stall, a tuition class, a bakery).
- Write one shared Context with a made-up offer.
- Make Version A (warm, for older customers) and Version B (short, for young customers) by changing only Role and Format.
Task 3: check the maths
- Write down your own spending for the last 7 days.
- Ask the AI for a table with the total and the daily average.
- Check both numbers in Excel with
=SUM()and=AVERAGE().
Task 4: fix a weak prompt
- Look at the last 3 prompts you typed into any AI tool.
- Rewrite each one with all 4 parts.
- Run the old and new versions and compare them.
Recap
In short
- Prompt engineering means giving the AI what it needs, so it does not have to guess.
- A strong prompt has 4 parts: Role (who), Task (what), Context (facts, limits, audience) and Format (shape and length).
- Adding the parts one at a time turned an empty delay email into one that is ready to send.
- Ask for tables and totals, but always check the numbers in Excel.
- Same Task and Context with a different Role and Format gives a completely different message.
- Rewrite weak prompts by adding the missing parts, not by adding more words.
- A clear prompt works in ChatGPT, Gemini, Claude and Copilot.
- When an answer is weak, find the problem in the fix table and change only that part.
Save the template from section 8 on your phone today. Use it for your next 5 prompts, and you will see the difference yourself.
Previous chapter: What Is Generative AI and How Does ChatGPT Work? (Simple Explanation with Examples)
Next chapter: ChatGPT vs Gemini vs Claude vs Copilot: Which Free AI Tool Should You Use?
Ravindra Bagale, trainer: linkedin.com/in/ravindra-bagale. The people, shops, clients, order details, phone numbers and amounts on this page are made up for learning. Company names such as Swiggy and Infosys are used only to make the situations real; nothing here describes how those companies actually work. AI answers change every time, so your output will be similar, not the same.