All articles
February 16, 2025 6 min read

Prompt foundations: the anatomy of a prompt that works

A prompt isn't a magic incantation — it's an interface. Here are the fundamentals: the roles, the structure, and the handful of techniques that do most of the work.

Written forEngineeringProduct
PromptingLLMFundamentals

"Prompt engineering" sounds mystical, and a lot of the advice around it is folklore. Strip that away and a prompt is just an interface: the instructions and context you hand a model so it produces what you need. Get the fundamentals right and you rarely need the tricks.

The roles

Modern chat models take a list of messages, each with a role. The system message sets the model's job, tone, and rules. User messages carry the request. Assistant messages are the model's replies (and, in few-shot prompting, examples you supply). Keeping durable instructions in the system message and the task in the user message is the first discipline.

The anatomy of a good prompt

  • Instruction — say exactly what you want done, in plain, specific language.
  • Context — the data the model needs, clearly delimited from the instruction.
  • Examples — one or two demonstrations of input → output when the task is nuanced (few-shot).
  • Output format — spell out the shape you want back, especially if you'll parse it (JSON, a list, a schema).

The techniques that actually matter

Most of the gains come from a short list: be specific instead of clever; show examples rather than describe them; ask for a structured output when you'll consume it programmatically; and, for reasoning-heavy tasks, let the model work step by step (chain-of-thought) before it answers. Then iterate against real inputs — the first prompt is a draft, not a deliverable.

You're not casting a spell. You're writing a spec for a very capable, very literal collaborator that has never met you.
Building something with LLMs?
I help teams ship GenAI that’s reliable and cost-efficient.
Let’s talk