Pattern 2 of 10

Structure your prompt like a pipeline

Most people type one paragraph and hope. A prompt works far more reliably when you treat it as ordered layers, each with one job.

Order matters: role, context, instructions, examples, then constraints last.

The pipeline is a simple, repeatable structure for any non-trivial prompt:

  • Role — who the model is and what it is doing
  • Context — the raw material: data, documents, background
  • Instructions — what to do, in order
  • Examples — what good output looks like (when helpful)
  • Constraints — the guardrails, placed last, right before generation

Why it works

Placement changes results. Two well-documented findings make the order matter: models pay most attention to the start and end of a prompt, and constraints carry more weight when they sit right before generation.

For long documents specifically, providers recommend placing the long source material near the top and your actual question near the end.

How to do it

Label the sections. Headers like CONTEXT, TASK, and CONSTRAINTS are processed more reliably than one long wall of text.

Put the documents or data first, the instructions next, and the constraints last. The example template below follows that order.

Example you can copy

Pipeline template
ROLE
You are a senior technical editor.

CONTEXT
<paste the article or data here>

TASK
1. Identify the three weakest paragraphs.
2. Rewrite each for clarity, keeping the meaning.
3. Keep the author's voice.

EXAMPLE OF GOOD OUTPUT
Before: "Utilize the functionality to..."
After: "Use it to..."

CONSTRAINTS
- Do not change technical facts.
- Return only the rewritten paragraphs, labeled.
- British English.

When it helps

  • Any multi-part task with data, instructions, and a required format
  • Long-document tasks (put the document at the top, the question at the end)
  • When you need consistent, repeatable output structure

When to skip it

  • Short, simple questions where one clear sentence is enough
  • Quick back-and-forth chat where a full template adds friction

Common mistakes

  • Burying the key instruction in the middle of a long prompt
  • Putting constraints at the top, where they lose weight by generation time
  • Writing one undifferentiated paragraph instead of labeled sections

Frequently asked

How do you structure a prompt step by step?

Use ordered layers: role, then context and data, then step-by-step instructions, then examples of good output, then constraints placed last right before generation.

Does the order of a prompt matter?

Yes. Models use information best at the beginning and end of a prompt, and constraints carry more weight when placed last, so order changes the result.