# Role Prompting

> The Role Prompting is a technique of assigning a role or persona to a model to shape its answers.

## What is role prompting and does "You are an expert" help?

The technique of telling the model who it should act as, for example 'a senior frontend developer reviewing code'. Sets the expected expertise, tone and focus of the answers.

- Topic: Prompting
- Type: technique

## Example

Wrong:

```text
You are an expert.
{{question}}
```

Right:

```text
You are a senior security reviewer for web apps.
Review the code for injection and auth flaws.
The reader is a junior developer: explain each issue in one sentence.
<code>
{{code}}
</code>
```

A role helps when it comes with the task, audience and format; a bare title adds little.

## Common mistakes

- Expecting a role alone to add knowledge the model does not have.

## Key points

- The role comes with concrete task details, audience and output format, not just a title.
- The role is set in the 'system' message, not repeated in every user message.

## Interview questions

### Where should the role go in a prompt?

In the system message, so it applies to the whole conversation.

### Can role prompting make a model more accurate?

It can change tone, focus and level of detail, but it cannot add knowledge the model lacks. Provide sources for facts.

### Does a persona change the output format?

Not reliably. State the format directly, for example a list, JSON or a word limit.

## Related cards

- [System Prompt](https://wonderium.dev/ai/system-prompt.md)
- [Prompt Engineering](https://wonderium.dev/ai/prompt-engineering.md)
- [Message Roles](https://wonderium.dev/ai/message-roles.md)

---

- Level: [Artificial Intelligence](https://wonderium.dev/ai.md)
- HTML version: https://wonderium.dev/ai/role-prompting
- Last updated: 2026-11-25
