What is prompt engineering?

Improve prompts and agents
HoneyHive Engineering

Prompt engineering is writing and testing the instructions a model receives. What OpenAI, Anthropic and Google advise, and how it differs from context engineering.

Prompt engineering is the practice of writing, structuring and refining the instructions a language model receives so that it returns the output you want. OpenAI calls it “the process of writing effective instructions for a model”, aimed at consistent output that meets your requirements. Anthropic describes it as “methods for writing and organizing LLM instructions for optimal outcomes”. The model stays the same; only its input changes.

What the providers say it involves

The three major providers describe the same core moves under different names.

Move Anthropic OpenAI Google (Gemini)
Be specific “Be clear and direct” “writing effective instructions” “clear and specific instructions”
Set the format Be specific about output format and constraints Markdown and XML structuring Response format and constraints
Show examples Use examples effectively Few-shot examples “always include few-shot examples”
Add context Add context to improve performance Retrieved context in the prompt Background material in the prompt
Structure the prompt A role in the system prompt; XML tags split instructions, context and input Developer messages rank ahead of user messages Prefixes start the output for the model

Three notes from the docs:

Examples get their own page: see few-shot prompting.

Where prompt engineering stops

Writing a prompt is not the first step. Anthropic’s guide assumes you already have clear success criteria, a way to test against them, and a first draft. It also says that not every failing eval is best solved by prompt engineering. Choosing a different model can sometimes improve latency and cost more easily.

Prompt engineering also differs from context engineering. Anthropic describes the latter as the “natural progression” of the former. Prompt engineering centers on how to write effective prompts, particularly system prompts. Context engineering manages the whole set of tokens the model sees, including tools, external data and message history (guide). Anthropic says that curation is iterative and happens each time you decide what to send to the model. For agents that loop over tools, see agentic workflows.

How to work on a prompt

  1. Define what a good output looks like, in a form you can check.
  2. Write a first draft with clear instructions, the output format and the context the model lacks.
  3. Run it on a fixed set of test inputs and grade the outputs. See LLM evaluation.
  4. Change one thing at a time (wording, order, examples) and compare scores.
  5. Keep what wins and ship it. OpenAI advises pinning production applications to specific model snapshots and building tests and evaluation suites so you can monitor performance as you iterate.

Anthropic also notes that chaining prompts into steps is useful when you need to inspect intermediate outputs.

Iterating on prompts in HoneyHive

HoneyHive’s Playground lets you create and iterate on prompts without writing code: test them against sample inputs, compare models and save working versions. In Studio, under Prompts, you can deploy a prompt to an environment such as dev, staging or prod, and fetch it in your application via the SDK or a YAML export. To check a change against a dataset before it ships, run an experiment.

Related: chain-of-thought prompting, LLM temperature.

FAQ

Is prompt engineering the same as context engineering?

Not quite. Anthropic calls context engineering "the natural progression of prompt engineering". Prompt engineering is about writing instructions. Context engineering covers everything the model sees, including tools, external data and message history.

Does prompt engineering change the model?

No. It changes only the input. Fine-tuning changes the model. Anthropic notes that not every failing eval is best solved by prompt engineering, and that a different model can sometimes improve latency and cost more easily.

What do I need before I start prompt engineering?

Anthropic's guide assumes clear success criteria, a way to test against them, and a first draft prompt.

Share