Skip to content
MintFlow Articles

Prompt engineering: how to write better AI prompts, with before-and-after examples

The techniques OpenAI, Anthropic and Google recommend for ChatGPT, Claude and Gemini in 2026, the old tricks that no longer help, and short prompts rewritten to work better

On this page
  1. What is prompt engineering?
  2. What goes into a good prompt?
  3. 9 prompt engineering techniques that work
  4. 1. Be specific about what you want
  5. 2. Explain why
  6. 3. Give it the material it needs
  7. 4. Show an example of a good answer
  8. 5. Separate the parts of your prompt
  9. 6. Put long material first and your question last
  10. 7. Say what to do, not only what to avoid
  11. 8. Break big jobs into steps
  12. 9. Test, then rewrite
  13. A full prompt, before and after
  14. Old prompting tricks that no longer help
  15. "Think step by step"
  16. Over-prompting
  17. Tweaking temperature
  18. Elaborate personas
  19. How do ChatGPT, Claude and Gemini prompts differ?
  20. Save the prompts you reuse
  21. Prompt engineering for developers
  22. Frequently asked questions

Prompt engineering is the skill of writing instructions an AI model can't misread. The short version: say exactly what you want and who it's for, explain why, give the model the material it needs, show an example of a good answer, and with long documents put the material first and your question last. OpenAI, Anthropic and Google each publish their own prompting guides, and on most of those basics they agree.

What has changed is everything around the basics. Reasoning models such as GPT-6.2, Claude Opus 5.5 and Gemini 4 think before they answer, so "think step by step" is mostly redundant, and several old tricks, from blanket rules written for older models to tweaking temperature, now do nothing or backfire. Below are nine techniques, most with short before-and-after prompts, then what to stop doing, how the three model families differ and where to save prompts you reuse.

What is prompt engineering?

OpenAI's guide describes it as writing instructions that consistently get you output that does what you need. Google's guide calls it iterative and presents its own advice as a starting point, not a rulebook. A prompt is everything the model gets for one request: your message, any files and examples, and in apps and APIs, the system prompt that sets its behavior before you type.

Wording matters because a model writes its answer by predicting it from the text in front of it, as our guide to how large language models work explains. The clearer the text, the less it has to guess.

Anthropic now treats prompting as one piece of a bigger job it calls context engineering: choosing everything that goes into the model's limited working space. Its prompting article sums up the shift for newer models as "less scaffolding, more curation." Its docs add a caution: not every problem is a prompting problem, and for speed or cost a different model is sometimes the easier fix.

What goes into a good prompt?

Google's Gemini help pages split a prompt into four parts: persona, task, context and format. OpenAI suggests a similar outline for the developer message apps send ahead of a conversation: identity, instructions, examples, then context. Together they make a checklist.

Part What it answers Example
Role Who should the model be? "You're an editor at a personal finance magazine."
Task What should it do? Start with a verb. "Rewrite this paragraph for beginners."
Context What does it need to know, and why? The audience, the purpose, the source material
Format What shape should the answer take? "Three bullet points, each under 20 words."
Examples What does a good answer look like? One to five samples of the output you want

Google says you don't need every part every time. A quick factual question needs only the task. The more the answer matters, the more of the checklist you fill in.

9 prompt engineering techniques that work

1. Be specific about what you want

Anthropic suggests treating the model like a brilliant new employee who doesn't know your norms. Its test: show the prompt to a colleague who knows little about the task, and if they'd be confused, the model will be too.

Vague words are the usual culprit. OpenAI's help center contrasts "fairly short" with "a 3 to 5 sentence paragraph"; only the second gives the model a target. Newer models also take you more literally, and Anthropic says that if you want more than the bare task, you should ask for it.

Before:

Write a product description for our water bottle.

After:

Write a product description for our 750 ml insulated steel water bottle, for an online store. The readers are commuters and gym-goers. Use one paragraph of 3 to 5 sentences, mention that it keeps drinks cold for 24 hours, and end with one line on how to clean it.

2. Explain why

Anthropic says Claude generalizes from the reason behind an instruction. Its own example swaps a flat ban on ellipses for the reason: the reply will be read aloud by a text-to-speech engine that can't pronounce them. With the reason, the model can apply the same logic to cases you didn't list.

Before:

Don't use any jargon.

After:

This summary goes to our board, and two members have no technical background. Explain any technical term the first time you use it, or replace it with plain words.

3. Give it the material it needs

A model knows nothing about your situation unless you tell it. In Google's example, Gemini gives generic Wi-Fi advice until it's handed the router's guide to its status lights, then answers from that text. Two habits cut down on made-up answers:

  • Ask for quotes first. With long documents, Anthropic recommends having the model pull out word-for-word quotes before doing the task, so its answer rests on the actual text.
  • Allow "I don't know". Anthropic's docs say explicit permission to admit uncertainty can sharply cut false information, and Google suggests an instruction that limits Gemini to the context provided and has it say when the answer isn't there.

For a knowledge base too big to paste, retrieval-augmented generation (RAG) fetches the relevant passages for you.

Before:

What's our refund policy for damaged items?

After:

Using only the policy document below, answer the customer's question. Quote the sentence your answer is based on. If the document doesn't cover it, say so instead of guessing.

<policy>
[paste the policy here]
</policy>

Question: what happens when an item arrives damaged?

4. Show an example of a good answer

Anthropic calls examples, known as few-shot prompting, one of the most reliable ways to steer format, tone and structure. The providers differ on how many:

  • Anthropic's docs recommend 3 to 5, though its prompting article suggests starting with one.
  • Google recommends always including a few, and warns that too many can make the model copy them too closely.
  • OpenAI says to start with none (zero-shot) and add a few if results fall short.

A sensible middle path: start without, add one when the format or tone is off, and build up to three to five for a job you'll repeat. Vary them so the model doesn't copy incidental details, keep their format identical, as Google advises, and mark them clearly, for instance with <example> tags.

Before:

Write release notes for version 2.3.

After:

Write release notes for version 2.3 from the changelog below, in the same style as this example.

<example>
New: Export any report as a PDF from the Share menu.
Fixed: Search no longer misses results with accented letters.
</example>

<changelog>
[paste the changelog here]
</changelog>

5. Separate the parts of your prompt

When a prompt mixes instructions, background, examples and pasted material, show where each part starts and ends. Anthropic suggests XML tags such as <instructions> and <context>, OpenAI uses Markdown headings for sections and XML tags for documents, and Google says either works if you stick to one style within a prompt.

Short prompts don't need this. Anthropic's docs pitch XML tags at complex prompts that mix several kinds of content, and its prompting article says clear headings and whitespace usually do the job otherwise.

6. Put long material first and your question last

Anthropic recommends placing long documents above your instructions and question, and says a query at the end improved response quality by up to 30% in its tests, especially with several documents. Google gives Gemini users the same advice.

OpenAI's help center has a long-standing rule that points the other way: instructions first, with the text fenced off by ### or triple quotes. For a short prompt either order works. For a long one, follow the two providers that agree, not least because models get less reliable as input grows, as our guide to what a context window is explains. The refund prompt above already has this shape: the policy comes before the question.

7. Say what to do, not only what to avoid

Anthropic recommends asking for flowing prose paragraphs rather than banning Markdown. OpenAI's help center makes the same point with a support bot: rather than a capitalized ban on asking for passwords, tell it to diagnose the problem and point the customer to a help article. A "don't" isn't wrong, and Google lists both kinds of constraint, but it's weaker on its own.

Style is contagious too. Anthropic notes that the formatting in your prompt tends to show up in the reply.

Before:

Don't make it too long and don't use bullet points.

After:

Answer in two short paragraphs of plain prose, under 150 words in total.

8. Break big jobs into steps

Google suggests splitting complex tasks into a chain where each answer feeds the next. Anthropic's most common chain is self-correction: draft, review against your criteria, refine, which its prompting article says trades some speed for accuracy. Newer models handle most multistep reasoning internally, Anthropic adds, so chaining matters most when you want to check the work in between. In a chat app, that's three messages:

1. Summarize the payment terms in the attached contract in five bullet points.
2. Now check that summary against the contract and list anything it got wrong or left out.
3. Rewrite the summary with those fixes.

9. Test, then rewrite

OpenAI's ChatGPT help page suggests a loop: try, read the result, then adjust the wording, add context or simplify. Google lists three things to try when a prompt isn't working: rephrase it, recast the task as a similar one (turning an open question into multiple choice, for example), and reorder the examples, context and input.

For a prompt you'll reuse, write down what a good answer looks like first. Anthropic's docs assume clear success criteria and a way to test against them, and OpenAI recommends evaluations you rerun whenever the prompt or model changes.

A full prompt, before and after

Here's how the techniques combine on an everyday task.

Before:

Write an email about the office move.

After:

You're the office manager at a 40-person design studio.

Write an email to all staff announcing that we're moving to 12 Harbor Street on Monday 11 January. People are already worried about their commute, so lead with the practical details and keep the tone calm and friendly.

Include:
- the new address and the date
- that the last day in the current office is Friday 8 January
- that IT will pack and move desktop computers, but everyone packs their own desk

Keep it under 200 words, with a clear subject line. If anything important seems to be missing, list your questions after the email instead of inventing details.

The first line sets a role. The second paragraph gives the task with a verb and the reason behind the tone. The list is context the model can't know, and the last paragraph sets the format, the length and permission to flag gaps instead of making things up.

Old prompting tricks that no longer help

"Think step by step"

OpenAI's reasoning guide says asking reasoning models to think step by step is unnecessary and can sometimes hurt, and Google says its Gemini 2.5 and 3 models don't generally need to lay out their reasoning in the answer. Anthropic goes further for Claude Opus 5.5: drop instructions to write out reasoning, because prompts that push it to reproduce its internal reasoning may be declined. In a chat product, Anthropic found that removing a "think carefully" line made replies start sooner with no clear drop in quality.

There are exceptions. Google says asking Gemini to think very hard can help on heavy reasoning problems, at the cost of extra thinking tokens, and Anthropic's prompting article says step-by-step prompting still helps where built-in thinking isn't available.

Over-prompting

Prompts written for older models often lean on blanket rules and emphatic wording. Anthropic says its newer models are more proactive, so lines such as "If in doubt, use [tool]" now make them overdo it, and its own example of a weak instruction is a bare "NEVER" rule in capitals. OpenAI says GPT-6.2 Astra is more concise by default, so an inherited "be concise" deserves a second look. Anthropic also lists over-engineering as a common mistake: longer isn't automatically better.

Tweaking temperature

Temperature was the dial for how random a model's output was. OpenAI's Using GPT-6.2 guide tells developers to remove temperature and top_p, which GPT-6.2 doesn't support. Google says Gemini 4 and Gemini 3.6 and later ignore custom temperature, top_p and top_k values and will reject them in a future release.

Reasoning effort has taken its place. OpenAI suggests starting GPT-6.2 at medium, Claude Opus 5.5 defaults to medium effort, and Gemini 4 models take a thinking level. OpenAI still calls effort "a tuning knob, not the primary way to recover quality." The prompt remains the main lever.

Elaborate personas

Anthropic's docs say even one sentence of role helps, but its prompting article warns against over-constraining roles and suggests stating the perspective you want directly. In our view, "Write for small-business owners who have never run an ad" does more than "You're the world's best marketer with 30 years of experience."

How do ChatGPT, Claude and Gemini prompts differ?

A well-written prompt works in all three. The differences are in defaults and structure.

GPT-6.2 Claude Gemini
Default style Astra is more concise and direct than earlier models Concise and conversational, though Opus 5 runs longer Direct and efficient; ask if you want detail
Structure Markdown sections, XML tags for documents XML tags XML or Markdown, one style per prompt
Examples Start zero-shot, then add a few 3 to 5 in the docs Always a few, not too many
Long documents Reused material before the changing input Documents first, question last Context first, question last
Thinking control Reasoning effort, start at medium Effort, medium by default on Opus 5.5 Thinking level

A few quirks worth knowing:

  • GPT-6.2 Astra may suggest a next step and wait when your intent is unclear. OpenAI suggests telling it to make reasonable, reversible assumptions, state them and carry on.
  • Claude takes requests literally. Anthropic's example: if you want a full-featured analytics dashboard, say so, rather than just asking for a dashboard.
  • Gemini 3 Flash: for time-sensitive questions, Google's guide suggests telling it the current year, so its search queries use it, and its knowledge cutoff, which the guide's sample line gives as January 2025.

Save the prompts you reuse

If you type the same background into every chat, save it once. These menus were current on 29 November 2026; if yours differ, search the app's settings for "instructions" or check the help pages in the sources.

  1. ChatGPT: on the web or desktop, open Settings > Personalization > Custom Instructions and make sure Enable customization is on; on iOS and Android it's Settings > Customize ChatGPT. OpenAI allows 1,500 characters on Free and Go and 5,000 on Plus, Pro, Business, Enterprise and Edu.
  2. Claude: click your initials at the bottom left, then Settings > Your Claude, and add text under Instructions (in the older layout, Account, then Instructions for Claude). For one topic, project instructions apply only inside that project.
  3. Gemini: Gems are becoming skills, reusable instructions you call up by typing "/" (Google says "@" will replace it soon). For personal accounts, Google says Gems became read-only on 17 November 2026 and convert to skills automatically when they're removed on 17 December 2026. Workspace business accounts follow in March 2027 and education accounts in June 2027.

You can also ask the model to improve a draft. Google's Workspace guide suggests opening a message in the Gemini app with "Make this a power prompt:" followed by your draft, and Anthropic publishes a prompt-generator recipe in its Claude Cookbook. Read the result before using it, since a rewrite can add rules you didn't want.

Prompt engineering for developers

A few more rules from the providers' API docs apply to system prompts:

  • Put the rules in the system or developer message. OpenAI says developer messages outrank user messages, likening them to a function definition and user messages to its arguments.
  • Use structured outputs for JSON, not prefills. All three providers can force replies to match a schema, and Google recommends that over prompt instructions for complex JSON. The old trick of starting the model's reply for it now fails on Claude: Anthropic's docs say prefilling the final assistant turn returns an error from Claude 4.6 onward, even though its November 2025 prompting article still recommends it.
  • Keep stable content first. OpenAI advises putting reusable instructions and examples before the changing input so the shared prefix can be cached, cutting cost and latency; our guide to AI tokens and what they cost explains why that matters. Anthropic and OpenAI both warn that editing earlier messages mid-conversation can invalidate the model's earlier reasoning.
  • Version and test prompts like code. OpenAI recommends keeping production prompts in your application code, with tests, and says its saved-prompts endpoint, v1/prompts, is scheduled to shut down on 30 November 2026.
  • Mark pasted text. Anthropic's Opus 5.5 guide suggests wrapping text a user pasted from elsewhere in tags and telling the model to follow instructions inside it only when the user asks, as one guardrail against prompt injection.

Frequently asked questions

What is prompt engineering in simple terms?

It's writing instructions for an AI model so it gives you the answer you need on the first or second try: being specific, explaining why, supplying the material it needs and showing an example of a good answer.

Is prompt engineering still worth learning in 2026?

Yes, though it looks different. Newer models need less scaffolding, but OpenAI, Anthropic and Google all still publish and update prompting guides, and Anthropic treats prompting as a building block of context engineering.

Do I still need to say "think step by step"?

Usually not. GPT-6.2, Claude Opus 5.5 and Gemini 4 think before answering, and OpenAI says the phrase can sometimes hurt reasoning models. It can still help on models without built-in thinking.

How many examples should I put in a prompt?

Start with none or one and add more if the format or tone is off. Anthropic's docs recommend 3 to 5 for best results, while Google warns that too many can make the model copy them too closely.

Does the same prompt work in ChatGPT, Claude and Gemini?

Mostly. The core techniques are the same in all three providers' guides; the differences are in defaults, such as how concise each model is and whether it prefers XML tags or Markdown.

Should a prompt be long or short?

As long as the task needs and no longer. A quick question needs one line, while a task with a set audience, format and source material needs more. Anthropic lists over-engineering as a common mistake.

Sources

Was this helpful?

Keep reading

Colorful JavaScript code on a dark screen, for choosing the best code editor
AI Coding Tools
AI & Dev Tools

The best code editor in 2026: VS Code, Cursor, Zed, JetBrains and more compared

The best code editors of late 2026 compared: VS Code, Cursor, Zed, JetBrains IDEs, Neovim, Sublime Text, Devin Desktop and Antigravity on price, AI, platforms and fit.

15 min read

A video editing timeline on a dark screen, for picking the best AI video generator
Best AI Tools
AI & Dev Tools

Best AI video generator in 2026: Gemini Omni, Kling, Seedance, Runway and more

The best AI video generators in November 2026, from Google's Gemini Omni to Kling 4.0, Seedance 2.5 and Runway, compared on clip length, audio, price and commercial rights.

16 min read

A hand holding a phone showing the Google search page, for the best AI search engine comparison
Best AI Tools
AI & Dev Tools

The best AI search engine in 2026: Perplexity, Google AI Mode, ChatGPT and five more compared

The best AI search engines of late 2026 compared: Perplexity, Google AI Mode, ChatGPT search, Gemini, Claude, Copilot, Brave and Kagi on price, citation accuracy, ads and privacy.

16 min read