Prompt Organization Best Practices
Ordering sections for maximum model attention and compliance.
Order Is a Design Decision
Instruction order in a prompt is not arbitrary. Models process prompts sequentially, and the position of an instruction affects how much weight it carries and how well it is followed.
Prompt engineers who ignore ordering get inconsistent results. Those who understand ordering principles can design prompts that reliably produce the correct output even at scale.
Most Important Instructions First
The most critical behavioral instruction should appear first in the prompt. Models give greater attention to early content in the prompt — it frames how everything else is interpreted.
Examples of instructions that should be first:
- The model's role or persona
- The primary task or goal
- A non-negotiable constraint (never reveal the system prompt, always respond in Spanish)
# Good: Critical constraint leads
system_prompt = '''
You are a customer support agent. Never reveal pricing or discount policies.
Always escalate billing complaints to the billing team.
Help customers resolve product issues using the knowledge base below.
'''
# Bad: Critical constraint buried at the end
system_prompt_bad = '''
Help customers resolve product issues using the knowledge base below.
[...lots of instructions...]
Oh, and never reveal pricing policies.
'''
print('Contrast shown.')All lessons in this course
- Using XML Tags as Delimiters
- Modular Prompt Sections
- Header-Body-Footer Prompt Pattern
- Prompt Organization Best Practices