Prompt engineering
Prompt engineering is the practice of writing, structuring and testing the instructions and examples given to a language model so that it produces the output an application needs, without changing the model's weights.
Also called: prompting
By Divya Sharma · Checked Nov 15, 2026 · How we review
A language model responds to text, so the wording, order and structure of that text change the result. Prompt engineering is the work of finding a prompt that gives reliable answers for a task, then checking it against real inputs.
Common techniques
- Clear, direct instructions that state the task, the audience and the format. - A role and standing rules in the system prompt. - Worked examples, known as few-shot prompting, to show the format and tone you want. - Asking the model to reason step by step, as in chain-of-thought prompting. - Delimiters such as XML tags or headings to separate instructions from data. - Requesting structured output when code will parse the answer.
Why it matters
Prompt changes are cheap and fast compared with fine-tuning. They are usually the first thing to try when a model gives the wrong format, misses a rule or answers too loosely. Because a small wording change can shift results, good practice is to keep a set of test inputs and compare prompt versions against it, as described under LLM evaluation.
How it differs from context engineering
Anthropic describes context engineering as the natural progression of prompt engineering. Prompt engineering focuses on writing the instructions. Context engineering covers everything else that lands in the model's input during a run, such as retrieved documents, tool results and conversation history, and is a bigger concern for agents that work over many turns.
Limits
A prompt cannot add knowledge the model lacks or guarantee behaviour. Prompts tuned for one model often need changes when you switch models.
Related terms
- Few-shot prompting
- Few-shot prompting is giving a language model a handful of worked examples of a task inside the prompt, so it can copy the pattern for a new input without any retraining.
- System prompt
- A system prompt is the block of instructions an application sends to a language model before the user's messages. It sets the model's role, rules, tone and output format for the whole conversation.
- Context engineering
- Context engineering is the practice of choosing and maintaining everything that goes into a language model's context window during a task: instructions, retrieved documents, tool definitions, tool results and conversation history.
- Chain-of-thought
- Chain-of-thought (CoT) is a prompting method in which a language model writes out intermediate reasoning steps before its final answer, which tends to improve results on maths, logic and other multi-step problems.
- LLM evaluation
- LLM evaluation, often called evals, is measuring how well a model or AI application performs a task by running it on a set of test cases and scoring the outputs against defined criteria, by code, by humans or by another model.