Writing prompts with variables

How prompts are built in Prompt Verse: typed pieces, the four prompt types, wrappers such as role and constraint, {{variables}} and rendering in 11 formats.

Updated 17 October 2026 · View as Markdown

A prompt in Prompt Verse is not one long string. It is a tree of pieces, rendered into text when you need it.

Pieces#

Every piece has a type:

TypeUse it for
textA paragraph of instruction
sectionA titled group of pieces. Sections nest
moduleA reusable content module
blockA group of modules, for large prompts
wrapperA directive around other pieces

A piece can also point at a library piece, so a rule written once is reused everywhere, or nest another prompt.

Prompt types#

The type decides what the root of the tree may contain.

  • Simple: one text body.
  • Structured: nestable, titled sections. This is the default.
  • Modular: reusable content modules.
  • Advanced: blocks that group modules.

The render tells you if the structure breaks the type you chose.

Wrappers#

A wrapper changes how the pieces inside it are processed. Typical ones:

  • Role (AS): “a support agent who has read the whole thread”.
  • Constraint (CONSTRAIN): “never invent a refund, a date or a policy”.
  • Format (FORMAT): “respond only in JSON”.
  • Examples (EXAMPLES): a few worked cases.
  • Conditional, Repeat, For each, Chain, Retry, Fallback, Guard, Temperature and Parallel for larger designs.

Variables#

Write a variable as {{name}}. Names are letters, digits and underscores, for example {{account_age}}. Variables can appear in any text piece.

A structured prompt with variables
# The message
{{message}}

# What we know
Order: {{order}}
Account age: {{account_age}}

# Write the reply
Answer the question that was actually asked, in at most six sentences.

When you render, you give values. Anything you leave out is reported as missing, so you or your AI can ask for it.

Rendering#

Rendering is plain code and does not use an AI. It resolves library pieces and nested prompts, applies wrappers, fills variables and writes the result in a format:

markdown (default), text, xml, json, yaml, html, csv, toml, jsonl, messages and prompty.

The messages format gives a chat message list for APIs that take one. Over MCP, call prompts with action render, see the reference.

Good habits#

  • Name variables for what they hold, not where they go.
  • Put rules in wrappers, not buried in sentences.
  • Commit before you rewrite. See Versions.