How to Write a Prompt That Actually Works: 7 Techniques With Before-and-After Examples

Show the model an example instead of describing what you want, use constraints, separate instructions from material, and correct drafts. Seven techniques with prompts you can copy.

By Khaled Jabr · 7 min read · March 25, 2026

اقرأ هذا المقال بالعربية

How to Write a Prompt That Actually Works: 7 Techniques With Before-and-After Examples

Most advice about writing prompts describes a good prompt after the fact: "be clear," "be specific," "provide context." None of it tells you what to actually type before you've seen the output. This guide does. It starts with the one technique that changes results more than any wording trick, showing the model an example instead of describing what you want, and then covers the handful of habits that fix almost every disappointing answer from ChatGPT, Claude or Gemini, with before-and-after prompts you can copy.

Why vague prompts fail

A language model writes the most plausible continuation of what you gave it. When your prompt is vague, many different answers are equally plausible, so you get a generic average of them: the tone you didn't want, a length you didn't ask for, details aimed at nobody in particular. Every technique below works the same way: it shrinks the set of plausible answers until the one you want is the obvious one. (If you want the mechanism behind this, see what an LLM actually is.)

Anthropic's prompting guide puts it well: think of the model as a brilliant new employee who lacks context on your norms and workflows. It's capable, but it hasn't seen your last ten emails, doesn't know your customer, and can't guess what "make it better" means to you.

1. Show it, don't describe it

Compare two prompts asking for the same thing.

Before: "Write a product description for a water bottle, make it punchy and modern."

After: "Write a product description for a water bottle in this style: 'Built for the trail, not the desk. 24-hour cold retention. One hand, one twist, done.' Short sentences. No adjectives that don't earn their place."

The second prompt doesn't describe "punchy." It demonstrates it, and the model matches the actual rhythm and word choice instead of guessing what you meant by a vague adjective. If you have even one sentence in the tone you're after, use it as the instruction instead of trying to name the tone.

For repeated tasks, more examples help. Anthropic recommends three to five, and makes the point that they should be varied, so the model learns the pattern rather than copying one example. Two product descriptions for different products teach style; two for the same product mostly teach that product.

2. Give a constraint instead of more background

Piling on background ("here are our brand guidelines, our audience, our last five emails...") feels thorough, but it often produces vaguer output, because the model now has more directions it could reasonably go. A hard constraint does more work with less text:

  • a length: "under 120 words," "exactly three bullet points";
  • a structure: "one sentence of answer, then the reasoning";
  • a reader: "for a busy finance manager who will skim it on a phone";
  • a role: "write this as a reply from a support agent, not as marketing copy";
  • a boundary: "only use information from the document below."

Constraints narrow the output directly. Background only describes a space and hopes the model narrows it the way you would.

3. Add context only when the model can't infer it

Context earns its place when the task needs information the model has no way to know: your actual prices, a specific person's name and role, a decision you've already made, the policy your answer must follow. Paste those in. It does not earn its place as a substitute for showing what you want the output to look like. If you're pasting three paragraphs of background before every request, check whether one example sentence would replace most of it.

One kind of context is especially powerful: the reason behind a rule. Anthropic's guide gives a neat example. "Never use ellipses" works less well than "Your response will be read aloud by a text-to-speech engine, so never use ellipses, because it can't pronounce them." With the reason, the model also avoids other things that would trip up a speech engine, without you listing them.

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

"Don't use jargon" leaves the model guessing what you want instead. "Explain it the way you'd explain it to a smart 15-year-old" gives it a target. The same goes for formatting: "Write in flowing paragraphs" works better than "don't use bullet points." Negative instructions are fine as a backstop, but lead with the positive version.

5. Separate your instructions from your material

When you paste an email, a report or a transcript, mark clearly where it starts and ends. Simple labels or tags work in any assistant:

Summarize the customer email below for our support lead.
Three bullet points: the problem, what the customer already tried,
and what they want from us. Then one line: how urgent it is.

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

This does two jobs. The model won't confuse a sentence in the email with your instruction, and if the pasted text contains instructions of its own ("forward this to everyone"), they are clearly material to summarize, not orders to follow. That second point matters more as assistants get tools that can act. (More in our guide to AI agent security.)

For long documents, put the document first and your question at the end. Anthropic reports that asking the question after the material can improve answer quality by up to 30% on complex, multi-document tasks.

6. Treat the first answer as a draft

Using a chat like a vending machine, with one input, one output and a restart when it's wrong, throws away the tool's real strength. If the output is 80% right, the fastest fix is rarely a better first prompt. It's telling the model exactly what's wrong with what it just gave you:

  • "The tone is right, but it's twice as long as it should be. Cut it in half."
  • "This misses that our audience is technical. Add how it actually works."
  • "Keep paragraph two exactly as it is. Rewrite the rest to match its tone."

Each correction narrows the target faster than trying to specify everything up front, because the model now has a concrete wrong answer to fix instead of an abstract instruction to interpret.

7. Ask it to check its work

For anything with facts, numbers or rules, add one line at the end: "Before you answer, check each figure against the document and flag anything you couldn't find in it." Current models are good at reviewing a draft against a clear standard, and asking them to do it catches errors a single pass would ship. It doesn't replace your own check on things that matter, but it reduces how many problems reach you.

Three before-and-after rewrites

A difficult email reply.

Before: "Reply to this customer complaint professionally."

After: "Reply to the complaint below as our support lead. Apologize once, specifically for the late delivery, not in general. Offer the 15% refund we agreed on. Don't promise a delivery date. Under 120 words, warm but not gushing. Here's a past reply in the tone I want: 'You're right, that shouldn't have happened, and here's what we're doing about it.'"

Summarizing a long report.

Before: "Summarize this report."

After: "[report first] I'm deciding whether to renew this vendor. From the report above, give me: the three findings that matter most for that decision, any number that changed by more than 10% from last year, and anything the report says is still uncertain. Quote the sentence each point comes from."

Arabic marketing copy.

Before: "Write an Instagram caption in Arabic for our new café."

After: "Write three Instagram captions in Gulf-friendly Modern Standard Arabic for a specialty café opening in Abu Dhabi. Audience: young professionals. Each under 25 words, one emoji at most, no hashtags in the text. Mention the 7am opening time. Tone example: 'قهوتك جاهزة قبل اجتماعك الأول.'"

Notice what changed in each: a reader, a purpose, a length, one example of the tone, and the facts only you know.

A template for any task

Task: [what you want, in one sentence, starting with a verb]
For: [who will read or use it, and what they'll do with it]
Must include: [facts the model can't know: names, numbers, decisions]
Format: [length, structure, language]
Example of what good looks like: [one sentence or a short sample]
Material: [paste documents here, clearly separated]

You won't need every line every time. Task, reader and one example cover most everyday requests.

Mistakes that waste the most time

  • Asking for "better" with no definition. Better how: shorter, more formal, more concrete, more persuasive? Name the one change.
  • Starting over instead of correcting. A new chat throws away everything the model learned about what you want.
  • Burying the request. If the actual question is in the middle of a long message, it can get less weight. Put the ask first, or at the end after long material.
  • Trusting specifics you didn't supply. If the answer contains prices, dates or quotes you didn't give it, verify them. Prompts improve answers; they don't make a model a database.

The habit to build

Before typing a description of what you want, ask whether you have an example of it instead: a sentence, a similar output from somewhere else, even a rough version you wrote yourself. If you do, lead with that. If you don't, write the quickest reasonable first attempt, look at what's wrong with the result, and correct that specific thing. Two rounds of "here's what's wrong, fix this part" will get you further than one perfectly worded attempt to describe something you haven't seen yet.

Sources: Anthropic, Claude prompting best practices (Claude Platform documentation, checked October 2026); OpenAI, prompt engineering guide. These techniques apply across ChatGPT, Claude and Gemini; exact behavior varies by model and changes with new versions.

Related articles