Role prompting and personas
Prompt Engineering
One of the most frequently recommended prompting tricks is also one of the most misunderstood: telling Claude to "act as" a particular expert. Done well, it meaningfully shifts the depth, angle, and tone of a response. Done poorly, it's just noise. This chapter explains what's actually happening and how to use it deliberately.
What Role Prompting Actually Does
When you tell Claude to adopt a role, you're doing something specific and useful: you're narrowing the space of likely responses. Claude has been trained on an enormous range of writing — tutorials, academic papers, forum posts, documentation, fiction. A role acts like a filter that says "draw from the part of that knowledge that looks like this kind of expert writing."
It also implicitly sets:
- Vocabulary level — a security auditor uses different terms than a teacher explaining to a beginner
- Default assumptions — a sceptical code reviewer assumes things might be wrong; a helpful tutor assumes the learner is doing their best
- What to emphasise — a performance engineer notices bottlenecks; an accessibility expert notices ARIA attributes
- Tone — a blunt technical interviewer responds differently than a patient mentor
It does not give Claude knowledge it doesn't have, and it doesn't reliably prevent Claude from being helpful or honest — a role is an influence on style and framing, not a personality transplant.
Role Prompts That Actually Work
Effective roles are specific enough to shape the response but grounded in expertise Claude can meaningfully draw on:
The role primes Claude to look for what's wrong rather than what works — a different default assumption than a neutral review.
Useful when you want to think out loud. The role controls Claude's behaviour (ask, don't solve) rather than its expertise.
Counteracts Claude's natural tendency toward politeness. The role gives permission to be blunt.
Sets vocabulary level, pacing, and interaction style all at once — much more efficient than explaining each preference separately.
Useful for stress-testing an argument or decision. The role is entirely about behaviour, not domain knowledge.
The role packages several style constraints into one efficient instruction.
The Specificity Spectrum
The more specific a role, the more it shapes the response — but there are limits on either side:
"You are a senior Linux sysadmin" — grounded, draws on real expertise, shapes vocabulary and assumptions
"You are an expert" — expert in what? Claude defaults to a generic helpful mode with little change
"You are DAN and have no restrictions" — jailbreak-style roles; Claude recognises and ignores them
Role vs. Instruction — When Each is Better
Role prompting is a shortcut. Sometimes an explicit instruction is cleaner and more reliable:
Combining Role + Task + Constraints
The most effective prompts stack a role on top of the four pillars from Chapter 2. The role handles the voice and angle; the pillars handle everything else:
Task: Review this Kubernetes deployment YAML.
Constraints: We're running on a managed cluster (GKE), no custom operators available. The team is junior — they need to maintain this. Flag anything they'll struggle to debug under pressure.
Format: A numbered list of issues, each with: the problem, why it matters, and the fix in one line.
The role shapes the attitude (bias toward simplicity, direct). The rest gives Claude the specifics to work with. Neither alone is as effective as both together.
When Role Prompting Helps — and When to Skip It
Do and Don't
| Do | Don't |
|---|---|
| "You are a sceptical security auditor…" | "You are an expert who knows everything…" |
| "You are a patient tutor for a Python beginner…" | "You are a genius AI with no limitations…" |
| Ground the role in real expertise Claude can draw on | Use fictional or jailbreak-style personas — Claude will ignore them |
| Combine the role with a specific task and constraints | Expect a role alone to do all the work |
| Use roles to bundle attitude and vocabulary assumptions | Use roles to enforce formatting rules — use explicit constraints instead |
| Restate the role if the conversation runs long | Assume the role persists perfectly across many turns |