Skip to main content

System, User & Assistant Roles

Beginner
What you'll learn
  • The three roles every AI conversation is built from — and what each one is for
  • Why the system prompt is the single highest-leverage place to steer behavior
  • How the same idea appears in chat apps, Claude Code, and the API
  • A common trap: burying rules in a user turn instead of the system message

Every AI conversation is built from messages, and each message has a role. Understanding the three roles explains how to steer the model — and why some instructions stick while others don't.

The three roles

Guided walkthrough1 of 3
  1. Top-level setup for the whole conversation: who the model should be, the rules, the output format. Set once, applies to every turn that follows.

Why the system prompt is your most powerful lever

The system message frames everything that follows. It's where you set the model's role, standards, tone, and hard rules — and the model weights it heavily. If you want consistent behavior across a whole conversation (or app), put it here, not buried in a user turn.

Same idea, three surfaces:

SurfaceWhat plays the system-prompt role
Chat apps (Claude.ai, ChatGPT, Gemini)Your account custom instructions
Claude CodeCLAUDE.md at the project root
The APIThe system parameter on the request (first call)

A worked before/after

The most common mistake is putting the standing rules into every user turn instead of the system message. Watch what changes.

Before — rules jammed into a user turn, repeated every time:

Rules in the user turn (fragile)

user: You are a precise financial analyst. Always show your assumptions.
Never invent numbers. Now: summarize this 10-K.
[10-K text]

After — rules hoisted to the system message, user turns stay clean:

Rules in the system message (durable)

system: You are a precise financial analyst. Always show your assumptions.
Never invent numbers. Cite the section of the filing for each claim.

user: Summarize this 10-K.
[10-K text]

user: Now flag the risks.

The "after" version keeps behavior stable across turns, halves the tokens you resend each turn, and makes the app easier to change — you edit the standing brief in one place.

Putting words in the assistant's mouth

An underused move: you can prepend an assistant turn as a few-shot example or a format primer, and the model will continue in that style. This is how templates and rubrics get enforced without a big prompt.

Prime the assistant to follow a format

system: You are a code reviewer. Return only the sections below.

user: Review this pull request. [diff]

assistant: ## Summary
- 
## Risks
- 
## Suggested changes
-

The model treats your seeded assistant turn as a prior response and completes into the same shape.

Common mistakes

Pro tip
  • Rules in every user turn — put standing rules once in the system message; use user turns for the actual task.
  • Contradicting yourself across turns — a later, explicit user instruction can override a vague system one. Be consistent.
  • Treating the assistant role as read-only — you can seed it to prime format, tone, or a few-shot pattern.
  • Overloading the system prompt with facts that change — put volatile facts (docs, data, current state) into the user turn or retrieval context, not the system message.

Check yourself

Check yourself

0/4
  1. Where should standing rules like tone, format, and role live?
  2. In Claude Code, which file plays the same role as the API's system parameter?
  3. Can you write text into an assistant turn yourself before the model replies?
  4. A user turn now says something that contradicts the system prompt. What tends to happen?
Key takeaways
  • Three roles: system sets the brief, user asks per-turn, assistant replies (or is seeded).
  • The system prompt is the highest-leverage lever — put standing rules there once.
  • Chat custom instructions, CLAUDE.md, and the API `system` field are the same idea on three surfaces.
  • Volatile facts belong in user turns or retrieval, not the system message.

Next