TL;DR: Prompt engineering is the practice of designing what you send to a model - instructions, examples, context, and output format - so it produces what you actually need, reliably. It matters because the same model can perform very differently depending on how a task is framed, and because in an application the prompt is code: versioned, tested, and maintained.
How it works
A model does whatever the text in its context makes most probable, so the leverage is in the text. The techniques that consistently move quality are mundane and durable. Be specific: "Summarize this ticket in three bullets for an engineer who has not read it" beats "summarize this". Show, do not just tell: including two or three worked examples of input and desired output - called few-shot prompting - is often the single biggest win, because the model imitates the pattern. Give the model room to think: asking it to reason step by step before answering improves accuracy on anything with intermediate logic. And constrain the output: state the exact format you want, or use structured output features to enforce a schema mechanically.
Structure matters as much as wording. Production prompts typically layer a system prompt (role, rules, tone), task instructions, supporting context or retrieved documents, examples, and finally the user's input - clearly delimited so the model can tell instructions apart from data. That separation is also a safety boundary: it is the first defense against prompt injection, where hostile text inside the data tries to be read as instructions.
The part beginners skip is that prompt engineering is empirical. A wording change that reads as trivial can shift behavior noticeably, and an improvement for one input can regress another. Serious teams treat prompts like code: kept in version control, changed deliberately, and run against a suite of test cases via prompt testing before shipping. "It worked on the three inputs I tried" is the prompt-engineering equivalent of deploying untested code.
As models have improved, elaborate incantations have aged out; clarity, examples, and good context selection have not. The skill is converging with plain technical writing plus measurement - deciding what the model needs to see, and verifying it worked.
Where it sits in the AI stack
Prompt engineering is the design step between a task and the model call, closed into a loop by evaluation:
Key tools and implementations
-
Few-shot prompting
Including worked examples in the prompt so the model imitates the demonstrated pattern.
-
Chain-of-thought prompting
Asking the model to reason step by step before answering, improving multi-step accuracy.
-
Prompt playgrounds
Provider consoles for iterating on a prompt against real model output before writing code.
-
Prompt management platforms
Tools that version prompts, run them against test suites, and track quality over time.
Related entries
- System prompt Hidden instructions sent before user messages that set a model's role, rules, and tone for the conversation.
- Temperature A setting that controls how random a model's word choices are, from deterministic to creative.
- Prompt testing Running prompt changes against a fixed set of test cases so an edit cannot silently degrade quality.
- Context management Keeping an AI agent's working context relevant and small through compaction, memory files, and delegating work to subagents.