The basics of a good prompt are spelling out exactly what you want, giving the context and examples it needs, and specifying the format of the output. The official prompt guides from Anthropic, OpenAI, and Google word it a little differently, but they all recommend these principles. In this post I'll go over four basic principles, with examples you can carry over into marketing work.
Have you ever just said "Write some ad copy" and gotten a pile of sentences that feel like you've seen them somewhere before, so you end up asking again and again? Often it's not that the AI lacks skill, but that it doesn't know your situation and fills in the blanks with guesses. As I studied the official guides while using AI at work, I found that prompting is less like a magic spell and more like knowing how to delegate work well. In this post I'll walk through those basic principles step by step.
1. What is prompt engineering?
OpenAI's prompt engineering guide describes prompt engineering as the process of writing effective instructions so that a model consistently produces results that meet your requirements. It adds that because model output isn't the same every time, it's a mix of art and science. Google's Gemini API prompting guide also says prompt design is an iterative process of refinement, and that the guide is only a starting point.
Anthropic's prompt engineering overview says to take care of one thing first. Before you tweak a prompt, define the criteria for what counts as success, and prepare a way to test against those criteria and a first draft. Without criteria, you can't tell whether the results got better each time you change the prompt.
2. How do you write clear instructions?
Anthropic's prompting best practices recommends thinking of the model as a brilliant new colleague who doesn't know your company's norms or workflows. The more precisely you explain what you want, the better the results. The same document also offers a check: "If a colleague with little context would be confused by this prompt, the model will be too."
Here are the tips the guides recommend in common.
- Be specific about the output format and constraints: State the length, audience, tone, and anything that must be included.
- Number the steps if order matters: When the order of steps or doing every step matters, give instructions as a numbered list.
- Spell out ambiguous terms: In its recommendations for Gemini 3 models, the Gemini API guide suggests explicitly explaining terms or criteria that could be read more than one way.
For example, if you're asking for ad copy, you could change it like this.
(Before) Write ad copy for our new sunscreen.
(After) Write 5 search ad copy variations for a sunscreen aimed at women in their 30s who work office jobs.
- Keep the headlines and descriptions short to fit the ad platform's character limits.
- Emphasize that it goes on lightly and isn't sticky.
- Don't use exaggerated claims (like "best" or "#1").3. Why should you give context and a role?
The Anthropic guide explains that explaining why you want something, rather than just giving the instruction, helps the model understand the purpose better. As in the guide's example, instead of just saying "Don't use ellipses," saying "This response will be read aloud, so don't use ellipses, since the text-to-speech engine can't pronounce them" lets the model generalize the rule from the reason. For the ad copy example above, you'd add a reason like "because of search ad character limits."
Giving a role is another method the official guides all recommend. Anthropic explains that setting a role in the system prompt shapes the model's behavior and tone for that use case, and that even a single sentence makes a difference. In its recommendations for Gemini 3 models, the Gemini API guide also suggests putting the role (persona), key constraints, and output format in the system instructions or at the very beginning of the prompt.
The OpenAI guide describes how developers typically structure the instructions they give a model, in this order.
| Section | What it contains |
|---|---|
| Identity | The assistant's purpose, communication style, and high-level goals |
| Instructions | Rules to follow, what to do and what not to do |
| Examples | Sample inputs and the desired outputs for them |
| Context | Extra information needed for the answer, like data the model wasn't trained on |
OpenAI says context is usually best placed near the end of the prompt, while Anthropic and Gemini recommend putting long documents first and the question at the very end, so the advice on placement varies a bit between documents. I've covered placement for long documents separately in my post on tokens and context windows.
4. How many examples should you include, and how?
Showing a few examples of the result you want is called few-shot prompting. Anthropic calls examples one of the most reliable ways to steer output format, tone, and structure, and recommends including 3 to 5 for best results. It also lists what makes a good example.
- Relevant: They should resemble your actual use case.
- Diverse: They should cover edge cases and vary enough that the model doesn't pick up unintended patterns.
- Clearly separated: Wrap examples in tags or similar so they aren't confused with instructions.
The Gemini API guide goes a step further and recommends always including few-shot examples in prompts, explaining that prompts without examples are likely to be less effective. It adds, however, that too many examples can cause the model to overfit to them, and that inconsistent formatting across examples can produce answers in an unwanted format, so keep the format consistent.
5. How do you specify the output format?
Setting a format makes it easier to move the output straight into a report or spreadsheet. The Gemini API guide explains that you can specify a response format like a table, bulleted list, paragraph, or keywords, and set constraints like summary length at the same time.
Here are the format tips the Anthropic guide recommends.
- Say what to do, not what not to do: Instead of "Don't use markdown," describe what you want, like "Write in smoothly flowing paragraphs."
- Match your prompt's style to the output: The formatting in your prompt can affect the formatting of the answer, so if you want less markdown, use less markdown in your prompt too.
- Split into sections: It explains that separating instructions, context, examples, and input data into sections reduces room for misinterpretation.
The OpenAI guide also recommends marking a prompt's sections and hierarchy with markdown headings and lists, and wrapping content whose start and end need to be clear, like pasted reference material, in XML tags.
Anthropic particularly recommends wrapping the sections themselves in tags like <instructions>.
Whichever you use, it's best to stay consistent within a single prompt.
Putting all of these principles together gives you a template like this.
## Role
You are an assistant helping a performance marketer at an online store.
## Instructions
Summarize last week's campaign performance from the data below for a report to my manager.
The report needs to be readable in 5 minutes, so include only the key points.
## Format
1. One-line summary
2. 2 things that went well, 2 things that fell short (one sentence each)
3. 3 things to try next week
## Data
<data>
(Paste the campaign performance table here)
</data>Summary
A good prompt turned out to be like handing work to a new colleague: you give specific instructions, the reason and the role, examples to refer to, and the shape of the result you want, all together. Since the official guides all emphasize iterative refinement, it's better to set criteria and adjust a little at a time rather than trying to write the perfect prompt in one go. When you hand work to AI, feel free to use the template above as a starting point.
FAQ
- Do I have to include a role in my prompt?
- It's not strictly required, but it's a method the official guides all recommend. Anthropic explains that setting a role in the system prompt shapes behavior and tone for the use case and that even one sentence makes a difference, and in its recommendations for Gemini 3 models, the Gemini API guide suggests putting the role in the system instructions or at the very beginning of the prompt.
- How many examples should I include?
- Anthropic recommends 3 to 5 for best results. The Gemini API guide says too many examples can cause the model to overfit to them, so it's best to include examples that resemble your actual work but differ from each other, in a consistent format.
- Why do I get different results from the same prompt?
- The OpenAI guide explains that what a model generates isn't the same every time. That's why the goal of prompt writing is to define the criteria for the result you want first, then specify examples and output format in detail to make results consistent.
Related posts
- Why Does AI Hallucinate? How to Reduce It, According to Official Guides - Prompt tips for reducing wrong answers
- What Are Tokens and Context Windows? Basics Before Feeding AI Long Documents - What changes when you feed in long documents
- Chatbots, AI Agents, and Automation: What's the Difference? - How to choose the right AI approach for your work
