Learn AI compute, then follow the market
← Back to Compute College

Compute College

Prompt anatomy: instructions, context, and output

Learn the main parts of a production prompt and how each one affects model behavior, tokens, and validation.

Plain-English definition

Prompt anatomy separates a model request into parts with clear jobs. A useful prompt commonly contains instructions, the current user input, relevant context, examples, constraints, and an output format. API names differ by provider, but the design problem stays the same: make the task and the information needed to complete it easy to distinguish and validate.

Memory trick: Instructions tell. Context informs. Examples demonstrate. Constraints limit. Output contracts verify.

Why it matters

When instructions, reference material, user content, and output requirements are mixed together, models and reviewers have a harder time determining which text is authoritative and what the answer should contain. Separating the parts makes prompts easier to version, test, secure, and shorten. It also makes recurring token and latency costs easier to attribute.

  • Clear sections reduce ambiguity when user-provided text contains instructions that should not control the system.
  • Reusable instructions and examples can be cached or versioned separately from changing user input where a provider supports it.
  • Output contracts let software reject malformed results before they trigger retries, tool calls, or human cleanup.

Simple example

A document-review prompt can be organized as: Instructions — identify unsupported claims; Context — the document and review policy; Input — the current document section; Examples — one passing and one failing finding; Constraints — do not infer facts absent from the text; Output — JSON containing `claim`, `evidence`, `severity`, and `confidence`. This structure makes each responsibility visible to both the model and the evaluator.

  • Instructions define the operation and the priority rules.
  • Context and input supply the material to work on, but should not silently override system rules.
  • Examples and output contracts demonstrate the expected shape without replacing a real evaluation set.

Example figures are illustrative calculations, not current quoted market prices.

Current example

Prompt design references

OpenAI and Google both describe clear instructions, relevant context, examples, and explicit output requirements as useful prompt-design tools. Provider terminology differs, so treat the anatomy as a transferable design model rather than a guarantee of identical API behavior.

OpenAI prompt-engineering best practices

Reference for separating instructions, context, examples, and desired output when refining a request.

What is context engineering?

See why prompt anatomy is only one part of the complete information environment.

Source discipline: message roles, caching, structured-output guarantees, and token accounting vary by provider. Check current API documentation before relying on a specific implementation detail.

Common mistake

One undifferentiated block hides the role of each piece of text. A reader cannot easily tell whether a sentence is an instruction, evidence, an example, or an untrusted quote. Changes also become harder to review because a small wording edit can alter several behaviors at once.

Practical takeaway

What you can do with this

Take one production prompt and label every line as instruction, input, context, example, constraint, or output requirement. Remove anything without a clear role, then test the labeled version against the same representative cases and compare quality, tokens, latency, and retries.

  • Builders: keep instructions and reference material visibly separate.
  • Reviewers: require output validation for fields that downstream code depends on.
  • Operators: log prompt version, token use, retry rate, and latency together so regressions are explainable.

Decision check: can a reviewer point to the exact part of the prompt that controls the task, supplies evidence, and defines a passing output?

Compute College track

Prompt & Context Engineering

Step 3 of 18: Prompt anatomy