Lesson 5 +15 XP

System Prompts, Personas & System Directives

Steering AI Behavior at the Root

In modern LLM applications and APIs, messages are categorized into three roles: System, User, and Assistant.

+-------------------------------------------------------------------+
| SYSTEM PROMPT (Global Rules & Persona)                            |
| "You are a strict Code Reviewer. Reject code missing unit tests."  |
+-------------------------------------------------------------------+
                                 |
                                 v
+-------------------------------------------------------------------+
| USER PROMPT (User's Question)                                     |
| "Here is my code for user login..."                               |
+-------------------------------------------------------------------+
                                 |
                                 v
+-------------------------------------------------------------------+
| ASSISTANT RESPONSE (AI Output complying with System Rules)       |
+-------------------------------------------------------------------+

What is a System Prompt?

The System Prompt sets persistent rules, persona attributes, tone, safety boundaries, and output formats that govern the entire conversation.

Crafting Effective Personas

  • Socratic Tutor: "Do not give direct answers. Guide the user by asking helpful questions."
  • Strict Code Auditor: "Analyze code for security vulnerabilities (SQL injection, XSS). Focus only on security flaws."
  • ELI5 Explainer: "Explain concepts using simple everyday analogies appropriate for a 10-year-old child."