D4 · Prompt Engineering › Cluster 2 · Roles & System Prompts

2.3 · What Belongs in System vs User

Instructions vs data

CONCEPT The split: instructions live in system, data lives in the turn

The dividing line is simple. The system prompt holds the role and the instructions — who Claude is and how it should behave, stable across the conversation. The user turn holds the task and the data — the specific thing to do this time and the content to do it on.

Put in systemPut in the user turn
Role / persona ("You are a legal analyst")The specific question or command this turn
Standing rules & constraints ("always cite sources")The document / code / record to operate on
Output-format policy that never changesPer-request parameters (the target language, the file)
Stable background contextRetrieved RAG chunks, user-supplied text
Tone & voice guidanceAnything that changes call to call
🔑 Heuristic: if it's the same on every request, it's a system-prompt candidate; if it changes per request, it's user-turn content. "How to behave" → system. "What to do now, on this" → user.

CONCEPT Why the split matters

Anti-pattern: interpolating a timestamp, user ID, or the current question into the system prompt. It bloats the stable prefix, breaks caching, and blurs instruction-vs-data. Inject that dynamic content in the user turn instead.

DIAGRAM Routing content to the right channel

flowchart TD C["A piece of content"] --> Q{"Same on every request?"} Q -->|"yes: role, rules, format policy"| SYS["🟢 system parameter
(instructions, stable, cacheable)"] Q -->|"no: this question, this document, RAG chunk"| USR["🔵 user turn
(task + data, per-request)"] USR --> WRAP["Wrap untrusted data in tags
(<document>…</document>) — 2.5"] classDef sys fill:#d4edda,stroke:#28a745,color:#155724; classDef usr fill:#e7f0fd,stroke:#4a90d9,color:#1a3d6d; class SYS sys; class USR,WRAP usr;

CODE BAD → GOOD: instructions vs. data

The BAD version jams the role, the rules, and the data into one blended string with volatile content in system. The GOOD version separates the stable instructions from the per-request data.

# BAD — everything blended; volatile doc & timestamp in system
client.messages.create(
    model="claude-opus-4-8", max_tokens=1024,
    system=f"You are a contract analyst. It is {now}. "
           f"Summarize this contract: {contract_text}",   # data in system → no caching
    messages=[{"role": "user", "content": "go"}],
)

# GOOD — stable instructions in system, per-request data in the user turn
client.messages.create(
    model="claude-opus-4-8", max_tokens=1024,
    system=(
        "You are a contract analyst. Summarize contracts in 5 bullet points, "
        "flag any auto-renewal clause, and cite the section for each point."
    ),
    messages=[{"role": "user", "content": (
        "<contract>\n" + contract_text + "\n</contract>"   # data, tagged, in the turn
    )}],
)

TRADE-OFFS Overloading system vs. keeping it lean

✅ Lean, stable system prompt

  • Cacheable prefix → cheaper, faster
  • Clear instruction-vs-data boundary
  • One system prompt reused across many inputs

⚠️ Everything crammed into system

  • Volatile content breaks the cache every call
  • Data can be misread as instructions
  • Hard to reuse; hard to reason about

EXAM TRAPS

Trap: Putting the per-request question or document in system. → Those are data — they belong in the user turn. System is for the stable role and instructions.
Trap: Interpolating datetime.now(), a UUID, or a session ID into the system prompt. → It's volatile, so it breaks prompt caching and belongs in the user turn.
Trap: Treating instructions inside user-supplied data as trustworthy. → Keep data in the user turn and wrap it in tags; instructions the model should obey live in system, which carries standing authority.
Trap: "System is just the first user message." → No — it's a separate channel with standing-instruction weight, not the same as a turn.

PRACTICE

Q1 · A RAG-retrieved document chunk — system or user turn?

User turn. It's per-request data. Put the role and the "how to use retrieved context" rules in system; put the retrieved chunk (tagged) in the user message.

Q2 · Give the one-line heuristic for the split.

If it's the same on every request → system (instructions). If it changes per request → user turn (data). "How to behave" vs. "what to do now, on this."

Q3 · Name two problems with putting volatile data in the system prompt.

(1) It breaks prompt caching — the stable prefix changes every call. (2) It blurs instructions and data, making it easier for injected content to be treated as a command.