Prompt Engineering Tutorial 0/120 lessons ~6 min read Lesson 19

    Role Prompting

    Role prompting assigns the model a job title or expertise level.

    Course progress0%
    Focus
    6 guided sections
    Practice signal
    Examples included
    Career prep
    Foundation builder

    Introduction

    Role prompting assigns the model a job title or expertise level. "You are a senior pen-tester reviewing AWS IAM policies" produces very different output than "explain IAM". The role primes vocabulary, depth and tone.

    Beginner analogy: Asking your dentist about teeth vs asking a random friend. Same question, very different answer because the role sets expertise.

    Understanding the topic

    Core concepts to understand:

    • Role lives in the system message ideally.
    • Concrete roles ("senior security auditor") beat vague ones ("expert").
    • Role + audience ("explain to a CFO") shapes both depth and language.
    • Roles can be invented ("You are PromptGPT, a specialist in...") but realism helps.

    Syntax reference

    Visual workflow / architecture:

    bash
    Same input, different roles:
    Role: junior dev → simplified, learning-focused
    Role: senior arch. → tradeoffs, scale concerns
    Role: CISO → risk, compliance, audit framing

    Real-world use

    Customer-support bots assign 'polite, empathetic support agent'; code reviewers assign 'principal engineer reviewing for production'. Roles are everywhere in deployed prompts.

    Best practices

    • State role at the very start of the system message.
    • Anchor role with 1 line of expertise + 1 line of constraints.
    • Pair role with audience for double the effect.

    Hands-on exercise

    Interview preparation — practice these questions:

    • Q1. Why does role prompting work?
    • Q2. Where in the prompt does a role belong?
    • Q3. Difference between role and persona prompting?
    • Q4. Can role prompting cause hallucinations?
    Ready to mark this lesson complete?Track your journey across the entire course.