How to write better AI prompts
Before and after: one prompt, improved
Weak prompt:
Write about photosynthesis.
Better prompt:
I'm revising for a GCSE Biology exam next week.
Explain photosynthesis in under 200 words: where it happens,
the word equation, and the two factors that most often limit its rate.
Then give me three short exam-style questions with answers.
Use plain English and bullet points.The weak prompt leaves the model to guess the reader, the length, the depth and the format, so it produces something generic. The better prompt answers all of those, so the reply fits on the first try.
7 techniques for better AI prompts
1. Know what a good answer looks like
Anthropic's prompt engineering guide starts before the prompt: decide your success criteria and how you'll check the result. If you can't say what "good" means, the model can't aim for it.
2. Be clear and specific
Say who the answer is for, what it's for, and any limits: length, reading level, things to include or avoid. Write as if briefing a capable new colleague who knows nothing about your situation.
3. Give it the material
Paste in the text, data or code the answer depends on, rather than describing it. Marking it off clearly, for example inside labelled sections or tags, helps the model tell your instructions apart from the material.
4. Show examples
One or two examples of the output you want, called few-shot prompting, often work better than a paragraph of description. If you want flashcards in a particular style, show two finished flashcards.
5. Ask for the format you need
Say whether you want a table, bullet points, a short paragraph, an email, or data such as JSON. Try it: this question describes a task and asks which output format suits it best.
Choose the format line that suits where the reply is going.
Press Mark to have your answer marked in the AI Prompt Engineering course.
6. Give it room to think
For maths, logic or planning, ask the model to work through the problem step by step before giving its final answer. Thinking is one of the techniques Anthropic's guide covers. For simple factual or writing tasks it isn't needed and just makes the reply longer.
7. Refine with follow-ups
Treat the first reply as a draft. Point at exactly what to change: "Shorten the second paragraph and add a real-world example" works far better than "make it better". For big tasks, break the job into a chain of smaller prompts, using each answer in the next. Try one: this question shows a reply and asks for the best follow-up.
Pick the follow-up message that will fix the draft.
Press Mark to have your answer marked in the AI Prompt Engineering course.
Roles and system prompts
Giving the model a role, such as "You are a patient maths tutor for 14-year-olds", sets its tone and level for the whole conversation. Apps do this with a system prompt, hidden instructions sent before your messages. Many chat apps let you save custom instructions that work the same way. Our AI Prompt Engineering course has you build one.
Common mistakes
- Being vague. "Help with my essay" leaves too much to guess.
- Burying the request. Put the main instruction where it is easy to find, and keep reference material clearly separate.
- Trusting the answer blindly. AI can state wrong facts confidently. Check anything important against a reliable source.
- Restarting instead of refining. A specific follow-up usually fixes a nearly right answer faster.
- Pasting private information. Don't share passwords, keys or other people's personal data in prompts.
- Very long chats on many topics. Start a new chat when the subject changes; our guide to tokens in AI explains why long chats lose track.
Common questions
What makes a good AI prompt?
Are longer prompts better?
What is few-shot prompting?
Do these tips work for ChatGPT, Claude and Gemini?
What is prompt engineering?
Revision cards
Read the front, say your answer, then flip to check.
Where to go next
- Solve it
Language Model Simulator
See tokens, next word odds and temperature at work
Open the tool - Learn it
AI Prompt Engineering
Prompts, agents and multi-agent workflows for large language models
Start the course