Lessons
1 · Understanding Modern AI
2 · Talking to AI Effectively
3 · AI for Learning
4 · AI for Work and Productivity
5 · AI for Developers
- 17AI Coding Assistants: Modes, Strengths and Your Responsibility
- 18Use AI to Understand Code, Codebases, APIs and Documentation
- 19How to Use AI to Debug Code Safely
- 20Testing, Reviewing and Refactoring AI-Generated Code
- 21Security and Licensing Risks of AI-Generated Code
- 22Vibe Coding vs Responsible AI-Assisted Building
6 · AI for Career Growth
7 · Research, Verification and Responsible AI
8 · Automation and AI Agents
Lesson 6 · Talking to AI Effectively
Prompt Fundamentals: Goal, Context, Constraints and Format
A good prompt is not a magic phrase. It is a clear brief. This article shows how to state your goal, give context, set constraints and choose a format, and why each one changes what the AI produces.
For
Anyone who uses AI assistants and gets generic or off-target answers, and wants a principled way to ask.
Level
Before you start
Read How Language Models Work (article 3). Comfort with the idea that AI output is a draft you must check.
On this page
Key takeaways
- A prompt is a brief. The model fills any gap you leave with a generic guess, so the more of the real situation you state, the more useful the answer.
- Four elements carry most of the value: goal, context, constraints and format. Add how you will judge success when it matters.
- Add information, not length. Extra words that carry no information do not help.
- Role phrases such as "act as an expert" can steer tone but do not add knowledge or guarantee correct reasoning.
- Ask for clarifying questions when the task is ambiguous, and give one main task per request.
Suppose you hire a freelancer and send a one-line message: "Write something about our new product." You will get a reasonable attempt, and it will be wrong in ways you did not anticipate. Wrong length, wrong tone, wrong audience, wrong angle. Nobody is surprised, because you gave the freelancer almost nothing to work with.
AI assistants behave the same way. The quality of the output depends heavily on what you gave it. This article teaches what to give.
What you will learn
#- Why vague prompts produce generic answers.
- The four elements of a clear prompt, and a fifth for when quality matters.
- How to improve a weak prompt step by step.
- What to make of "act as an expert" and other folklore.
- A template you can reuse tomorrow.
The idea in plain words: a prompt is a brief
#When you leave something unstated, the model does not leave it blank. It fills it with the most typical choice. Ask for "an email to my landlord" and you get a typical landlord email: generic opening, no real details, medium formality. That is not laziness. It is the best guess about what you probably want when it knows nothing about you.
So the whole skill can be summarised in one sentence: replace the model's average guesses with your actual information.
Every serious provider says some version of this. OpenAI's prompt guidance emphasises giving clear instructions and relevant context. Google's guidance asks for clear, specific instructions, response formats and constraints. GitHub's advice for Copilot is to start with a broad description of the goal, then list specific requirements. They are all describing the same craft.
The four elements
#Element | The question it answers | Weak | Strong |
|---|---|---|---|
Goal | What do I want, and what is it for? | "Help with my presentation" | "Create an outline for a 10-minute talk that persuades classmates to try spaced repetition" |
Context | What does the model need to know about my situation? | (nothing) | "Audience: 40 second-year students, none know the term. I have five slides. Tone: friendly" |
Constraints | What must it do or avoid? | (nothing) | "Max 120 words per slide. No statistics unless I provide them. British spelling" |
Format | What shape should the answer take? | (whatever it likes) | "A table with slide number, headline, speaker notes" |
And a fifth element for tasks that matter:
Element | The question it answers | Example |
|---|---|---|
Success criteria | How will I judge the answer? | "It is good if a student who has never heard of it can explain it back in one sentence" |
You rarely need all five for a casual question. For anything you will actually use, aim for at least goal, context and format.
A worked example: the landlord message
#Problem. The water heater in your rented flat has not worked for a week. You want to message your landlord.
First attempt.
Write an email to my landlord about the water heater.Example response (illustrative).
Subject: Water Heater IssueDear Landlord,I hope this email finds you well. I am writing to inform you that the waterheater in my apartment is not working. Please let me know when it can berepaired. Thank you for your attention to this matter.Sincerely,[Your Name]What is missing. No dates, no history, no urgency, no request for a specific action, no tone choice, and it says "apartment" when you say "flat". It is also generic enough to be ignored. The assistant did nothing wrong. It had nothing else to go on.
Improved request. Now add the four elements:
Goal: write a message to my landlord asking for the water heater to berepaired this week.Context: I rent a flat in Pune. The heater stopped working 7 days ago. Ireported it by phone on Monday and he said he would send someone, but nobodycame. We have a good relationship and I want to keep it. The rentalagreement has a clause that says repairs under Rs 3,000 are hisresponsibility.Constraints: polite but firm; under 120 words; do not threaten or mentionlegal action; do not invent any dates or amounts beyond what I wrote.Format: a WhatsApp message, plain text, with a one-line ask at the end.Example response (illustrative).
Hi Mr. Kulkarni, the water heater in the flat stopped working 7 days ago. Icalled on Monday and you kindly said someone would come, but no one has yet.Since hot water is a daily need, could you arrange a technician by Friday? Asper our agreement, repairs like this are covered on your side, and I'm happyto share photos or be at home whenever they visit. Thanks for your help.What changed and why. Every addition replaced a guess. The context gave real facts. The constraints set the tone and blocked invented details. The format made the output ready to send. You still need to read it: the name "Mr. Kulkarni" was a placeholder you should have supplied or removed, and you should check that the sentence about the agreement matches your actual clause. Example responses are illustrations. Yours will differ, and none of it is guaranteed to be correct.
Why this works
#A language model continues text in the most plausible way given everything in front of it. A short prompt matches thousands of different situations, so the most plausible continuation is a bland average. A detailed prompt matches far fewer situations, so the plausible continuation is much closer to what you actually want. Detail is not ceremony. It narrows the model's search.
This also tells you what not to do. Adding words that carry no information ("please give me a really great, amazing, detailed answer") does not narrow anything. Add information, not length.
The same four elements on a very different task
#The landlord message was a writing task. Here is the same method on an explanation task, where the failure looks different.
Problem. You are preparing for an interview and need to explain how a hash map works.
First attempt.
Explain hash maps.You get a generic textbook paragraph. It may be accurate, and it does not match what you need: it is too long, assumes the wrong level and gives you no way to tell whether you understood it.
Improved request.
Goal: help me explain hash maps clearly in a job interview.Context: I am a final-year student. I know arrays and loops in Java, but I do not knowwhat a hash function is. I have 20 minutes to prepare.Constraints: at most 250 words; one everyday analogy; mention one downside; no code.Format: three short paragraphs (what it is, how a lookup works, one trade-off), thenask me one question to test whether I understood.Example response (illustrative). Three short paragraphs using a library-shelf analogy, a mention that two keys can land in the same slot (a "collision"), and a closing question such as "What happens if two keys land in the same slot?"
What to check. The analogy is a teaching aid, not a technical fact, so ask where it breaks down. The claims about speed, for example "constant time on average", should be checked against your course notes or the documentation of the language you use, since the details depend on the implementation. The closing question is the most valuable part: answer it without looking, then ask for feedback.
The same method for different kinds of task
#The four elements are always present, but one of them usually matters most, depending on the type of task:
Task type | Element that matters most | Typical miss |
|---|---|---|
Explain | Context: your level and purpose | Getting an explanation pitched at nobody in particular |
Summarise | Goal and format: who it is for, how long, what to keep | A summary that keeps the wrong things |
Rewrite | Constraints: what must not change | Meaning, names or numbers drifting during the rewrite |
Generate options | Constraints and criteria: variety, limits, how you will choose | Ten versions of the same idea |
Compare or analyse | Context: the actual data and your criteria | Generic pros and cons that fit any situation |
Plan | Constraints: deadline, hours, skills, budget | A plan that ignores your real limits |
Symptom to missing element
#When an answer disappoints, name the symptom and look for the matching gap before you rewrite everything:
Symptom | Probably missing |
|---|---|
Generic, could apply to anyone | Context about your real situation |
Right topic, wrong length or tone | A constraint |
Right content, awkward shape | A format |
Off target altogether | A clear goal |
Confident but wrong details | Source material, or permission to say "not stated" |
Agrees with everything you say | A request for objections or alternatives |
Fixing the specific gap is usually faster than starting again, and it teaches you which of your prompts tend to have which gap.
Fill in the brief: a template
#You can use this skeleton for most tasks. Delete the lines you do not need.
Goal: <what I want and what it is for>Context: <who is involved, background, what I have already tried>Constraints: <length, tone, things to include or avoid, what to do if unsure>Format: <table, bullets, steps, email, JSON, etc.>Check: <how I will judge a good answer, or ask it to list assumptions>Material: <paste the text, notes or data it should work from>Role and "act as an expert"
#You will see advice such as "Act as a senior marketing consultant." Does it work? In a limited way. Anthropic's prompt engineering overview, for example, lists role prompting among its techniques, and giving a role can shift tone, vocabulary and focus. "Explain this as a patient teacher speaking to a 12-year-old" changes the register in a useful way.
What a role does not do is add knowledge or make reasoning more reliable. "Act as a doctor" does not give the model medical training or make its answer safe. A better habit is to describe the audience and the criteria:
Instead of | Try |
|---|---|
"Act as an expert data scientist" | "Explain to a first-year analyst who knows basic statistics but not machine learning. Use one concrete example" |
"You are a world-class copywriter" | "Write three subject lines under 50 characters for a small bakery newsletter. Warm, not salesy" |
A role is a style instruction. Treat it that way.
Let it ask you questions
#When the task is ambiguous, you can avoid a bad first answer by inviting questions.
Before you write anything, ask me up to three questions that would most improveyour answer. Then wait for my replies.This is useful when you do not know what information is relevant, which is common in unfamiliar areas. It turns the model into an interviewer for the first turn. Keep the limit ("up to three"), or you may get a long list.
One main task per request
#Prompts that ask for five different things tend to do each one worse, and you cannot easily see which part went wrong. Compare:
- "Summarise this report, list the risks, rewrite the conclusion, and draft an email to the team."
- Four separate requests, each checked before the next.
You can still chain them, and article 9 shows how. The point here is to keep one clear job per request when quality matters.
Folklore you can ignore
#- "Say please / thank you for better results." Politeness is fine for you; do not count on it to change quality.
- "Add 'take a deep breath' or offer a tip." Any effect, if there is one, is likely to be small and specific to one model and one moment. Do not build habits on tricks like these; build them on information.
- "Longer prompts are always better." Relevant detail helps. Padding does not.
- "There is a perfect prompt for every task." There is a prompt that works well enough for your situation, and you improve it by looking at what went wrong.
- "Provider X's prompt tricks work everywhere." Models differ, and so does advice. Check the documentation for the tool you use.
Common mistakes
#- Starting with the format and forgetting the goal. "Give me bullet points" is not a goal.
- Hiding the real purpose. If the answer is for a hostile audience or a strict deadline, say so.
- Leaving out what to do when unsure. Add "if you do not know, say so" or "ask me".
- Pasting everything you have instead of the relevant part. More text is not more context.
- Accepting the first answer as final. It is a first draft. Article 9 covers refining.
- Forgetting to check. A perfectly formatted answer can still contain invented details, as in the landlord example.
Exercises
#Exercise 1
Diagnose
#What is missing from this prompt? "Give me ideas for my YouTube channel." Name which of the four elements are absent, and what each would add.
Exercise 2: Rewrite
#Rewrite the prompt in Exercise 1 using the template. Invent realistic details for a made-up channel.
Exercise 3: Replace the role
#Rewrite "Act as a world-class career coach and tell me about my resume" so it states the audience and criteria instead of leaning on a role.
Exercise 4: Spot the risk
#You send the landlord prompt from this article, and the response includes "as per our agreement, repairs under Rs 3,000 are covered by you". Which part of the Work Loop applies before you send it, and what exactly do you do?
Show solutionHide solution
All four are missing. Goal: what do you want the ideas for: growing views, a niche, a series? Context: topic, audience, how many videos you have, what has worked or not. Constraints: budget, equipment, time to make each video, anything you will not do. Format: a list? A table with title, hook and effort level?
Without them the model will offer a typical list ("vlogs, tutorials, challenges") that fits any channel and therefore helps none.
Exercise 2
Show solutionHide solution
One possible version:
Goal: suggest 10 video ideas for my channel that could help it grow from 200 to1,000 subscribers over the next 3 months.Context: the channel teaches Excel to people starting office jobs in India. Ihave 12 videos so far; the two that did best were "VLOOKUP in 5 minutes" and"Excel shortcuts for beginners". I film on my phone, alone, and can make onevideo a week.Constraints: each idea must be doable in under 4 hours of work; nointerviews or travel; avoid topics that need paid software.Format: a table with title, the first sentence I would say, and an effortrating (low, medium, high).Check: after the table, tell me which idea you are least sure about and why.The details are invented for practice. Use your own real ones. The prompt works because the model now knows the audience, the evidence of what works, the limits and the shape of the answer.
Exercise 3
Show solutionHide solution
One possible version:
Audience: recruiters for entry-level software roles in India who read a resumefor about 30 seconds.Goal: tell me which three parts of my resume are most likely to be skipped ormisunderstood, and why.Criteria: a good answer points to specific lines in my text, not general advice.Constraint: do not add any experience or skills I did not write.[paste resume]The role was a style shortcut. The new version gives the model something to aim at (the audience and the reading behaviour) and a way to judge success (specific lines).
Exercise 4
Show solutionHide solution
Check. The assistant restated the clause because you wrote it in the context, but you should still compare the sentence with your real agreement. Open the agreement, find the clause and confirm the wording and the Rs 3,000 limit. Also check the facts that you provided: the day you called, the number of days, the landlord's name. If anything differs, edit the message before you send it.
Why it matters: the assistant can silently alter details while rewording. A message that misquotes your agreement is worse than a generic one, because it can damage your position.
Where to go next
#- Next: Give AI the Right Context: Source Material and Long Documents shows how to supply the material the model should work from.
- To practise on your own tasks, start your playbook with the template in this article.
- For a shorter companion guide, see Writing Better AI Prompts: A Practical Guide.
Sources & further reading
Connected lessons
Linked from 4 guides
Other pages in the library that point here.
Keep reading
More in Technology →Guide · Technology
Using AI Tools at Work Without Getting Into Trouble
Guide · Technology
Machine Learning for Beginners: What It Is and How to Start Learning It
Guide · Career
A LinkedIn Profile That Gets Recruiter Messages

