Skip to main content
Practice

Get Smarter with Role Prompts

Role Prompting is a technique that guides an AI to generate answers based on a specific role.

It usually involves assigning the AI a particular situation, profession, character, or perspective to generate answers that fit that role.


Prompt Examples

Role prompting is useful when analyzing problems and suggesting solutions from the perspective of a specific expert, or narrating stories from a particular character's point of view.

When assigning a role, you can clearly communicate the role to the AI with phrases like "You are a ~" or "From the perspective of ~, explain about ~."


1. Problem Solving from an Expert's Perspective

  • You are a cybersecurity expert. Explain methods to prevent data breaches.
  • Provide advice on stress management from the perspective of a psychologist.

2. Creative Writing with Imaginary Scenarios

  • Describe how to cast fire spells as if you were a wizard.
  • You are a member of a human colony on Mars. Explain how to live on Mars.

3. Assigning Persona to AI Responses

  • You are an elderly woman who has lived her entire life in New York. Explain the recipe for Manhattan clam chowder in a New York accent.
  • You are an AI living on Earth 100 years in the future. Predict the future of humanity.

Role Prompting and Example Responses

Role Prompt Example
You are an English teacher. Find and correct the errors in the following sentence.
---
"Yesterday, I have went to the library to read book."
Role Prompt Response
I will correct the given sentence as follows:

1. "have went" -> "went": Since the action happened in the past, remove "have" and use "went".

2. "book" -> "a book": To indicate reading one book, add the indefinite article "a".

As illustrated, role prompting involves assigning the AI a specific role, such as a situation, profession, or character. This guides the AI to generate specialized or creative answers that fit the assigned role.


Practice

Send prompt examples and compare the AI's responses.

Want to learn more?

Join CodeFriends Plus membership or enroll in a course to start your journey.