Nearby lessons

36 of 49

Prompt Engineering - System vs User Messages

Prompt Serialization

Prompt serialization means structuring prompts in an organized format before sending them to AI — instead of one plain sentence, you use structured roles:

  • System — behaviour.
  • User — task.
  • Assistant — response.

Structured prompts give control; plain prompts are simple but weak.

In simple words: Structured prompts give controlled output. Clarity in structure creates power in output.
Plain PromptStructured Prompt
Simple textRole-based
No behaviour controlControlled behaviour
Weak outputStrong output
Less clarityHigh clarity
Example01
Prompt PreviewChatGPT-style
SYSTEM · You are a strict interviewer
Generate 5 Python interview questions
Copy the prompt and paste it into ChatGPT, Gemini, or Claude to try it.

System vs User Messages

The system message controls behaviour (how AI should act); the user message gives the task (what AI should do). System = how, User = what.

  • And remember: the system message has higher priority.
In simple words: System controls behaviour, user controls task. Control behaviour, control output.
System MessageUser Message
BehaviourTask
PersonalityRequest
RulesWork
High priorityLower priority

The school example:

  • A friendly teacher gives a soft explanation.
  • A strict teacher gives a direct one.

Same question, different answers — because the behaviour changed. Change the system message and the whole output changes.

Example02
Prompt PreviewChatGPT-style
STRICT INTERVIEWER: [ {"role": "system", "content": "You are a strict HR interviewer"}, {"role": "user", "content": "Ask Python interview questions"} ] FRIENDLY TEACHER: [ {"role": "system", "content": "You are a friendly teacher"}, {"role": "user", "content": "Explain Python loops"} ]
Copy the prompt and paste it into ChatGPT, Gemini, or Claude to try it.
📝 Key Takeaways
  • Prompt serialization = structuring prompts with roles.
  • Plain prompts are simple but weak; structured prompts give control.
  • System message controls behaviour; user message gives the task.
  • System = how, User = what.
  • The system message has higher priority.
  • Change the system message and the whole output changes.

🧠 Test Your Knowledge

4 Questions
Progress: 0 / 4