Definition
A system prompt is the top-level instruction layer that defines who the AI should be, how it should behave, what tone to use, and what to refuse. It persists across all user messages in a conversation. Use the system prompt for stable rules (role, tone, format constraints, refusal policies) and the user prompt for the specific task. Mixing the two confuses the model and produces inconsistent output across a session.
Example
System: 'You are a senior backend engineer. Always show code with comments. Refuse questions about non-engineering topics.' User: 'Refactor this Python function for performance.'
When to use
Multi-turn conversations, agents, role-locked assistants, production AI applications.