Prompt engineering is the craft of telling an AI model what you want clearly enough that it delivers it consistently. It covers the wording of an instruction, the examples you include, the format you ask for, and the way you test the result.
What a good prompt contains
Most strong prompts share a few parts:
- A role or goal: who the model is acting as, and what finished work looks like.
- Context: the facts the model needs and cannot guess, such as your audience or your constraints.
- The task: one clear request, not five tangled together.
- Format: the shape of the answer, such as a table, three bullets or JSON.
- Examples: a few samples of good output, which is few-shot prompting.
Reusable instructions that sit behind every request belong in a system prompt.
Why it works
A large language model answers based on the text in front of it. Vague input leaves it guessing, and it fills the gaps with the most common answer. Specific input narrows the range of likely answers. Prompt engineering is the work of narrowing that range on purpose.
Testing is the engineering part
A prompt that works once proves little. Engineers run a prompt on many realistic inputs, look at the failures, change one thing, and run it again. Teams that depend on a prompt keep a set of test cases and score outputs against them, which is the idea behind evals. A prompt that works on ten varied cases is worth more than one polished on a single case.
Techniques worth knowing
- Ask for steps on hard problems, as in chain of thought, or use a reasoning model that does it for you.
- Say what to do, not only what to avoid.
- Give the model an out, such as "say you don't know if the source doesn't say," to reduce hallucination.
- Put long reference material in clearly labeled blocks.
How it relates to context engineering
As models handle longer inputs and run as agents, the job has widened from one good prompt to managing everything the model sees across many steps. That wider job is context engineering. Prompt engineering remains the foundation: if you cannot state the task clearly, no amount of tooling will rescue it.
A good test is simple. Hand your prompt to a smart colleague who knows nothing about your project. If they would have questions, so will the model.