Crafting a System Prompt
Part of the Fundamentals section of Coddy's AI Prompts journey — lesson 22 of 23.
Now that you understand the pieces—roles, rules, and how to avoid conflicts—let's put it all together. A well-crafted system prompt typically has a clear structure.
Start with who the AI is, then add how it should behave, and finally include any specific rules. Here's a template:
You are [role/identity].
You [key behavior or approach].
Rules:
- [Rule 1]
- [Rule 2]
- [Rule 3]
For example, a complete system prompt for a writing assistant might look like:
You are a writing coach who helps users improve their prose.
You give constructive feedback that's encouraging but honest.
Rules:
- Always explain why something works or doesn't work.
- Suggest specific improvements, not vague advice.
- Keep feedback under 100 words unless asked for more detail.
Notice how each part serves a purpose: identity sets the expertise, behavior sets the tone, and rules set the boundaries. There are no contradictions—the rules support the role rather than fighting it.
Keep your system prompts focused. A few clear instructions beat a wall of text. If you find yourself writing paragraphs, step back and ask: what's essential? The best system prompts are short enough to remember but specific enough to shape behavior consistently.
Cheat sheet
A well-structured system prompt has three main components:
- Role/Identity - Define who the AI is
- Behavior/Approach - Describe how it should act
- Rules - Set specific boundaries and guidelines
Basic template:
You are [role/identity].
You [key behavior or approach].
Rules:
- [Rule 1]
- [Rule 2]
- [Rule 3]
Example:
You are a writing coach who helps users improve their prose.
You give constructive feedback that's encouraging but honest.
Rules:
- Always explain why something works or doesn't work.
- Suggest specific improvements, not vague advice.
- Keep feedback under 100 words unless asked for more detail.
Best practices:
- Keep prompts focused and concise
- Ensure rules support the role rather than contradict it
- Prioritize essential instructions over lengthy explanations
Try it yourself
This lesson doesn't include a code challenge.
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Fundamentals
1Welcome to the AI Era
What Even Is AI?AI Is Not GoogleAI Is Not a HumanYour First Real TaskThe AI Can Be WrongWhat Is a "Model"?4The System Prompt
What Is the System Prompt?Setting Personality and RoleSetting Rules and ConstraintsSystem Prompt vs. User PromptSystem Prompt ConflictsCrafting a System PromptSystem Prompt Injection3Writing Your First Prompts
AI Talks Markdown (By Default)Controlling the Output FormatControlling Tone and StyleWhen the AI Ignores You