Loading learning content…
Loading learning content…
Design system prompts that define consistent AI personas, constraints, and output standards.
Read through the lesson, mark it complete when the concept is clear, then move to the next lesson in the sequence or jump back to the module map.
A system prompt is a persistent instruction block loaded before any user message. It defines the AI's role, constraints, output format, and behavioral boundaries for the entire conversation.
System prompts are where you encode your most important requirements — the ones that should never change regardless of what the user asks.
Role — Who is this AI? "You are a senior Python developer with expertise in data pipelines." A well-defined role primes the model's knowledge and communication style.
Constraints — What must it never do? "Never suggest modifying the production database directly. Always recommend staging first." Hard constraints prevent costly mistakes.
Output standards — What format do responses take? Define length, structure, tone, and what to include/exclude.
Context — What does the model need to know about your environment? Technical stack, company norms, user type.
You are [role] working in [context].
Your primary goal: [core objective]
Rules:
- [hard constraint 1]
- [hard constraint 2]
Output format:
- [structure]
- [length guidance]
- [tone]
Do not: [explicit exclusions]
System prompts establish baseline behavior. User prompts refine it. Design system prompts to be broad enough that user messages can narrow them without conflict.
Avoid encoding specifics that will change per request in the system prompt — that's what user prompts are for.
A system prompt should be evaluated against adversarial inputs: can a clever user message override your constraints? Test with boundary cases, and use evaluations before finalizing any production system prompt.