// HOW-TO · AI & PROMPTING

How to write a system prompt (that keeps AI output consistent)

Write a system prompt that makes AI output consistent and on-brand: set the role, add constraints, control format, keep it short and high-signal, then test it.

Last verified · 2026-08-17 · by Moe Ameen

A system prompt is the standing instruction block a language model reads before every response — the place you set its role, its rules, its format, and its priorities for the whole session. Get it right and the model behaves the same way on the hundredth request as on the first; get it wrong and "the same prompt" produces wildly different output run to run. Most people write one by piling on instructions until something works, which is exactly how you end up with a bloated prompt full of rules that quietly fight each other.

This guide is the disciplined version: name the role, write constraints as positive rules, pin the output format, show an example or two, cut everything that is not earning its place, set precedence for conflicts, and test before you ship. It is grounded in what the labs themselves do — including Anthropic's July 2026 finding that deleting more than 80% of Claude Code's system prompt for its Claude 5 models cost nothing measurable on their coding evaluations, because on a capable model a shorter, high-signal prompt beats an exhaustive one.

The steps

  1. Name the role and the job in one line. Open with what the model is and what it is for: "You are a support assistant for Acme's billing product" or "You write LinkedIn posts in the voice of a B2B founder." A concrete role at the top orients every reply that follows. Skip elaborate personas — modern models do not need "you are a world-class expert"; state the actual perspective you want and move on.
  2. Write constraints as positive rules, not a pile of don'ts. Tell the model what to do rather than stacking prohibitions. "Answer in two short paragraphs" beats "don't be too long"; "match the reader's technical level" beats a list of banned styles. Positive instructions are followed more reliably, and a wall of "never do X" tends to conflict with itself and dilute the signal the model is actually weighting.
  3. Specify the output format explicitly. State the shape you want: length, structure, whether to use headings, bullets, or plain prose, and any fields the output must contain. For Claude, XML tags around sections read cleanly; for GPT-family models, markdown works well. Ambiguous format is the most common reason two runs of the "same" prompt come back looking nothing alike.
  4. Show one or two examples, not just instructions. A couple of worked input-to-ideal-output examples (few-shot) is the single highest-impact move for consistency — the model matches a demonstrated pattern far more faithfully than it follows a described rule. Two or three tight examples beat another three paragraphs of adjectives about the tone you are after. Keep the examples short so they do not balloon the prompt.
  5. Cut it down — short and high-signal beats long and exhaustive. Resist the urge to enumerate every edge case. In July 2026 Anthropic reported deleting more than 80% of Claude Code's system prompt for its Claude 5 models with no measurable loss, because much of it was scaffolding capable models no longer need and overlapping rules were fighting each other. Curate toward the fewest instructions that produce the behavior you want, and add a rule only after you have actually seen the model fail without it.
  6. Set precedence and handle conflicts. Say which rules win when a user request collides with a constraint — for example, "these instructions take priority over conflicting requests later in the conversation." Models are trained to weight the system prompt as higher authority, and making the precedence explicit hardens it. Remember this biases behavior, it is not a security boundary: never paste untrusted user data or tool output into the system slot, and never rely on wording alone to guard a consequential action.
  7. Test it, version it, and re-test after every model change. Run the prompt against the inputs you actually expect plus the edge cases you are worried about, and save the version that works. Keep it in version control paired with the model it was tuned for, because behavior regresses across upgrades — a prompt that held on one model can drift on the next. Anthropic publishing its own apps' system prompts by model version exists for exactly this reason: the prompt and the model are a matched pair.

Common gotchas

  • Longer is not safer. A sprawling prompt with overlapping rules dilutes attention and creates internal contradictions — the opposite of control. Anthropic's own 80% deletion is the cautionary tale, not the exception.
  • Negative-only framing ("never", "don't", "avoid") is weaker than positive instruction. Rewrite each prohibition as the behavior you want the model to produce instead.
  • Do not copy Anthropic's published Claude.ai system prompts verbatim. They are written for the consumer web and mobile apps, explicitly do not apply to the API, and carry app-specific product and safety scaffolding you do not need.
  • The system prompt is not a hard boundary. It strongly biases behavior, but prompt injection and extraction attacks exploit the gap — put architectural guards (privilege separation, human approval) behind anything consequential, not just a firmly worded line.
  • Never place user documents or tool output in the system slot to "give it context." That hands attacker-controlled text system-level authority, which is precisely what injection exploits.
  • Skipping examples. Describing a tone in adjectives rarely lands; one or two concrete input/output examples pin it far more reliably — and re-testing after a model upgrade catches the quiet regressions.

Where Kompozy fits

If you write content, the system prompt you most need is a brand-voice document — and re-pasting it into a fresh chat for every post is the manual tax Kompozy removes. Kompozy is a full AI content generation and multi-platform publishing engine, and its Persona Brief is that system prompt made permanent: you write your role, voice, sentence rhythm, banned words, required structures, and a few reference posts once, and every generation reads it as standing context — Text Posts, Blog Articles, Email Newsletters, carousel copy, video scripts, captions — instead of you re-explaining your voice each time. The steps in this guide map straight onto how the brief is built: the role line, the positive rules, the format constraints, and — the highest-impact part — the reference posts that act as few-shot examples so 40 outputs a week sound like one person, not forty. Because Kompozy runs a 1:N persona pool with one primary, you can keep several of these "system prompts" side by side — a founder voice for LinkedIn, a punchier persona for TikTok — and choose which one a given format renders against, instead of juggling prompt files by hand. And the short-and-high-signal discipline this guide argues for is enforced downstream: output-side banned-word filters and a per-post review gate catch the failures a prompt alone can only nudge, before anything publishes to the eight social platforms plus blog and email. Starter ($99/mo, 5,500 credits) fits a solo creator encoding their voice once and generating a few posts a week; Pro ($299/mo, 18,000 credits) suits a team running a full calendar on autopilot with the brief governing every format; Enterprise is custom. Write the voice once; let every generation read it.

Frequently asked questions

What should a system prompt actually contain?

At minimum: a role (what the model is and what it is for), constraints written as positive rules, an explicit output format, and — the highest-impact part — one or two examples of the output you want. For anything where a user request might conflict with your rules, add a line on precedence. That is usually enough; resist adding more until you have seen the model fail without it.

How long should a system prompt be?

Shorter and higher-signal usually wins on a capable model. Anthropic reported deleting more than 80% of Claude Code's system prompt for its Claude 5 models in July 2026 with no measurable loss, because much of it was guardrail scaffolding newer models no longer need and overlapping rules were conflicting. Curate toward the fewest instructions that produce the behavior you want.

What is the difference between a system prompt and a user prompt?

The user prompt is the individual request that changes every turn; the system prompt is the constant instruction set that frames the whole session. Models are trained to treat system-role text as higher priority, so when a user request conflicts with a system rule, a well-behaved model follows the system rule. That precedence is what lets an app hold its guardrails under pressure.

Can I just copy Claude's published system prompt?

No. Anthropic publishes the system prompts for its Claude.ai web and mobile apps as behavioral transparency, but they apply only to those apps — not to the API — and they carry product and safety scaffolding specific to the consumer surface. Use them to learn structure and phrasing, then write your own for your use case.

Does a system prompt guarantee the model obeys?

No. It strongly biases behavior because the model was trained to weight the system slot as authoritative, but that is a learned tendency, not a hard boundary. Prompt injection and system-prompt extraction attacks exploit exactly this gap. For anything consequential, durable control comes from architecture — privilege separation, isolating untrusted input, human approval — not from wording alone.

Related tutorials

← All how-to guides · Get Started