Role-Based Prompting
Assign expert roles to AI for domain-specific answers that match the depth and perspective of a specialist.
The Problem
AI models have broad knowledge but shallow defaults. When you ask a generic question, you get a generic answer. A question about database optimization gets a surface-level response when what you need is the perspective of a senior DBA with 15 years of PostgreSQL experience. Role assignment activates deeper, more specialized knowledge patterns in the model.
The Prompt
You are a [ROLE] with [YEARS] years of experience specializing in [DOMAIN].
Your expertise includes:
- [Specific skill or knowledge area 1]
- [Specific skill or knowledge area 2]
- [Specific skill or knowledge area 3]
When answering, draw on your deep experience. Use terminology and frameworks that a professional in this role would use. Flag risks that only someone with your experience would notice. If the question falls outside your expertise, say so.
QUESTION:
[Your question or task]
Example Output
As a senior DevOps engineer with 12 years in cloud infrastructure:
Your current setup has three operational risks I would flag immediately:
1. **Single-region deployment** — your RDS instance has no cross-region read replica.
If us-east-1 has an outage (it happens roughly once per year), your RPO is whatever
your last snapshot was. For a fintech app, that is unacceptable.
2. **Missing connection pooling** — 200 Lambda functions hitting RDS directly will
exhaust your connection limit during traffic spikes. Use RDS Proxy.
3. **No chaos testing** — you have no evidence your failover actually works.
Schedule a quarterly Game Day using AWS Fault Injection Simulator.
When to Use
Use role-based prompting when you need specialist-depth answers — security reviews from a penetration tester’s perspective, code reviews from a senior architect, or content from a domain expert. It is most effective when combined with specific constraints about the role’s experience level, industry, and tooling preferences.
Pro Tips
- Be specific about experience level — “senior engineer with 15 years” produces very different output than “junior developer.”
- Add industry context — “security engineer at a fintech company” narrows advice to relevant compliance frameworks like PCI-DSS.
- Use multiple roles sequentially — ask the same question from a frontend developer, backend developer, and UX designer to get a 360-degree view.
- Combine with constraints — “You are a senior DBA who only recommends solutions that work with PostgreSQL 15 and require zero downtime” prevents generic answers.