A system prompt is the top-level instruction that defines how an AI model behaves before the user ever types anything. It sets the assistant’s role, tone, rules, and output format, and it sits separate from the user message. Get it right and the model stays on track. Get it vague and you fight it every turn. Here is how to write one that works.
What a system prompt is
When you call an LLM, you send messages with roles. The user message is the request. The system prompt is the standing instruction that frames every reply. It tells the model who it is and how to respond, and it applies across the whole conversation rather than to a single question.
Keep the two separate. Put durable behavior in the system prompt: the persona, the rules, the format. Put the specific task in the user message. Mixing them makes prompts hard to reuse and easy to break.
The building blocks of a strong system prompt
A complete system prompt usually covers five things:
- Persona and role. Who the assistant is. “You are a senior SQL reviewer” beats “You are helpful.”
- Goal. What success looks like for the user, stated plainly.
- Constraints and what NOT to do. Hard limits. Say what to avoid as explicitly as what to do.
- Output format. Length, structure, JSON vs prose, headings, code blocks.
- Examples. One or two short input/output pairs that show the behavior you want.
Add edge-case handling for the situations that trip models up: what to do when input is missing, ambiguous, or out of scope. Telling the model to ask a clarifying question instead of guessing saves a lot of bad output.
Why specific instructions beat vague ones
Models follow concrete instructions far better than general ones. “Be concise” is interpreted a dozen ways. “Answer in three sentences or fewer, no preamble” is not. The same goes for tone: name it (“plain, direct, no marketing language”) rather than implying it.
Examples do more work than any adjective. Showing one good response teaches format, tone, and depth at once, because the model pattern-matches against it. When behavior matters, demonstrate it instead of describing it.
Stay concise anyway. The system prompt is sent on every request, so every word costs tokens and money. Cut filler, keep the rules that change behavior, and drop instructions the model already follows by default.
Write one with the System Prompt Generator
The fastest way to assemble all of this is the System Prompt Generator, which turns your inputs into a structured prompt you can paste straight into your app.
- Open the System Prompt Generator.
- Enter the persona and role for the assistant.
- Add the goal and the constraints, including what it should never do.
- Choose the output format and paste in one or two examples.
- Copy the generated prompt and drop it into your API call or chat tool.
Everything runs in your browser, so nothing you type is sent to a server.
Here is a minimal skeleton to start from:
You are [role]. Your goal is [goal].
Rules:
- [constraint]
- Never [thing to avoid]
Output format: [structure, length].
Example:
Input: [...]
Output: [...]
If the request is unclear, ask one clarifying question first.
Related tools
- Prompt Template Builder - turn a working prompt into a reusable template with variables.
- AI Rules Generator - write project rules files for AI coding assistants.
- LLM Token Counter - check how many tokens your system prompt costs per call.
Be specific, show an example, trim the rest, and the model will do what you asked.