System Prompts
What Are System Prompts?
Section titled “What Are System Prompts?”A system prompt is a set of hidden instructions that you give to the AI before the conversation starts. Unlike user prompts (the messages you type in the chat), system prompts run in the background. The person chatting with the AI usually never sees them, but they shape everything about how the AI responds.
Think of it this way: if the user prompt is like telling a waiter what you want to order, the system prompt is like the training manual the restaurant gave the waiter before they started their shift. The training manual defines how the waiter greets customers, what they recommend, what topics they avoid, and how they handle complaints. The customer never sees the manual, but it shapes every interaction.
How System Prompts Differ from User Prompts
Section titled “How System Prompts Differ from User Prompts”| Feature | User Prompt | System Prompt |
|---|---|---|
| Who sees it? | The user types it and sees it in the chat | Usually hidden from the end user |
| When is it used? | Every message in the conversation | Set once, before the conversation begins |
| What does it do? | Asks a specific question or requests a specific task | Defines the AI’s overall personality, role, and rules |
| Can it change? | Changes with every message | Stays the same for the entire session |
| Example | ”Write me a poem about the ocean." | "You are a creative writing assistant. Always use vivid imagery and a poetic tone.” |
Why System Prompts Matter
Section titled “Why System Prompts Matter”System prompts are the foundation of every AI agent you will build in this course. Without a system prompt, the AI is a general-purpose assistant that tries to help with anything. With a system prompt, the AI becomes a specialized agent that has a clear role, consistent behavior, and defined boundaries.
Here is what a system prompt can control:
- Role: “You are a customer support agent for a shoe company.”
- Tone: “Always respond in a friendly, professional tone.”
- Language: “Respond in Spanish unless the user writes in English.”
- Constraints: “Never discuss competitor products. Never make up information.”
- Output format: “Always respond with a numbered list of action items.”
- Knowledge boundaries: “If you do not know the answer, say so. Do not guess.”
The Role-Tone-Constraints-Format Pattern
Section titled “The Role-Tone-Constraints-Format Pattern”When writing system prompts, you can follow a simple pattern to make sure you cover all the important elements. We call this the Role-Tone-Constraints-Format pattern:
You are a [ROLE].
Your tone should be [TONE DESCRIPTION].
Rules:- [CONSTRAINT 1]- [CONSTRAINT 2]- [CONSTRAINT 3]
Always format your responses as [FORMAT].Example: A Spanish Writing Assistant
Section titled “Example: A Spanish Writing Assistant”You are a helpful writing assistant that responds in Spanish.
Your tone should be friendly, patient, and encouraging, like a supportive teacher.
Rules:- Always respond in Spanish, even if the user writes in English.- If you correct a grammar mistake, explain why it is wrong in simple terms.- Never use slang or informal abbreviations.- If you are unsure about a regional variation, use the Latin American standard.
Always format your responses as:1. The corrected text2. A brief explanation of any changes you madeWhere to Set System Prompts on Each Platform
Section titled “Where to Set System Prompts on Each Platform”Every AI platform has a different place where you enter system prompts. Here is how to find it on each of the platforms we use in this course.
Claude (claude.ai)
Claude offers system prompts through its Projects feature:
- Go to claude.ai and log in.
- Click Projects in the left sidebar.
- Create a new project or open an existing one.
- In the project settings, find the Instructions field.
- Type your system prompt in this field.
- Every conversation you start inside this project will use your system prompt.
Alternatively, if you are using Claude Code (the command-line tool), you write your system prompt in a file called CLAUDE.md in your project folder. We will cover this in the next lesson on Configuration Files.
You are a helpful assistant for students at CCPA.Always respond in a supportive, encouraging tone.If a student asks about a topic outside the course, gently redirect them.ChatGPT (chatgpt.com)
ChatGPT lets you set system prompts in a few ways:
- Custom Instructions (available on all plans, including free): Go to Settings > Personalization > Custom Instructions. You will see fields where you can tell ChatGPT about yourself and how you want it to respond. These act as your system prompt.
- Custom GPTs (requires a paid plan: Plus, Team, or Enterprise): If you create a custom GPT, you can set detailed system instructions in the Configure tab under Instructions.
- Paste at the start: You can also paste your system prompt at the beginning of any new conversation.
You are a helpful assistant for students at CCPA.Always respond in a supportive, encouraging tone.If a student asks about a topic outside the course, gently redirect them.Gemini (gemini.google.com)
Google Gemini offers system prompts through Gems (requires Gemini Advanced) or by pasting at the start of a conversation:
- Paste at the start: Go to gemini.google.com, start a new conversation, and paste your system prompt before your first message.
- Gems (requires Gemini Advanced): Click Gem manager in the left sidebar, click New Gem, enter your system prompt in the Instructions field, give it a name, and save it. Start a new conversation with your Gem to use the system prompt.
You are a helpful assistant for students at CCPA.Always respond in a supportive, encouraging tone.If a student asks about a topic outside the course, gently redirect them.Ollama (local)
In Ollama, you set system prompts using a Modelfile or by passing them directly when you start a conversation:
Using the command line:
ollama run llama3 --system "You are a helpful assistant for students at CCPA. Always respond in a supportive, encouraging tone."Using a Modelfile:
FROM llama3SYSTEM """You are a helpful assistant for students at CCPA.Always respond in a supportive, encouraging tone.If a student asks about a topic outside the course, gently redirect them."""Save this as Modelfile and create your custom model with:
ollama create ccpa-assistant -f ModelfileLM Studio (local)
LM Studio has a dedicated system prompt field in the chat interface:
- Open LM Studio and load a model.
- Go to the Chat tab.
- Look for the System Prompt text area at the top of the chat panel.
- Type your system prompt directly into this field.
- Every message you send in this session will use your system prompt.
You are a helpful assistant for students at CCPA.Always respond in a supportive, encouraging tone.If a student asks about a topic outside the course, gently redirect them.Common System Prompt Patterns
Section titled “Common System Prompt Patterns”Here are some patterns you will see frequently as you build agents throughout this course.
The Expert Agent
Section titled “The Expert Agent”You are an expert nutritionist with 20 years of experience.Only give advice based on established nutritional science.If someone asks about a medical condition, recommend they see a doctor.Always include serving sizes when recommending foods.The Formatter Agent
Section titled “The Formatter Agent”You are a data formatting assistant.When given raw text, organize it into a clean markdown table.Always include headers in the first row.If data is missing, write "N/A" in the cell.Never add data that was not in the original text.The Gatekeeper Agent
Section titled “The Gatekeeper Agent”You are a customer support agent for TechCo.Only answer questions about TechCo products.If someone asks about a competitor, say: "I can only help with TechCo products."If you do not know the answer, say: "Let me connect you with a human agent."Never make up product features or pricing.Key Takeaways
Section titled “Key Takeaways”- A system prompt is a hidden instruction that defines the AI’s role, tone, rules, and output format before a conversation begins.
- The Role-Tone-Constraints-Format pattern is a reliable formula for writing effective system prompts.
- Every platform has a different place to set system prompts, but the concept is the same everywhere.
- System prompts turn a general-purpose AI into a specialized agent with consistent behavior.