A prompt is the message you give an AI model such as ChatGPT or Claude: a question, an instruction or a task. "Write a friendly reply to this customer who complains about a late delivery" is a prompt. Anthropic compares the model to a brilliant new employee who does not know your business yet. The more precisely the prompt explains what you want, the better the answer.
Where does the term come from?
Prompting became the main way to use language models from 2019: instead of training a model for each task, you type a question and the model predicts the answer, as Jurafsky and Martin describe it. OpenAI's GPT-3 (2020) handled tasks "specified purely via text interaction with the model", sometimes with a few worked examples in the prompt (few-shot prompting).
What goes into a prompt?
In a chat app the prompt is what you type, together with the earlier messages of the conversation. In software built on a model's API it usually has more parts:
- A system prompt with standing instructions from the developer, such as a role, a tone and house rules. Anthropic's API takes it as a separate
systemfield; OpenAI calls these developer messages and gives them priority over user messages. - The user's message, with the actual question or task.
- Context the model needs, such as documents or customer data. OpenAI describes this as the way to give a model data outside the data it was trained on; fetching that context automatically is RAG.
- Examples of good answers.
How does the model read a prompt?
The model receives all parts as one sequence of tokens. A chat template puts the messages one after the other, with control tokens that mark who is speaking (Hugging Face). The large language model then writes its answer one token at a time, based on that whole sequence. Everything has to fit in the context window. Through the API you also pay per token, for the prompt as well as for the answer, as Anthropic's price list shows (September 2026). A long system prompt sent with every request adds to the bill each time; prompt caching makes repeated parts cheaper.
How do you write a good prompt?
The guides of Anthropic and OpenAI give much the same advice (see prompt engineering):
- Be clear about the result and its format. Anthropic's test: show the prompt to a colleague who knows nothing about the task. If they would be confused, the model will be too.
- Explain why. "Never use ellipses" works less well than saying that a speech engine will read the text aloud and cannot pronounce them.
- Give examples. Anthropic recommends three to five.
- Keep instructions, context and examples apart, for instance with XML tags or Markdown headings.
- Test on real cases. The output varies from run to run, and OpenAI notes that different models, and even different snapshots of one model, can respond differently to the same prompt.
Where does it go wrong?
Text inside a prompt can carry instructions of its own. A web page or email that the model reads may contain commands that change its behaviour, even invisible ones. This is prompt injection, number one on the OWASP list of risks for LLM applications (2025). OWASP advises marking outside content as untrusted and giving the model no more access than it needs.
Example
Suppose a webshop that sells garden tools uses a model to draft replies to complaints. "Answer this email" gives the model nothing to go on. A better prompt sets out the role, the rules, the format and the input, each in its own place:
1 You draft replies to customer emails for a webshop that sells garden tools. 2 Our policy: free returns within 30 days; a late delivery gets a 5 euro voucher. 3 Write a friendly reply to the email below, in at most 120 words. 4 Offer the voucher if the delivery was late. Do not promise a delivery date. 5 6 <email> 7 {customer email} 8 </email>
Someone still reads the draft before it goes out.
Sources
- Anthropic: Prompting best practices (Claude Platform Docs)Web
- OpenAI: Prompt engineering (API guide)Web
- Jurafsky and Martin: Speech and Language Processing, 3rd edition draft (August 2026)Web
- Brown et al. (OpenAI): Language Models are Few-Shot Learners (GPT-3, 2020)arXiv
- Hugging Face: Chat templates (Transformers documentation)Web
- OWASP Gen AI Security Project: LLM01:2025 Prompt InjectionWeb
