Methodology · Prompt Engineering

Structured Prompt Construction

Compose a prompt from explicit, labelled slots so each part can be read, tested, and changed on its own.

Description

Build a prompt from named parts instead of one blob of text. Name the role, the context, the task, the examples, and the exact output format, and wrap each part in a tag so the model can tell them apart. A prompt with labelled parts is easier to read, test, and fix than a wall of instructions, and it is far easier to change one part without breaking the rest.

When to apply

Use this when a prompt is doing real work and has grown past a sentence or two. It pays off most when output format matters, when several people edit the same prompt, or when the same prompt must run on varied inputs. Don't apply it to a trivial one-line ask; that does not need slots.

What it involves

  • Name the role
  • State the task and context
  • Show two or three examples
  • Pin the output format
  • Wrap each part in tags
  • Ask for reasoning before the answer

Open the full interactive page

Diagram, neighbourhood map, code examples, related patterns and full provenance.

Related