Prompt Engineering

Authors 58 articles 665 min total read

This theme is curated by our AI council — see how it works.

Prompt engineering is the discipline of designing the inputs a large language model receives — instructions, examples, roles, and reasoning scaffolds — so that its output becomes reliable enough to build on. The theme spans everything from the system prompt that fixes behavior before the first user message to frameworks that let a model plan across branches, act through tools, and critique its own drafts. This page maps that craft: what to read first, which technique fits which problem, and where the techniques get mistaken for one another.

  • A prompt is an interface contract, not an incantation: most bad output traces to instructions the model was never actually given in a form it could follow.
  • The techniques form a ladder — instruction, system, and role design first; then multi-step patterns (chains, agent loops, conversations, multimodal inputs); then deliberate reasoning and domain adaptation.
  • Every technique above a plain instruction buys reliability with tokens and latency; choosing between them is an engineering trade-off, not a matter of style.
  • This theme has three tiers: three foundations, four core patterns, three advanced frameworks. Read them in that order.

Why prompt engineering matters for engineers moving into AI

For a developer, the prompt is a new kind of API surface — except the contract is written in natural language, the parser is probabilistic, and a rephrased sentence can change the result. Prompt engineering is what turns that instability into something you can ship: explicit instructions, structured output constraints, and reasoning patterns with known failure modes. The stakes are practical, not academic — the same model, prompted two different ways, is the difference between a demo that impresses and a workflow that survives real inputs.

MONA asks: 'What kind of API changes its result when you rephrase a sentence?' MAX answers: 'A prompt; the same model prompted two ways separates a demo from a workflow that survives real inputs.' — comic dialog.
Prompt engineering turns a probabilistic contract into something you can ship.

Start here: instructions, system prompts, and roles — the foundations of prompt engineering

The discipline itself is the first stop. Prompt engineering names the full toolkit — zero-shot, few-shot, chain-of-thought — and how those techniques control LLM output is the single best first read in this theme, because every later framework is assembled from these primitives. Its companion piece, the anatomy of a production prompt, shows how instructions, role lines, and output constraints combine into one working artifact rather than a pile of tips.

The layer beneath every exchange is the system prompt — the instruction block that sets behavior, persona, and constraints before the first user message arrives. It is also where newcomers over-invest: why system prompts longer than 300 words backfire walks the token-budget mechanics that quietly punish instruction sprawl.

The third foundation, role prompting, assigns the model an expert persona — and it is the most over-sold technique in the toolkit. How an assigned persona changes LLM behavior explains the real effect, and role prompting for code review, customer support — and when to skip it entirely is the honest read on where a role earns its place and where it is ritual.

With these three, every technique in the rest of the theme reads as a variation on a shape you already know: an instruction layer, an optional persona, and a defined output contract.

The core prompting patterns: chains, agent loops, conversations, and multimodal inputs

Once a single prompt behaves, the next question is what to do when one call is not enough — and the four core patterns are four different answers to it.

Prompt chaining breaks a task into sequential calls where each step’s output feeds the next — how sequential LLM calls enable complex reasoning is the entry point. Read its failure-mode twin next: error propagation and context limits shows what a chain really costs — a mistake in step two silently becomes the ground truth of step five.

Where a chain fixes the steps in advance, ReAct prompting lets the model choose them at runtime, interleaving reasoning with tool use in a thought–action–observation loop — which is why the pattern sits underneath most agent architectures. Before committing to it, read how to build a ReAct agent in Python and when to choose it over native function calling; the choice is closer than most tutorials admit.

The third pattern runs in time rather than steps. Multi-turn prompt design manages how context accumulates across LLM turns — and context rot and lost-in-the-middle names the failure every chat product eventually meets: conversations degrade not because the model got worse but because the context did. The sliding windows, compression, and state management guide is the build path once the mechanics are clear.

Finally, multimodal prompting extends everything above to inputs that mix images, audio, and text — how vision-language models process them together is the orientation read, because cross-modal prompts involve design decisions (what to describe in words, what to let the model see) that text-only intuition does not cover. The cross-modal pipeline guide turns those decisions into working patterns.

These four cover most production prompting work. The last tier exists for the problems they cannot solve — tasks that need exploration, self-correction, or expert-domain framing.

Advanced prompt engineering: deliberate reasoning, self-critique, and domain adaptation

When a single linear chain of thought is not enough, tree of thoughts lets the model explore several solution paths in parallel, score the branches, and backtrack — how it extends chain-of-thought reasoning is the concept read, and token explosion, latency, and the hard limits is the cost sheet to study before turning it on. The framework’s history is instructive in its own right: from Game of 24 to o3 traces how explicit tree search shaped the native reasoning models that now internalize it.

Constitutional AI prompting points the model at its own output: a critique-revision loop checks each draft against a written set of principles — how critique-revision loops replace human feedback — trading extra calls for outputs that correct themselves before a human ever reads them. The Claude and DSPy critique pipeline guide shows the pattern in working form.

And when the subject matter itself carries the risk, domain-specific prompting adapts the whole toolkit to fields like law, medicine, and code — how vocabulary, role injection, and constraint framing shape output is the entry point, and applied patterns for legal, medical, and code AI shows what the general techniques look like once a compliance constraint is in the room.

The three advanced frameworks share one economic shape: each buys quality with more model calls. That is why the earlier tiers matter — an expensive framework layered on a weak base prompt amplifies the weakness at a higher price.

How the prompting techniques differ

The confusion that costs teams the most is treating the three multi-step patterns as interchangeable. They answer different questions:

Prompt chainingReActMulti-turn design
Who decides the next stepYou, at design timeThe model, at runtimeThe user, turn by turn
Control flowFixed sequence of callsReason–act–observe loopOpen-ended conversation
Best whenThe task decomposes into known stepsThe next step depends on what tools returnA human stays in the loop
Main failure modeErrors propagate silently down the chainLoops, wrong tool calls, runaway costContext rot as history grows

Three finer distinctions trip readers just as often:

  • System prompt vs role prompt. Not rivals — different axes. The system prompt is a placement: the instruction layer that precedes the conversation. A role is one content choice you can make inside it. Conflating them produces bloated system prompts where a persona paragraph does work that an output constraint should be doing.
  • Chain-of-thought vs tree of thoughts. Chain-of-thought is a single reasoning trace inside one response; tree of thoughts is many traces with evaluation and backtracking across calls. Most tasks that seem to need the tree actually need a better linear prompt — the tree earns its token bill only when the first idea is frequently wrong and candidates are cheap to score.
  • A chain vs one long prompt. Growing context windows make it tempting to merge a chain back into one giant prompt. The trade-off is inspectability: a chain exposes intermediate outputs you can log, test, and correct mid-flow. Prompt chaining in production 2026 examines how real deployments weigh exactly this threat.

Common questions

Q: Where should I start with prompt engineering as a software developer? A: Read the foundations tier in order — the discipline overview first, since zero-shot, few-shot, and chain-of-thought are primitives every later pattern reuses. The prompt engineering explainer covers all three; move on to system prompts once single instructions behave predictably.

Q: Do I still need ReAct now that models have native tool calling? A: Rarely as literal prompt text — native function calling covers the mechanics — but the reason–act–observe structure still governs how agents are designed and debugged. ReAct in the wild examines what actually survived into 2026’s coding agents and what became redundant.

Q: Why does a prompt that worked yesterday break on a new model or input? A: Because prompts are phrasing-sensitive contracts with no compiler: small wording shifts, model updates, and context growth all change behavior without warning. Why prompts break maps the ceilings and sensitivities — the honest-limits read for this whole theme.

Q: Should I split a task into a prompt chain or keep it in one prompt? A: Split when the task has distinct steps whose intermediate outputs you want to inspect and correct; keep one prompt when the steps are entangled and cheap to redo. Splitting has its own tax — error propagation in prompt chains shows how early mistakes compound downstream.

Q: When is tree of thoughts worth the extra tokens? A: Only when the first attempt is often wrong and candidate solutions are cheap to evaluate — planning, puzzles, constrained generation. For everything else, a well-prompted linear chain of thought gets close at a fraction of the cost. The hard limits of explicit tree of thoughts prices the trade honestly.

Q: What should I read before prompting in a regulated domain like law or medicine? A: The prerequisites-and-limits read first: before you prompt a doctor or lawyer covers what domain prompting cannot fix. Then the foundations tier — domain-specific prompting composes roles, constraints, and system prompts, so weak foundations surface fastest where the stakes are highest.

Developer orientation

Coming from software engineering? Bridge articles map this theme onto what you already know — which of your instincts still apply, which quietly break, and where to dive deeper once you're oriented.

Browse all 10 topics

Constitutional AI Prompting →

Constitutional AI prompting is a self-critique pattern where a model evaluates its own output against a set of defined …

5 articles

Domain-Specific Prompting →

Domain-specific prompting is the practice of tailoring LLM instructions to match the vocabulary, constraints, and expert …

6 articles

Multi-Turn Prompt Design →

Multi-turn prompt design is the practice of structuring conversation flows and managing context across multiple LLM …

6 articles

Multimodal Prompting →

Multimodal prompting means writing instructions for AI models that can process images, audio, or video alongside text. …

6 articles

Prompt Chaining →

Prompt chaining breaks complex tasks into sequential LLM calls where each step's output feeds into the next. Instead of …

6 articles

Prompt Engineering →

Prompt engineering is the practice of designing inputs that reliably produce desired outputs from large language models. …

7 articles

ReAct Prompting →

ReAct Prompting is a framework that structures LLM outputs as alternating Thought, Action, and Observation steps. Each …

5 articles

Role Prompting →

Role prompting assigns an LLM a specific expert identity — such as senior security engineer or contract lawyer — before …

6 articles

System Prompts →

A system prompt is a block of instructions placed before the first user message in an LLM conversation. It defines the …

5 articles

Tree of Thoughts →

Tree of Thoughts (ToT) is a reasoning framework that extends chain-of-thought prompting by exploring multiple solution …

6 articles

Four perspectives on this domain