Prompt engineering

Prompt engineering is the practice of writing, testing and refining the instructions and context given to an AI model so it produces the output you need, reliably.

What is prompt engineering?

Also known as: Prompt design, Prompting, System prompt, Prompt management

Prompt engineering is the work of writing clear instructions for an AI model, giving it the right context, and testing and refining those instructions until the results are consistently good. OpenAI’s documentation describes it as the process of writing effective instructions for a model. Because a large language model doesn’t give the same output every time, prompt engineering is as much about reliability as about getting one good answer.

What a prompt includes

A prompt is more than the question someone types. In most AI tools it has several layers:

Layer What it is Who usually writes it
System prompt Standing instructions that set the model’s role, scope, tone and rules for every conversation The team that builds or configures the tool
User message The specific request, such as “Summarize this study for a field team” The person using the tool
Context Documents, data or examples supplied with the request The user, or the tool through retrieval
Examples Sample inputs and outputs that show what “good” looks like Either

Vendors use slightly different names. Anthropic’s documentation refers to the system prompt. OpenAI’s current documentation uses developer messages and an instructions parameter, which take priority over user messages. The idea is the same: standing instructions frame everything that follows.

Core techniques

Official guides from Anthropic and OpenAI recommend broadly similar practices:

  • Be clear and direct. Say exactly what you want, including format and length. Anthropic suggests a simple test: if a colleague with little context would be confused by your prompt, the model will be too.
  • Explain why. Giving the reason behind an instruction tells the model more about your goal, which leads to more targeted responses.
  • Show examples. A few input and output examples, sometimes called few-shot prompting, steer style and structure. Cover a varied range of inputs rather than several similar ones.
  • Structure the prompt. Separate instructions, source documents and examples clearly, for example with headings or tags.
  • Give a role. A short role statement in the system prompt, such as “You are an editor for a pharmaceutical brand team,” focuses behavior and tone.
  • Supply the source material. Ask the model to work from the documents you provide rather than its general knowledge. This also helps reduce AI hallucination.

Prompt engineering is a testing discipline

Anthropic’s guide says to start with clear success criteria and a way to test against them before refining a prompt. It also notes that not every problem is a prompt problem: some, such as speed or cost, are easier to fix by choosing a different model.

In practice that means:

  1. Write down what a good output looks like.
  2. Collect realistic test inputs, including difficult ones.
  3. Run the prompt several times and compare results.
  4. Change one thing at a time and test again.

This is a small-scale form of AI evaluation.

Prompt management

When prompts move from individual experiments to tools a whole team relies on, they need to be managed like any other shared asset. OpenAI’s documentation recommends keeping production prompts in code, where they can be reviewed, tested and deployed through normal processes. It also recommends pinning to a specific model version and building evaluations, so you can check whether a prompt still performs when you change it or upgrade the model.

For pharma marketing teams, prompt management also answers practical questions:

  • Consistency. If everyone writes their own prompts, the same task produces different quality across the team. Shared, tested prompts give everyone the same starting point. Everyone on your team uses AI. None of them use it the same way. looks at this problem.
  • Approved inputs. Standing instructions can point the model to approved claims, references and brand guidelines instead of whatever a user pastes in.
  • Ownership. Someone should own each shared prompt, know when it changed and decide when it needs updating.

A pharma example

Vague prompt. “Write an email about our drug for doctors.”

A better prompt gives the model a role, the audience, the approved source, the constraints and a way to handle gaps:

Clearer prompt. “You are drafting a first version of an HCP email for review. Use only the claims and references in the attached approved claims list. Keep it under 150 words. Don’t add efficacy figures that aren’t in the list. If you need information that isn’t provided, say so instead of filling the gap.”

The output is still a draft that goes through normal review, but it starts much closer to something reviewable. When AI gets it wrong, check your prompt first has more on asking the right questions before you send.

Common misconceptions

  • “There’s a magic phrase.” Good prompts come from clear thinking about the task, not special wording.
  • “A prompt that worked once will keep working.” Outputs vary, and models change. Prompts need retesting, especially after a model update.
  • “Prompt engineering can make output compliant.” Instructions can make problems less likely, but they can’t guarantee accuracy or regulatory suitability. People still review the work.

References

  1. Prompt engineeringOpenAI API documentation
  2. Prompt engineering overviewAnthropic (Claude documentation)
  3. Prompting best practicesAnthropic (Claude documentation)

Last reviewed December 2026. This glossary explains terms in general; it isn’t legal or regulatory advice.

Ready to make the shift?

Let's talk about your goals and how we can help.