What is prompt engineering?
Short answer
Prompt engineering is designing and refining the text you give an AI model so it returns accurate, relevant, well-formatted results. It relies on clear instructions, context, examples, and iteration rather than a single magic phrase.
Why prompts matter
A model responds to what you ask and how you ask it. Vague prompts get vague answers; specific prompts with context and constraints get focused ones. Prompt engineering is the skill of shaping that input. See how to write a better prompt.
Core techniques
- Be specific — state the task, audience, format, and length
- Give context — paste the relevant facts instead of assuming the model knows
- Show examples — one or two samples of the output you want (few-shot)
- Set a role — 'You are a copy editor' focuses tone and behavior
- Ask for structure — request steps, JSON, or a table when you need it
- Iterate — refine the prompt based on what the reply gets wrong
Watch for prompt injection
When a prompt includes untrusted text (a web page, a user message), that text can try to override your instructions. Designing prompts that resist this is part of the craft. See what is prompt injection.