Definition
A prompt is the input you give an AI model to get a response. Prompt engineering is the skill of writing and testing prompts so the model gives reliable, useful results.
In simple words
Think of asking a new intern to do a task. "Write something about sales" gets you a mess. "Write a 5-line summary of this month's sales for the CEO, with the top risk first" gets you what you wanted. Models work the same way, because they can't read your mind.
Why it matters
It's the cheapest way to get more out of AI, and needs no coding. The same model can give a useless answer or an excellent one depending on the prompt. For developers, the prompt is part of the product, and needs testing like any other part of the software.
How it works
| Part | What it does | Example |
|---|---|---|
| Task | Says what to do | Summarise this report |
| Context | Gives background | It's for our CEO, who has 2 minutes |
| Input | The material to work on | The report text |
| Format | The shape of the answer | 5 bullets, top risk first |
| Examples | Shows what good looks like | One sample input and output |
Main techniques
- Zero-shot: just ask, with no examples.
- Few-shot: give two or three examples of what you want.
- Ask for reasoning steps on maths or logic problems.
- Give a role: "You are a careful reviewer".
- Tell it what to do if unsure: "If the document doesn't say, reply NOT FOUND".
| Weak prompt | Better prompt |
|---|---|
| Tell me about diabetes. | Explain type 2 diabetes to a 60-year-old with no medical background, in 5 short points in simple Hindi. Add a line saying a doctor should be consulted. |
Try it yourself
Build a better prompt
Start with a plain request. Add parts one by one, and watch the reply change.
Vague or clear?
Would each prompt get you what you actually want? Remember, the model can't read your mind.
Write a 5-line summary of this month's sales for the CEO, with the top risk first.
Tell me about diabetes.
Explain type 2 diabetes to a 60-year-old in 5 short points, in simple Hindi.
Write something about sales.
Using only this report, list three dates. If a date isn't there, reply NOT FOUND.
Make this better.
The parts of a good prompt
Match each piece of a prompt to the part it plays.
- "Summarise this report."
- "It's for our CEO, who has 2 minutes."
- "5 bullets, top risk first."
- "Here is one sample input and output."
Common mistakes
- Being vague and blaming the model.
- Never testing the prompt on tricky inputs before relying on it.
- Putting secrets into prompts for public tools.
Check yourself
Summary
- A prompt is the input, and prompt engineering is writing it well and testing it.
- Say the task, context, input and format, and give examples.
- Tell the model what to do if it's unsure.
Finished reading?