How to define roles in a prompt

What telling the AI “act as…” really does, how to choose a good role, combine it with concrete criteria and avoid roles that do not help.

Starting a prompt with “act as…” is one of the best-known techniques. Used well, it steers the vocabulary, level of detail and criteria of the answer.

What a role does

A role tells the AI which perspective to answer from. “Act as a sports nutritionist” makes the answer prioritize certain concepts, use specific vocabulary and structure information the way that professional would.

How to write a good role

A useful role is specific and relevant to the task:

  • Not very useful: “You are an expert.”
  • Better: “You are an employment lawyer.”
  • Even better: “You are an employment lawyer who explains rights to workers with no legal background.”

The last version includes the audience, which changes the tone and depth of the explanation.

Role + criteria

A role alone is not enough. Combine it with the criteria that expert would apply:

Act as a senior code reviewer. Review this code prioritizing,
in this order: security bugs, logic bugs, performance and
readability. For each issue state its severity and the fix.

Multiple roles

You can ask for several perspectives on the same topic: “Analyze this proposal first as a CFO and then as a customer service lead. Point out where their priorities clash.”

Mistakes to avoid

  • Roles that promise the impossible: “you are a doctor and you diagnose me” does not make the AI a doctor. For health, law or finance, the AI can help you understand and prepare questions, not replace a professional.
  • Real people: asking the AI to “be” a specific person can produce invented answers attributed to them.
  • Decorative roles: if the role does not change the task, drop it.

Practice with the Role field of the prompt builder.

Learn prompting