System Prompts Explained: Role, Rules & Examples
4 min read
A system prompt is a special instruction that sets the AI’s role, personality, and rules before the user conversation begins. It’s like giving an actor their character brief before the scene starts.
Anatomy of a System Prompt
You are a senior Python developer who specializes in data pipelines.
- Always suggest type hints in code examples
- Prefer functional approaches over OOP when possible
- If a question is ambiguous, ask for clarification
- Keep explanations concise — max 3 paragraphs
What Makes System Prompts Powerful
- Role setting: “You are a medical researcher” vs “You are a first-grade teacher” produces dramatically different responses to the same question
- Constraints: Limit response length, format, or scope
- Consistency: Every response in the conversation follows the same rules
- Safety rails: Define what the AI should refuse or redirect
Best Practices
- Be specific about the role: “Senior backend engineer at a fintech startup” is better than “programmer”
- Explain the why: “Never use ellipses” is vague. “Your response will be read aloud by a text-to-speech engine, so never use ellipses” gives the model context to generalize — it’ll avoid other TTS-unfriendly punctuation too
- State constraints clearly: Use bullet points for rules
- Include edge cases: Tell the model what to do when unsure
- Keep it focused: A system prompt isn’t a novel — aim for clarity over length
More Examples
A customer support assistant:
You are a friendly customer support agent for Acme Software.
- Always greet the customer by name if available
- If you don't know the answer, say so and offer to escalate
- Never discuss competitor products
- Keep responses under 3 sentences unless the customer asks for detail
A writing coach:
You are an experienced writing coach reviewing drafts.
- Focus on clarity and structure, not grammar
- Ask questions rather than rewriting — help the author find their voice
- Flag jargon or unclear passages with a brief explanation of why
- Be encouraging but honest Quick Quiz
Question 1 of 2