The full answer
Prompt engineering is the practice of designing and testing the input to a language model (instructions, context, examples and output format) so that it reliably produces the output you need. It matters because the same model can give an excellent or a useless answer depending on the prompt, and in an application the prompt is the main lever you control without retraining anything.
What a prompt contains
- Instructions: the task, constraints and audience, often in a system message that applies to the whole conversation.
- Context: documents, database rows or search results the answer should use.
- Examples: sample inputs with ideal outputs.
- Output format: plain text, Markdown, or JSON matching a schema.
- The input itself: the user's question or the record to process.
Why it matters
- Quality: clear instructions and good context turn vague or generic answers into specific, correct ones.
- Reliability: applications need the same format and behaviour every time; a tested prompt (with structured outputs where a program reads the result) provides that.
- Accuracy: grounding the model in supplied sources and allowing it to say "I don't know" reduces invented answers.
- Cost and speed: shorter, focused prompts use fewer tokens, and a well-prompted smaller model can sometimes replace a larger one.
- Safety: prompts set boundaries on what the model will do, though they are not a security control on their own: prompt injection, where text in the input tries to override instructions, needs defences in the application too.
- No training needed: changes take minutes and need no data science infrastructure.
How the practice has changed Early prompt engineering relied on tricks and magic phrases. Modern models follow plain instructions well, so the work has shifted to:
- writing clear specifications;
- choosing what context to include (often called context engineering, especially for agents that gather information over many steps);
- building evaluations that show whether a change helped;
- adapting to reasoning models, which need less hand-holding about how to think.
A simple example "Write about our product" gives generic marketing copy. "Write a 100-word description of our open-source data quality library for data engineers evaluating it on GitHub. Mention that it runs inside Spark jobs and lists failed rows. No marketing superlatives." gives something usable on the first try.
The skill underneath is the same as writing a good brief for a person: know what you want, give the context needed, and check the result.
Last updated 16 October 2026
Sources