Give the Model a Role
Last reviewed
IntermediateWhat you'll learn
~12 min- Open a prompt with a role that shifts the model's depth, vocabulary, and judgment
- Write roles that are specific enough to change the output, not just decorative
- Decide when a role helps and when it is noise
Here is the technique, first:
You are a senior security reviewer with 15 years auditingauthentication systems for government deployments. Review thelogin function below. Flag anything you would not let ship,ordered by severity, with the specific risk for each.
[paste the code]Compare that to “review this login function.” Same task, same code. The first version produces a deeper, more skeptical, more domain-aware review — because the opening line told the model who it is being before it read the task.
Why a role changes the output
A role is not roleplay. It is a fast way to point the model at a region of its training. “You are a senior security reviewer” pulls the response toward the vocabulary, priorities, and caution of security reviews — threat models, severity ordering, defense-in-depth — without you having to spell each of those out. The same task framed as “you are a friendly tutor explaining to a beginner” pulls toward analogies, gentle pacing, and no jargon.
You were taught the coworker mental model back in Module 1: treat the AI like a brilliant but literal new hire. The role is how you tell that new hire which expert showed up for work today.
Generic role vs. specific role
The mistake people make is stopping at the job title. A title alone barely moves the output. The specifics are what work.
Weak (a label):
You are a UX designer. Improve this signup form.Strong (a label with the context that shapes judgment):
You are a senior UX researcher who specializes in SaaS onboardingand has watched hundreds of users abandon signup flows. Review thissignup form for friction. For each issue, name the drop-off risk andthe smallest change that would reduce it.The second version did not just rename the model — it told it what to care about (drop-off, friction, minimal change). A good role answers three questions:
- Who — the expertise (“senior security reviewer,” “clinical data manager”)
- What they care about — the lens (“flag anything you would not let ship,” “optimize for reproducibility”)
- How they communicate — the register, if it matters (“explain it so a non-engineer can sign off”)
In a browser chat or API call, the role belongs in the system prompt if your tool exposes one — that is what system prompts are for, and it keeps the role separate from the per-message task. In a CLI tool, put the role at the top of your prompt, or bake a persistent role into your project’s context file (CLAUDE.md and equivalents) so every session starts with it. Either way: role first, task second.
A worked contrast
Same request — “summarize this incident” — under two roles:
Role A:
You are an SRE writing a blameless post-incident review. Summarizethe incident below for the engineering team: timeline, root cause,contributing factors, and follow-up actions. No blame language.Role B:
You are a communications lead writing a customer-facing status update.Summarize the incident below for non-technical customers: what wasaffected, for how long, and what we are doing about it. Reassuring,no internal jargon, under 120 words.Same source text. The SRE version produces a structured technical timeline; the comms version produces a short, calm, jargon-free notice. You did not write two different sets of instructions — you cast two different experts.
🧬In Your Field: Biotechclick to expand
Roles encode lab standards. “You are a bioinformatics core manager who enforces reproducibility — every analysis must be re-runnable from raw data with pinned tool versions” makes the model default to documenting versions, seeds, and parameters without being reminded each time. The role carries your standards so you do not have to restate them.
🏛️In Your Field: Government / State Devclick to expand
Roles encode compliance posture. “You are a government application reviewer who treats accessibility (WCAG 2.1 AA) and least-privilege access as non-negotiable” front-loads the lens your work requires, so the model flags violations on the first pass instead of after you ask.
🏢In Your Field: Property Managementclick to expand
Roles set the read. “You are a skeptical property manager who has been burned by vendors that lowball the quote and pad the change orders” tilts a bid review toward the risk-spotting you actually want — vague scopes, missing warranty terms, soft completion dates — instead of a neutral restatement of the proposal.
When a role helps — and when it does not
Roles earn their keep on judgment-heavy, open-ended tasks: reviews, analysis, writing, advising, anything where expertise changes the answer.
They add little to mechanical, well-specified tasks. “Rename this variable across the file” does not get better because you said “you are a senior engineer” — the task has one correct output and no room for expert judgment. Adding a role there is harmless but pointless noise.
A role primes tone and priorities. It does not grant the model real-world authority or guarantee correctness. “You are a lawyer” does not make the output legal advice you can rely on; “you are a doctor” does not make it a diagnosis. Use roles to shape how the model reasons — then verify the substance yourself, exactly as you would any other output.
Which role prompt will most improve a code review?
Key takeaways
- Role first, task second. Telling the model who it is before what to do shifts depth, vocabulary, and judgment for free.
- A title alone is weak. Add what the expert cares about and how they communicate — that is what moves the output.
- Put it where it persists. System prompt if you have one; top of the prompt or the project context file in a CLI.
- Roles shine on judgment work, not mechanical tasks. Don’t bother role-casting a rename.
- A role is a lens, not a credential. It shapes reasoning; it does not guarantee correctness. Verify anyway.
Next: Show, Don’t Tell