Prompt Engineering: Message Types
Prompt Engineering: Types of Messages — System, User, AI (Assistant)
Understand how System, User, and Assistant messages work together. Learn their purpose, structure, and best practices with realistic examples and ready-to-use templates.
Introduction
System, User, and Assistant messages form the conversation contract for large language models. Each role has a distinct responsibility that shapes the behavior and quality of the final answer.
- System: Defines role/persona, tone, boundaries, and global formatting or safety rules.
- User: States the concrete task, inputs, constraints, and success criteria.
- Assistant: Produces the response that follows both System and User guidance.
Message Structure & Syntax
[
{"role": "system", "content": "You are a precise technical author. Use step-by-step structure and examples."},
{"role": "user", "content": "Explain Python lists with syntax, examples, and a small exercise."},
{"role": "assistant", "content": "(model will generate this response based on the above messages)"}
]
| Role | Purpose | What to include | What to avoid |
|---|---|---|---|
| System | Define persona, tone, boundaries, output format. | Role, audience, constraints, safety, style, formatting. | Task-specific details that belong in User; ambiguous goals. |
| User | Provide the actual task, inputs, constraints, success criteria. | Goal, context, examples, data, required sections, acceptance tests. | Vague asks; mixing global policies better set in System. |
| Assistant | Produce the answer consistent with System + User. | Clear structure, accurate content, follow constraints faithfully. | Ignoring system rules; drifting tone; unsafe/unrequested content. |
Examples
[
{"role":"system","content":"You are a helpful technical author for ItTechGenie. Use human tone, short paragraphs, and include Syntax, Example, Explanation, Notes, Practice, Summary. Output as a single HTML page only."},
{"role":"user","content":"Topic: Python Lists. Include a TOC with anchors and two examples with outputs. Avoid hype and keep it practical."}
]
[
{"role":"system","content":"You are a friendly AI career coach. Encourage confidence and provide actionable steps. Avoid making up statistics."},
{"role":"user","content":"Give me tips to transition from QA to prompt engineering. Include 3 suggested projects."}
]
[
{"role":"system","content":"You are a compliance assistant. Only answer using the provided policy text. Respond with 'I do not have that information' if the policy does not cover it."},
{"role":"user","content":"Is it acceptable to store customer passwords in plaintext according to our policy excerpt?"},
{"role":"assistant","content":"(model should respond using policy rules or decline)."}
]
How the Roles Interact
The System message sets the tone and global instructions. The User message asks the question or task. The Assistant must respect both, balancing creativity with compliance.
- System overrides any conflicting User request.
- User clarifies the specific problem to solve.
- Assistant applies reasoning, knowledge, and formatting.
Real-World Use Cases
- Customer support bots: Use System messages for tone, escalation rules, compliance disclaimers.
- Internal knowledge assistants: System defines reference sources; User message includes the question and relevant document IDs.
- Educational tutors: System establishes teaching style; User message describes the lesson topic and student level.
Key Notes / Tips
- Keep System instructions short but specific.
- Use bullet lists in User prompts to highlight must-have outputs.
- Document repeated instructions in a shared System template.
- Review assistant responses regularly to refine prompts.
Practice Exercise
Create a System message for a legal drafting assistant. Then craft a User message asking for a contract clause. Compare outputs with and without the System instructions.
Summary
Understanding the three message types lets you control tone, accuracy, and safety. Use System for global rules, User for the task, and expect the Assistant to deliver on both.
Copy-Paste Templates
{"role":"system","content":"You are a senior technical writer. Use numbered steps, highlight warnings, and end with a checklist."}
{"role":"system","content":"You are a playful creative partner. Offer 5 distinct ideas, each with a title and 2 bullet points."}
Quality Checklist
- System instructions written?
- User task clear and scoped?
- Assistant response follows both?
- Any contradictions resolved?
FAQ
Q: Can I have multiple System messages?
A: Yes, but most APIs combine them into a single context block. Keep instructions consistent.
Q: What if the Assistant ignores the System message?
A: Revise the instructions to be more explicit or break tasks into smaller steps.