Chapter 6

The Universal Prompt Contract

There is no perfect template for all models - there is a set of engineering questions the contract answers. A section is worth including only if it changes behavior or makes the result verifiable; everything else is noise.

Here are the questions any prompt is assembled from.

  • Goal - what user result is needed?
  • Boundaries - what does the system do and, above all, not do?
  • Data roles - which fields are trusted, which are user-supplied?
  • Context - what facts may be used?
  • Decision rules - what heuristics and priorities are needed?
  • Tools - when to call, when to clarify, when not to?
  • Output - text, schema, citations, language, and length?
  • Done - what counts as success, what as blocked, what as escalate, and what is the effort limit?

Put together, they give a skeleton that repeats from task to task.

SQL
# Goal
{{what the user should get}}

# Boundaries
- Do: {{the allowed area}}
- Don't: {{what belongs to another process}}

# Context and sources of truth
{{data, priorities, freshness, trust}}

# Decision rules
{{only rules that can't be reliably derived from the context}}

# Tools
{{when to call, required parameters, confirmation}}

# Result
{{schema or a clear format description}}

# Uncertainty and completion
{{when to clarify, refuse, escalate, stop}}

To feel how the sections fit a specific scenario, assemble the contract in the builder.

Interactive lab 2

Prompt contract builder

# Goal
Give a grounded answer from the passed sources

# Scope
Describe what is allowed and explicitly excluded.

# Context
retrieved sources with source_id and effective_date

# Decision rules
Add only rules that fix observed errors.

# Output
Strict schema + domain validation

# Risk control
Timeout, validation, and an ordinary fallback

# Done
answer, clarify, not_found, or conflict

And a word on role separately - it is useful exactly as far as it carries a contract.

A role is useful if it carries a contract. "You are an editor of medical translations who preserves the glossary terminology and adds no diagnoses" sets behavior. "You are a brilliant expert" defines almost nothing.

Links