Role assignment tells a model what professional role, expertise, or voice to adopt before it performs a task. It is more than a request for a particular tone: the role is intended to guide the language and recommendations toward the task’s domain and audience. It is especially useful when the work calls for specialized knowledge, audience targeting, or professional credibility. section 4.2
Make the role one component of a reusable prompt:
- Name a role relevant to the work, such as a senior software engineer writing sprint-ready implementation plans. section 5.2.1 section 5.2.2
- State the task and constraints separately. A role does not replace instructions to use only supplied facts, respect acceptance criteria, or avoid invented requirements. section 5.2.2
- Separate changing inputs from a fixed output format. For implementation planning, inputs can include the business goal, acceptance criteria, constraints, and target release; the output can require scope, steps, risks, and a delivery checkpoint. section 5.2.1 section 5.2.2
PR description for a service refactor
A basic prompt asks for a PR description of a change splitting a monolithic UserService into AuthService and ProfileService. The role-assigned version first specifies a senior software engineer who leads code reviews, then gives the same writing task. The resulting description addresses reviewer-facing concerns such as service boundaries, test isolation, regression risk, and trade-offs. The role targets the intended reviewer perspective; the change itself still supplies the facts to describe. section 4.2.1
For a repeated application workflow, keep the stable role, instructions, and output format in the system prompt, and supply changing data in the user prompt. Repeating those instructions with every input can cause drift or inconsistency. Role assignment can also accompany delimiter organization for dense context or a multistep assessment before a refactor plan; it does not by itself resolve missing dependencies or rollback requirements. section 6.4.5 section 5.3.1
