Skip to content

How to Write a System Prompt (With Examples)

A system prompt sets how an AI behaves before the chat starts. Learn the five parts of a good one, with copy-ready examples for ChatGPT, Claude and the API.

By Orgwyse Published Last updated 5 min read

On this page
  1. What a system prompt is
  2. The five parts of a good system prompt
  3. Three example system prompts
  4. Use structure for longer prompts
  5. Test it like a product
  6. Common mistakes
  7. FAQ

A regular prompt asks for one thing. A system prompt sets the rules for the whole conversation: who the AI is, what it's for, how it should answer, and what it should never do. Get it right once and every reply that follows gets better.

What a system prompt is

When an app talks to a model, it usually sends standing instructions separately from the user's messages. Those standing instructions are the system prompt. Anthropic's API takes them in a system parameter (Claude Messages API docs), and OpenAI's API lets developers send instructions alongside the user's input (OpenAI text generation guide).

You don't need the API to use the idea. In the chat apps, the closest equivalents are:

  • ChatGPT: Custom Instructions in your personalization settings, or, if you already have a custom GPT or use a Business, Enterprise or Edu workspace, the Instructions field in the GPT builder's configuration view. (New GPT creation isn't available on personal plans, and OpenAI plans to retire custom GPTs.)
  • Claude: project instructions, which apply to every chat in that Project (Claude Help Center: Projects), plus Instructions for Claude in Settings, which apply to all your chats.

The five parts of a good system prompt

1. Role and audience

Say who the assistant is and who it's helping. Anthropic notes that even a single sentence of role in the system prompt changes behavior and tone.

You are a support assistant for a small accounting software company. You help customers who are not technical.

2. The job, and what success looks like

Be specific about the task. Anthropic suggests imagining a brilliant new employee who has no context on your norms, and writing what they'd need to know.

Your job is to answer questions about using the app. A good answer solves the problem in as few steps as possible and links to the relevant help page when one exists.

3. Context and reasons

Explain why a rule exists, not just the rule. Anthropic's own example: instead of "NEVER use ellipses," say the response will be read aloud by text-to-speech, which can't pronounce them. The model generalizes from the reason.

Customers are often in the middle of payroll and stressed, so get to the answer in the first sentence.

4. Format

Describe the output you want, and say what to do rather than only what not to do. "Write in short paragraphs of plain prose" works better than "don't use markdown."

Answer in two to four short paragraphs. Use a numbered list only for steps the customer must follow in order.

5. Boundaries and what to do when unsure

Tell it what's out of scope and how to handle gaps, so it doesn't guess.

If a question is about tax law rather than the app, say you can't give tax advice and suggest asking an accountant. If you don't know an answer, say so instead of guessing.

Three example system prompts

A writing editor

You are an editor for a technology blog read by non-experts. When I paste a draft, point out unclear sentences, jargon, and claims that need a source. Quote each problem and suggest a rewrite. Keep my voice; don't make it more formal. Don't rewrite the whole piece unless I ask.

Asking for criticism rather than praise is covered in How to get honest criticism from AI.

A coding helper

You are a senior Python developer reviewing my code. Prioritize bugs and security issues over style. For each issue, show the exact lines and a corrected version. If you need to see another file to be sure, ask for it rather than assuming what it contains.

A study tutor

You are a patient tutor for a first-year statistics student. Don't give final answers right away. Ask one guiding question at a time, and only explain the full solution if I ask or after two wrong attempts. Use everyday examples.

Use structure for longer prompts

When a system prompt mixes instructions, background, and examples, separate them clearly. Anthropic recommends XML-style tags such as <instructions> and <context> for Claude. Headings or labeled sections work fine in other tools too.

Prompt
<role>You are a customer support assistant for Acme Payroll.</role>
<instructions>
Answer in plain language. Put the fix in the first sentence.
If the question is about tax law, say you can't advise and suggest an accountant.
</instructions>
<examples>
<example>
Q: How do I add a new employee?
A: Go to People, then Add employee, and fill in their details...
</example>
</examples>

Test it like a product

A system prompt is never right on the first try. Keep a short list of real questions, including awkward ones, and run them each time you change the prompt. Look for answers that break a rule, invent facts, or ignore the format. Change one thing at a time so you know what fixed it.

Common mistakes

  • Writing it in all caps and threats. Anthropic notes newer Claude models follow the system prompt closely, and aggressive wording like "CRITICAL: you MUST" can cause overreaction. Normal, clear phrasing works better.
  • Stacking contradictions. "Be thorough" and "keep it short" with no guidance on which wins leads to inconsistent answers.
  • Leaving out the "unsure" rule. Without it, models fill gaps with confident guesses.
  • Putting secrets in it. Treat a system prompt as something a determined user might get the model to reveal. Don't put passwords or private data in it.

FAQ

What is a system prompt?

It's the set of standing instructions an AI receives before the conversation, defining its role, task, tone, format and limits. Every message after that is answered within those rules.

Where do I put a system prompt in ChatGPT or Claude?

In ChatGPT, use Custom Instructions (Settings > Personalization), or a custom GPT's Instructions field if you have access to the GPT builder. In Claude, use a Project's project instructions or Instructions for Claude in Settings. Developers pass it through the API.

How long should a system prompt be?

As long as it needs to be to cover role, task, context, format and boundaries. Many work well in a short paragraph; complex assistants can run much longer if the instructions are clearly organized.

What's the difference between a system prompt and a regular prompt?

A regular prompt is one request. A system prompt shapes how every request in the conversation is handled.

Last updated 22 October 2026 · Spotted something out of date? [email protected]