# What is prompt engineering?

> Prompt engineering is writing and testing prompts so that a model gives the output a task needs, with methods such as clear instructions and examples.

Canonical: https://promptlyfound.com/glossary/prompt-engineering
Updated: 2026-12-01

## Short answer

Prompt engineering is **writing and testing prompts so that a model gives the output a task needs**. Common methods include clear instructions, examples, a system prompt and structure such as XML tags. OpenAI and Anthropic both tie it to tests that measure the output. The best methods change with the model, and reasoning models need less step-by-step instruction.

## Key findings

- OpenAI defines prompt engineering as writing effective instructions so that a model consistently generates content that meets the requirements. It recommends pinning applications to model snapshots and building evaluation suites, because snapshots in the same family can give different results. [1]
- Anthropic says prompt engineering starts after three things exist: clear success criteria, a way to test against them, and a first draft prompt. Some problems, such as latency and cost, are easier to fix by choosing a different model. [2]
- A 540 billion parameter model prompted with eight chain-of-thought examples reached state-of-the-art accuracy on the GSM8K math benchmark, ahead of a fine-tuned GPT-3 with a verifier. [4]
- OpenAI says reasoning models perform best with straightforward prompts, and that telling them to think step by step may not improve performance and can sometimes hinder it. [5]

Prompt engineering is how developers get dependable output from a language model. In AI search, the same discipline applies to visibility tests, which need a fixed and carefully written set of prompts.

## How does prompt engineering work?

Prompt engineering changes the input until the output meets a defined need. [OpenAI's prompt engineering guide](https://developers.openai.com/api/docs/guides/prompt-engineering) calls it the process of writing effective instructions for a model, so that it consistently generates content that meets the requirements. Because model output is non-deterministic, OpenAI calls prompting a mix of art and science.[1]

[Google's machine learning glossary](https://developers.google.com/machine-learning/glossary) says the results depend on factors outside the prompt too. These include the data used to train the model and its [temperature](https://promptlyfound.com/glossary/temperature) and other decoding settings. Google treats prompt design as a synonym.[3]

## Why does prompt engineering need tests?

A prompt that works once may not work again, and it may not work on the next model version. OpenAI recommends pinning production applications to a specific model snapshot. It also recommends evaluation suites that measure prompt behavior when the prompt or the model changes.[1]

[Anthropic's prompt engineering overview](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/overview) asks for three things first: a clear definition of success, a way to test against it, and a first draft prompt. It also says not every failing test is best solved with a better prompt. Latency and cost can be easier to improve by choosing a different model.[2]

## Which prompt engineering techniques work?

Anthropic lists clarity and examples, XML structure, role prompting, thinking and prompt chaining.[2] Examples appear in the guidance of OpenAI, Anthropic and Google, and [What is few-shot prompting?](https://promptlyfound.com/glossary/few-shot-prompting) covers them.

Asking for steps of reasoning is another technique. [Chain-of-Thought Prompting Elicits Reasoning in Large Language Models](https://arxiv.org/abs/2201.11903), a 2022 paper, gave a model worked examples with intermediate steps. A 540 billion parameter model prompted with eight such examples reached state-of-the-art accuracy on the GSM8K math benchmark.[4]

## How do reasoning models change prompt engineering?

Reasoning models need simpler prompts. [OpenAI's reasoning best practices](https://developers.openai.com/api/docs/guides/reasoning-best-practices) say these models perform best with straightforward prompts. Because they reason internally, an instruction to "think step by step" may not improve performance and can sometimes hinder it. OpenAI suggests trying prompts without examples first.[5] [How to test AI search visibility with prompts](https://promptlyfound.com/measurement/ai-visibility-prompts) applies the same discipline to measuring AI answers.

## Sources

1. Prompt engineering. OpenAI API documentation. https://developers.openai.com/api/docs/guides/prompt-engineering
2. Prompt engineering overview. Claude API documentation. https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/overview
3. Machine Learning Glossary. Google for Developers. https://developers.google.com/machine-learning/glossary
4. Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. arXiv, 2022-01-28. https://arxiv.org/abs/2201.11903
5. Reasoning best practices. OpenAI API documentation. https://developers.openai.com/api/docs/guides/reasoning-best-practices

---

This is a plain-text copy of https://promptlyfound.com/glossary/prompt-engineering from Promptly Found. The web page is the canonical version and includes the charts.
