Prompting basics
How do I give context and show the format I want?
Add the context behind your request and show a concrete example of the output you want. Both steer the answer far more reliably than piling on adjectives.
Two moves do most of the heavy lifting once your request is specific: give the model context, and show it the format you want.
Say why, not just what
Explaining the reason behind an instruction helps the model understand your goal and respond accordingly. Anthropic gives a clean example. Instead of “NEVER use ellipses,” say “Your response will be read aloud by a text-to-speech engine, so never use ellipses since the engine will not know how to pronounce them.” The model is smart enough to generalize from the explanation.[1] The “why” lets it handle the cases you did not list.
Show the output you want
The most reliable way to control format, tone, and structure is to show an example. Anthropic calls these few-shot or multishot examples and notes that a few well-crafted ones dramatically improve accuracy and consistency.[1] OpenAI’s guide says the same: include a handful of input/output examples, covering a diverse range of inputs with the desired outputs.[2] If you want three bullet points, write out a sample of three bullet points. If you want JSON, show the JSON.
It also helps to separate the parts of a longer prompt so the model does not confuse your instructions with your examples or your data. Anthropic recommends wrapping content in tags such as <example> and <instructions>; OpenAI suggests structure with headers or delimiters and an order like identity, instructions, examples, then context.[1, 2]
Official prompting guides
- Anthropic prompting best practices ↗
Be clear and direct, add context, use examples, and structure prompts with tags.
- OpenAI prompt engineering ↗
Precise instructions, few-shot examples, output format, and prompt structure.
References
- Prompting best practices — Anthropic
- Prompt engineering — OpenAI