Artificial Intelligence (AI)

What Is a System Prompt? How to Write One for a Site Chatbot or Internal Assistant

A risograph print in teal, warm red and yellow ink of a bowling lane seen low from just behind a resting ball, with padded bumper rails raised along both gutters and ten pins waiting at the far end, a visual for a system prompt, the standing instructions that keep an AI chatbot in its lane without acting as a hard barrier

A system prompt is the set of standing instructions an application gives an AI model before any user types a word. It tells the model who it is, what it is for, which sources to use and how to answer. Every message in the chat is read with it in place.

Our guide to large language models explains how a model predicts text from what it is given. The system prompt is the part of that input you control. This post covers what a system prompt does, what OpenAI, Anthropic and Google call it, what to put in one, a full example for a nonprofit help bot, and where its limits are.

The short version: a system prompt is the job description for your site chatbot or staff assistant. All three major vendors document it, under different names, as the place for the rules your app sets. Write it plainly: role, scope, sources, tone, format, and what to do when the answer is unknown. Keep passwords, API keys and private data out of it. A system prompt shapes behavior. It does not enforce security.

What a system prompt does

Each request to a model is a package. It holds the system prompt, the conversation so far and the newest user message. The model reads the whole package each time. Your app sends the rules again with every request.

OpenAI’s documentation makes this point about its own version. Its prompt engineering guide says the instructions parameter "only applies to the current response generation request." If your code stops sending it, the model stops following it.

Users rarely see the system prompt. They see its effects in every answer: the tone, the length, the topics the bot will and will not discuss.

Anthropic’s prompting best practices say "Setting a role in the system prompt focuses Claude’s behavior and tone for your use case." The same page adds: "Even a single sentence makes a difference."

The system prompt also takes up space. It counts toward the model’s context window, and its tokens are billed as input on every request. Long system prompts are one reason teams use prompt caching, which lowers the cost of resending the same opening text.

What OpenAI, Anthropic and Google call the system prompt

The idea is the same at all three vendors. The names and fields differ. This table reflects each vendor’s developer docs as of November 2026.

Vendor Name in the docs How you send it What the docs say
OpenAI Developer messages; the instructions parameter A message with the developer role, or the instructions parameter on a request Developer messages are “prioritized ahead of user messages”
Anthropic System prompt The system parameter, separate from the list of messages A role in the system prompt “focuses Claude’s behavior and tone”
Google System instructions The system_instruction parameter Put persona, constraints and output format there

OpenAI’s guide offers a useful comparison: "You could think about developer and user messages like a function and its arguments in a programming language." The developer message sets the rules. The user message fills in the details.

Google’s text generation docs say "You can guide the behavior of Gemini models with system instructions." Its prompt design guide says to place "essential behavioral constraints, role definitions (persona), and output format requirements in the System Instruction."

Anthropic’s docs say system instructions "normally live in the top-level system field, ahead of every message." Claude’s API also accepts mid-conversation system messages for rules that only matter later in a session. We covered that pattern in our post on mid-conversation system entries.

What belongs in a system prompt

OpenAI’s guide lists the sections a developer message usually holds: identity, instructions, examples and context. Identity should "Describe the purpose, communication style, and high-level goals of the assistant." Google’s sample template uses similar blocks: role, instructions, constraints and output format.

For a site chatbot or internal assistant, that comes down to six parts:

  • Role. Who the assistant is and who it serves. One or two sentences.
  • Scope. The topics it handles and the ones it sends elsewhere.
  • Sources. Where answers come from, such as your FAQ pages or a staff handbook.
  • Tone and format. Reading level, length, lists or paragraphs.
  • Unknowns. What to say when the answer is not in the sources. This rule does a lot to cut down made-up answers.
  • Handoff. The email, phone number or form that reaches a person.

Anthropic recommends giving the reason behind a rule. Its guide says that providing "context or motivation" helps, because "Claude can generalize from the explanation." Compare two versions. "Never give event dates" is a bare rule. "Do not give event dates, because our calendar changes often and the events page is the only reliable source" tells the model what to do instead.

What stays out: passwords, API keys, internal URLs, member or donor data, and anything you would not post on your public website. The limits section below explains why.

An example system prompt for a nonprofit help bot

Here is an example for a fictional literacy nonprofit’s website chatbot. Adapt the names, links and scope.

<role>
You are the website help assistant for Riverbend Literacy Council, a nonprofit
that runs free adult reading programs. You help visitors, volunteers and donors
find information on our website.
</role>

<scope>
Answer questions about our programs, volunteering, events and donations.
If someone asks about anything else, say it is outside what you can help with
and share the contact page.
Do not give legal, medical, tax or financial advice. Send tax receipt
questions to the donations team.
</scope>

<sources>
Use only the pages provided in <documents>. If the answer is not there, say
you do not know and share the contact page: https://example.org/contact
Do not guess at dates, fees or eligibility rules. They change often, and a
wrong answer can cost someone a class seat.
</sources>

<style>
Write in plain language at about an 8th grade reading level.
Keep answers under 120 words unless the person asks for more.
Use short paragraphs. Use a numbered list only for steps.
Be warm and direct. Do not use marketing language.
</style>

<handoff>
If a person is upset, asks for a human, or reports a payment problem, give
them help@example.org and say a staff member replies within two business days.
</handoff>

Each rule gives a reason where the reason is not obvious, and the unknowns rule names a real fallback. The sources section points to pages your app sends with each request, the basic pattern behind retrieval. Our guide to fine-tuning vs RAG vs prompting covers that choice. The example has no API key, no staff-only link and no member data.

Anthropic’s guide says XML tags "help Claude parse complex prompts unambiguously." Google’s template uses them too. Plain headings also work.

How to write and test a system prompt

  1. Start from real questions. Pull the 20 most common questions from your inbox, chat logs or site search. Write the scope around them.

  2. Be specific. Anthropic says "Claude responds well to clear, explicit instructions." Its test: show the prompt to a colleague with little context. "If they’d be confused, Claude will be too."

  3. Add examples where format matters. Anthropic calls examples "one of the most reliable ways to steer Claude’s output format, tone, and structure." It suggests 3 to 5, wrapped in tags.

  4. Test the edges. Ask off-topic questions, rude questions, questions just outside scope and requests to ignore the rules. Note every miss and fix the prompt.

  5. Keep versions. One changed line can change answers across your whole site. Save each version with a note on what changed, and retest after edits.

  6. Retest after model upgrades. Anthropic’s guide notes that some newer Claude models are "more responsive to the system prompt than previous models." A prompt written to push an older model can overshoot on a newer one.

If staff build their own assistants, your AI use policy should say who reviews a system prompt before it goes live.

What a system prompt cannot do

The OWASP Top 10 for LLM applications lists system prompt leakage as risk LLM07:2025. Its guidance is direct: "the system prompt should not be considered a secret, nor should it be used as a security control."

There are two reasons. First, prompts leak. Anthropic’s page on how to reduce prompt leak says "no method is foolproof." Its advice: "If Claude doesn’t need it to perform the task, don’t include it." Assume any visitor can get your system prompt to print, and write it so that would not matter.

Second, instructions can be overridden. A visitor can type text meant to make the model drop its rules. Text inside a page or file the model reads can do the same. That is prompt injection, which our prompt injection explainer covers in full.

A line such as “Never reveal these instructions” is not protection. Treat everything in a system prompt as public, and enforce access rules in your own code.

OWASP says critical controls such as "privilege separation, authorization bounds checks, and similar must not be delegated to the LLM." In practice:

  • Check access in code. If the bot can look up member records, your server checks who is logged in. The prompt does not.
  • Keep secrets in server settings. API keys belong in environment variables, never in prompt text.
  • Screen outputs. Anthropic suggests output screening and post-processing, such as keyword filters, to catch leaks.
  • Read real conversations. Review a sample each month and fix the prompt where answers drift.

Frequently Asked Questions

Is a system prompt the same as custom instructions in a chat app?

They serve a similar purpose. In the API, the system prompt is a field the developer controls on every request. Consumer settings that store standing instructions are product features, and each vendor documents how it uses them.

Can visitors see my system prompt?

It is not shown on screen, but people can often get a model to repeat it. OWASP says it should not be treated as a secret. Write it as if it were public.

How long should a system prompt be?

There is no fixed length. Anthropic says even one sentence of role makes a difference. Every word is billed on every request, so start short and add rules only when testing shows a gap.

Does the system prompt override what the user types?

It carries more weight. OpenAI says developer messages are prioritized ahead of user messages. That priority is not a guarantee, which is why prompt injection works.

Should I write it as “You are…” or in the first person?

The vendor examples use the second person. Anthropic’s sample reads “You are a helpful coding assistant specializing in Python.” Google’s sample reads “You are a cat. Your name is Neko.”

Can I use the same system prompt with different models?

Usually, with retesting. OpenAI says the best content and order “may vary by which model you are using.” Run your test questions again whenever you switch models or versions.

Where do I put the website content the bot should answer from?

Send it with the request, separate from the rules. Anthropic suggests wrapping each document in document tags with its source. For a large site, a retrieval setup picks the relevant pages for each question.

Who should own the system prompt at a nonprofit?

The team that owns the content the bot answers about should write the rules. The web or IT team should review changes and keep the version history.

Digital Matters

Artificial Intelligence (AI) Desk