AiTechWorlds
AiTechWorlds
Role based prompting is the technique of assigning an AI model a specific persona job title, experience level, and specialization to shift its output toward that expert's vocabulary and reasoning style.
Think of asking the same medical question to a general practitioner versus a specialist surgeon: same underlying facts, but the depth, vocabulary, and framing differ sharply. A large language model does the same thing internally without a role, it defaults to "helpful generalist," averaging across everything it was trained on. Assigning a role narrows that average down to a focused expert.
Without a role, the model responds as "a helpful AI assistant" which means it averages across all the training data it has. That averaging produces safe, generic responses.
With a specific role, the model channels a focused cluster of knowledge and communication style. The same question asked of "a cardiologist" versus "a personal trainer" will get meaningfully different answers even about the same topic.
The most effective roles have three components:
1. Job title or expertise domain 2. Years or level of experience 3. Specific quality or specialization
Basic role: "You are a developer"
Effective role: "You are a senior Python developer with 10 years
of experience building production-grade web APIs. You write clean,
well-documented code and always consider edge cases and security implications."Here are roles that consistently produce exceptional results:
For code:
"You are a staff-level software engineer at a top tech company.
You write clean, efficient code with proper error handling, type hints,
and docstrings. You explain your architectural decisions clearly."For writing:
"You are an award-winning journalist who writes for The Atlantic.
Your writing is precise, engaging, evidence-based, and avoids
clichés. You make complex topics accessible without dumbing them down."For analysis:
"You are a McKinsey-trained management consultant with expertise
in data analysis. You structure problems using MECE frameworks,
back every claim with data, and always provide actionable recommendations."For teaching:
"You are a master teacher who specializes in explaining difficult
concepts to beginners. You use the Feynman technique — first-principles
explanations, real-world analogies, and concrete examples before abstraction."For marketing:
"You are a direct-response copywriter who has written campaigns
for 200+ SaaS products. You understand customer psychology, write
benefit-focused copy, and create urgency without resorting to hype."For complex tasks, you can assign multiple perspectives:
"First, as a skeptical investor, identify the three biggest risks
in this business plan. Then, as a startup founder, suggest how
each risk could be mitigated. Finally, as a neutral advisor,
give your overall assessment."This technique generates balanced, multi perspective analysis that a single role wouldn't produce.
Specifying both the AI's role AND who it's speaking to dramatically improves relevance:
"You are a cybersecurity expert. Explain SQL injection vulnerabilities
to [audience]."
Audience options:
- "...to a non-technical CEO who needs to understand business risk"
- "...to a junior developer who is building their first web app"
- "...to a security auditor preparing a compliance report"Each audience spec produces a fundamentally different response even with identical role and topic.
Avoid vague roles: "You are an expert" expert in what? At what level? For what audience?
Avoid impossible roles: "You are a time traveler from 2050" adds no useful knowledge cluster.
Don't change roles mid conversation: If you assigned a role at the start, maintain it. Role switching creates inconsistency.
Take one of your most common AI tasks this week and create three different role based prompts for it. Compare the outputs. Notice specifically how:
You'll find one role produces dramatically better results than the others. That's the role to keep in your prompt library for that task.
Next lesson: Chain of Thought Prompting how to force the AI to reason step by step before answering.
Get this course's notes on Telegram!
Free cheat sheets, summaries & practice exercises