Role Prompting: Prompt Engineering Lesson 3 - Make Claude Think Like Someone Else

What is Role Prompting?
Picture this: you ask Claude, “What do you think about skateboarding?”
Without role prompting, Claude might respond:
“Skateboarding is an extreme sport that originated in California in the 1960s…”
Accurate, sure. But it sounds like Wikipedia reading aloud.
With role prompting, you tell Claude: “You are a cat.” Then ask the same question, and Claude might say:
“Skateboarding? That thing is so noisy! Those humans rolling around on the streets keep waking me from my naps. And they don’t even walk on four legs like normal creatures…”
Now that’s got personality! This is the magic of role prompting—give Claude an identity, and its speaking style, perspective, and expression all transform.
Two Ways to Use Role Prompting
Method 1: Set the role in the system prompt. This is the most common approach—directly tell Claude who it is in the system prompt:
SYSTEM_PROMPT = "You are a cat."
PROMPT = "Describe skateboarding in one sentence."
# Claude's response instantly becomes "cat-like"
Method 2: Specify temporarily in the user message. Sometimes you don’t need Claude to play a role throughout the conversation—just a quick reminder before a specific question:
You are an experienced retired chef. Now tell me, how do I cook a great dish?
Both methods work. Choose based on your needs.
Real-World Examples
Example 1: Logic Puzzle Breakthrough
Here’s a puzzle: Jack is looking at Anne. Anne is looking at George. Jack is married, George is not, and we don’t know if Anne is married. Is a married person looking at an unmarried person?
Without role prompting, Claude might say: “This question lacks information about Anne’s marital status, so I cannot give a definitive answer.” It says it doesn’t know!
With the “logic bot” role: “The answer is yes. Because Jack is married and looking at Anne (regardless of Anne’s status, the condition is met).” It got it right! The reasoning might not be perfect, but the result is correct. This is the power of role prompting—switching identities changes the thinking approach entirely.
Example 2: Math Homework Helper
Sometimes Claude makes math mistakes, like this problem:
2x - 3 = 9
2x = 6
x = 3
Anyone can see step two is wrong. 2x - 3 = 9 should give 2x = 12. But Claude sometimes “pretends” not to notice and says “looks fine to me.” Tell it: “You are a strict math teacher who grades homework.” Claude instantly becomes an eagle-eyed grader and catches the error!
Three Benefits of Role Prompting
1. Style switching on demand: Want Claude to write humorously? Tell it “you’re a comedian.” Want rigorous code? Tell it “you’re a software architect.” Want simple explanations? Tell it “you’re an elementary school teacher.”
2. Boosted expertise: Let an accountant answer finance questions, a doctor answer health questions, a lawyer answer legal questions—the role’s professional background automatically influences Claude’s responses.
3. Lower communication barriers: Tell Claude “you’re a 10-year-old kid,” and it will use simpler vocabulary and shorter sentences that children can understand.
Advanced Technique: Include the Audience
Role prompting can be even more precise—not only tell Claude who it is, but also who it’s talking to. Compare: “You are a cat” vs “You are a cat talking to a group of skateboard enthusiasts.” In the second case, Claude’s response becomes more targeted, potentially critiquing skateboarding from a cat’s perspective.
Pro Tip: Practice Makes Perfect
What’s the most important thing in learning prompt engineering? Hands-on practice! Reading without doing gets you nowhere. Try some roles that interest you: make Claude your fitness coach, food critic, or travel guide. With different roles, you’ll find Claude transforms into a completely different entity.
Chapter Summary
Today we learned the essence of role prompting: give Claude an identity, and it will think and express itself in that identity’s way; role prompting can go in the system prompt or temporarily in user messages; the right role improves Claude’s performance across various tasks; you can also specify who Claude is talking to for more targeted responses.
Previous Lessons:
Next Up: In the next chapter, we’ll learn about separating data from instructions to make your prompts more structured.
Found this article helpful? Like and share to help more friends discover this tutorial. Share with your AI-learning buddies, and follow “Dream Beast Programming” for more AI programming tips. See you next time!