# What is prompt engineering, and which techniques still matter with current models?

Writing and testing the instructions, context and examples you give a model so it does a job reliably, and measuring each change instead of guessing.

- Page: https://tecyfy.com/concepts/prompt-engineering
- Subject: How AI works (https://tecyfy.com/concepts)
- Level: beginner
- Also called: Prompt Design, Prompting

Prompt engineering is the work of getting a model to do a job reliably through what you write to it: the instructions, the context, the examples and the shape of the answer you ask for. The name suggests clever phrasing. In practice it is closer to writing a good brief for a new colleague and then checking their work.

## Start with a way to measure

Anthropic's own guide puts 2 things before any prompting: a clear definition of what a good answer is, and a way to test against it. Without them every change is a guess, and a prompt that reads better can quietly do worse on cases you did not look at. Keep a handful of test cases from the start and grow them into an [eval set](https://tecyfy.com/concepts/eval-set). Not every failure is a prompting problem either: a slow or costly answer is often better fixed by choosing another model.

## The techniques that hold up

- **Be clear and direct.** Write as if briefing a capable new employee who knows nothing about your business. Anthropic's test: show the prompt to a colleague; if they would be confused, so will the model.
- **Say why.** "Write order numbers as KX-48213, because the order lookup only finds that form" works better than the rule alone, because the model can apply the reason to cases you did not list.
- **Show examples.** 3 to 5 varied examples of input and ideal output, marked off in tags, are one of the most reliable ways to set format and tone ([few-shot prompting](https://tecyfy.com/concepts/few-shot-learning)).
- **Separate the parts.** Wrap instructions, documents, examples and the user's input in their own tags, so the model never mistakes a customer's email for your instructions.
- **Say what to do, not what not to do.** "Write in plain paragraphs" beats "do not use Markdown".
- **Put long documents first.** With long inputs, documents at the top and the question at the end did better in Anthropic's tests, by up to 30%.
- **Ask for a schema when code reads the answer.** [Structured output](https://tecyfy.com/concepts/structured-output) guarantees the shape, so the prompt can spend its words on content.

## What changed

Some older techniques now matter less. "Think step by step" was a powerful trick before models had [thinking](https://tecyfy.com/concepts/chain-of-thought) built in; current Claude models decide for themselves when to reason, steered by an effort setting. Prefilling the start of a reply is rejected by current Claude models. Tutorials that spend pages on magic phrases describe models you are no longer calling.

The bigger shift is from the wording of one prompt to everything the model sees: documents, tool results, conversation history. That wider job is [context engineering](https://tecyfy.com/concepts/context-engineering), and a prompt in production is code: kept in a file as a [template](https://tecyfy.com/concepts/prompt-template), versioned, and tested on every change.

## Related

- [System Prompt](https://tecyfy.com/concepts/system-prompt): Instructions the builder of an AI app gives the model before you type anything. It sets the role, the tone and the rules, and it outranks what users say.
- [Few-shot Learning](https://tecyfy.com/concepts/few-shot-learning): Putting a few worked examples of the task in the prompt, so the model copies their format, labels and tone without any training.
- [Prompt Template](https://tecyfy.com/concepts/prompt-template): A prompt kept as a file with placeholders filled in at run time, so it can be versioned, reviewed and tested like the rest of your code.
- [Context Engineering](https://tecyfy.com/concepts/context-engineering): Choosing what goes into a model's context at each step of a task, what to fetch only when needed, and what to clear, note down or summarise as the context grows.
- [Chain of Thought](https://tecyfy.com/concepts/chain-of-thought): Having a model write out the steps of its reasoning before it gives an answer. Once a prompting trick, now built into "thinking" models.
- [Structured Output](https://tecyfy.com/concepts/structured-output): A setting that makes a model's answer follow a JSON schema you give it, so your code can read fields such as a category or an order number without parsing free text.
- [Eval Set](https://tecyfy.com/concepts/eval-set): The list of test cases an LLM app is graded on after every change. Each case is an input and what a good answer must do, so a score going up or down shows whether the change helped.

## Sources

- [Prompt engineering overview](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/overview)
- [Prompting best practices](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices)
