AI glossary

What is Prompt Engineering?

Definition

Prompt engineering is the practice of writing and refining instructions, context and examples for a language model so it reliably produces the output you want.

The same model can give mediocre or excellent results depending on how you ask. Prompt engineering is how you get consistently good results.

Techniques that work

  • Be specific: state the goal, audience, format and length.
  • Give context: explain why, not just what. Models use the reasoning to handle edge cases.
  • Show examples: a few input → output examples clarify expectations quickly.
  • Structure inputs: separate instructions from data, for example with XML-style tags such as <document>.
  • Define a role: “You are a support agent for…” sets tone and scope.
  • Allow uncertainty: tell the model it may say “I don’t know”.
  • Ask for structured output (JSON matching a schema) when code will consume the result.

Treat prompts like code

Keep prompts in version control, test changes against an evaluation set and avoid tweaking them in production without measurement.

Free newsletter

The Agent Brief

One practical email a week on AI agents, RAG and generative AI, for builders and business owners. No hype, no spam.