What does it mean to assign a role in a prompt?
Assigning a role means opening your prompt with an identity for the model to adopt — "You are an experienced pediatric nurse educator" or "Act as a staff software engineer reviewing a pull request." That single line shifts vocabulary, depth, tone, and what the model treats as important, because it conditions the response on how that kind of expert typically writes and reasons.
Role prompting is one of the most widely documented patterns in the DAIR.ai Prompt Engineering Guide and is recommended in both the OpenAI prompt engineering guide and the Anthropic prompt engineering overview. Anthropic specifically suggests setting the role in the system prompt and reserving the user turn for the task itself.
A role is not magic. It does not give the model knowledge it lacks, and it will not fix a vague task. It is a steering instruction: it tells a capable model which slice of its abilities to bring forward. The gains come when you make the role concrete and back it with constraints.