Skip to content
mentoor

Topic 5 of 5 · 4 min read

Mapping a spec to prompts and tools

Goal: Trace each spec rule to the system prompt, tool or guardrail that enforces it and flag rules that nothing enforces.

Every rule in the spec must land somewhere in the build, in the system prompt, a tool, a retrieval source or a guardrail, and a rule that lands nowhere is a wish. The product manager traces each rule to its home and treats the prompt as a product artefact, reviewed and versioned like any other.

Check yourself · 1 of 3

Which spec rule is best enforced by a guardrail outside the model rather than a prompt sentence?

Choose one answer

Why it matters

The spec is written in business language. The model only sees the system prompt, the data it is given and the tools it can call. Between the two is a translation step, and that step is where rules disappear. A model also drops instructions and follows some more than others, so a rule that lives only in a long prompt is the weakest kind.

Where rules land

  • System prompt. The instructions given to the model before every chat. Good for scope, tone, how to say "I do not know", and the escalation wording. A weak place for hard limits, because the model can still slip.
  • Retrieval sources. The documents the feature may read. "Answer only from the help centre" is partly enforced by what you let it fetch. If the refund policy is not in the index, no prompt will make the answers correct.
  • Tools. Actions the model can call, such as look up an order or open a ticket. A tool both gives the feature a power and limits it. If there is no refund tool, the feature cannot issue one.
  • Guardrails. Checks outside the model: a filter that blocks personal data in replies, a code check on format, a classifier that detects a legal threat and routes to a person. Use these for never rules, since code does not forget.
  • Permissions and data access. What the feature may see for each user.

How to trace

Make a table with one row per rule. Columns: the rule, where it is enforced, how you know it works (which eval criterion). Then look for blanks. A never rule with only a prompt sentence and no guardrail or eval is a risk to flag. A rule with no home must be built or cut.

The prompt as a product artefact

The system prompt changes behaviour as much as code does. Keep it in version control, give each change a version number and a reason, and run the evals on every change. The product manager reads each diff and asks which spec rule it serves and what test shows the change helped. No one edits it live to "just fix one thing".

Before and after

Before: Rule: never give legal advice. Enforced by: the prompt says "be careful with legal questions".

After: Rule: never give legal advice. Enforced by: a prompt line with the refusal sentence, a classifier that routes legal topics to a person, and eval criterion E7 with 40 risky inputs at 0 failures.

What goes wrong

  • Never rules rest on one prompt sentence.
  • Someone edits the prompt in production and no one knows why behaviour changed.
  • The retrieval source is missing the document the rule depends on.
  • The spec promises an action, but no tool exists to perform it.

Examples

A traceability table with a gap

Rule Enforced by Eval
Answer only from help articles Retrieval limited to the help index; prompt line E2
Never promise a refund Prompt line only none
Escalate legal threats Classifier routes to a person E5

The second row is the gap: a never rule with no guardrail and no eval.

A reviewed prompt change

Change v14 to v15: added "If the order status is not in the lookup result, say you cannot see it." Reason: spec rule on uncertainty. Evidence: invented delivery dates dropped from 11 of 200 test chats to 1. The PM approves, the change is tagged, and the old version stays available for rollback.

Key points

  • Each spec rule needs a home in the system prompt, a tool, a retrieval source or a guardrail, and a rule with no home is only a wish.
  • Hard limits belong in guardrails and code, because a prompt sentence can be ignored.
  • What the feature can retrieve and which tools it has decide what it can do, however good the prompt is.
  • Trace rules in a table with the enforcement point and the eval that checks it, then look for blanks.
  • Version the system prompt and review each change against the spec and the evals.

Common mistakes

  • Relying on one sentence in a long system prompt to enforce a never rule.
  • Editing the prompt in production without a version, a reason or an eval run.
  • Promising an action in the spec when no tool exists to perform it.
  • Forgetting that retrieval limits what the feature knows, and blaming the model when the document is missing.

Check yourself · 2 of 3

The spec says the assistant should check the status of an order. What must exist for that rule to work?

Choose one answer

Check yourself · 3 of 3

Why does a product manager want the system prompt kept under version control?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic