System Prompts & Setting Behavior
A system prompt is the set-it-once instruction that tells an AI who it should be and how it should behave before the user types anything. It sets a persistent role, tone, and the rules the model follows on every turn.
Learn System Prompts & Setting Behavior in our free Prompt Engineering course — a beginner-friendly interactive lesson with worked examples, a practice…
Part of the free Prompt Engineering course at LearnCodingFast — hands-on lessons with examples you run in your browser, plus practice exercises and a quick quiz.
The user turn carries the changing request; the system prompt stays stable underneath it. This lesson shows you how to write system prompts that produce consistent, reliable behavior.
The system prompt sets durable behavior. The user turn is the specific, changing request. Keep the role in one and the question in the other:
Guardrails are rules that bound what the AI may do. Because system instructions generally outrank a conflicting user request , putting limits in the system prompt makes them stick:
No audience, tone, or limits, so behavior drifts.
Stability is what gives consistent behavior. Rewrite the rules every turn and the voice drifts. Freeze the system prompt and let the user request be the only thing that changes.
Fill that template once and reuse it; only the user turn underneath should change from request to request.
⏱ Test Yourself — Timed Quiz
10 quick questions, 12 seconds each. Instant feedback — beat the clock!
Practice quiz
What is a system prompt?
- A persistent instruction that sets the AI's role, tone, and rules before the user types anything
- The error message an AI shows
- A password for the AI
- The very last message in a chat
Answer: A persistent instruction that sets the AI's role, tone, and rules before the user types anything. The system prompt sets durable behavior and context that frames every user turn.
How does a system prompt differ from a normal user turn?
- They are identical
- The user turn never changes
- The system prompt sets persistent behavior; the user turn is the specific request that varies each time
- The system prompt is shorter by rule
Answer: The system prompt sets persistent behavior; the user turn is the specific request that varies each time. System prompts persist across the conversation; user turns carry the changing request.
Which belongs in a system prompt rather than a user turn?
- A one-off file to summarize
- The persistent role and tone, like 'You are a concise customer-support agent'
- A single math problem
- Today's specific question
Answer: The persistent role and tone, like 'You are a concise customer-support agent'. Durable role, tone, and rules belong in the system prompt; the changing task goes in the user turn.
Why keep the system prompt stable while user content varies?
- It makes the AI slower
- It is required by law
- It hides the answer
- Stable rules give consistent behavior across many different requests
Answer: Stable rules give consistent behavior across many different requests. A stable system prompt produces predictable, consistent behavior no matter what the user asks.
What does 'instruction priority' mean here?
- System/developer instructions generally outrank conflicting user requests
- Priority is random
- The longest message always wins
- The newest word wins
Answer: System/developer instructions generally outrank conflicting user requests. Higher-authority system instructions typically take precedence when they conflict with user input.
A guardrail in a system prompt is best described as…
- A faster model
- A rule that constrains what the AI may or may not do
- A type of font
- A decorative emoji
Answer: A rule that constrains what the AI may or may not do. Guardrails are constraints, like 'never give medical dosages,' that bound the AI's behavior.
Which is a STRONG system prompt opener?
- hello
- answer fast
- do stuff
- You are a friendly tutor for 5th graders. Explain simply, avoid jargon, and never give the full answer outright.
Answer: You are a friendly tutor for 5th graders. Explain simply, avoid jargon, and never give the full answer outright.. It sets a clear role, audience, tone, and an explicit constraint.
If the system prompt says 'always respond in Spanish' and a user writes in English, a well-behaved assistant…
- Refuses to answer
- Ignores both
- Follows the persistent system instruction and responds in Spanish
- Switches to English permanently
Answer: Follows the persistent system instruction and responds in Spanish. The persistent system rule governs behavior unless deliberately overridden.
A good reason to set tone in the system prompt is…
- There is no reason
- To make every reply match a consistent voice without repeating it each turn
- To slow the AI down
- To use more tokens
Answer: To make every reply match a consistent voice without repeating it each turn. Setting tone once keeps a consistent voice across the whole conversation.
Which is the BEST practice for system prompts?
- State the role, audience, tone, and a short list of clear constraints
- Change it on every single turn
- Cram every possible edge case into one giant vague paragraph
- Leave it blank and hope
Answer: State the role, audience, tone, and a short list of clear constraints. Clear role, audience, tone, and concise constraints make behavior reliable.