← Blog

Claude System Prompt Best Practices and Examples

2026-11-10 · 5 min read · SubToAPI Team

The system prompt is the single highest-leverage piece of text you send to Claude. It sets the model's role, tone, constraints, and output format before the user says anything, and it persists across the entire conversation. Get it wrong and you'll fight inconsistent outputs, broken formatting, and ignored instructions. Get it right and Claude behaves predictably across thousands of requests.

This guide covers what actually works: how to structure a system prompt, concrete examples for common use cases, and the mistakes that cause the most support tickets.

What a System Prompt Is For

A system prompt in the Claude API is a separate system parameter, distinct from the messages array. It's not "the first user message" — Claude treats it as standing context that applies to every turn. Use it for things that shouldn't change mid-conversation:

Anything that's specific to a single user message — the actual question, uploaded content, variable data — belongs in the messages array instead, not the system prompt.

Core Best Practices

Be specific about role and scope first

Start with a one- or two-sentence role definition. Vague roles produce vague behavior.

You are a technical support assistant for a Postgres hosting company.
You help customers diagnose connection, performance, and billing issues.
You do not have access to live account data unless it is provided in the conversation.

Compare that to "You are a helpful assistant" — which tells the model almost nothing and leaves tone, scope, and boundaries up to chance.

Put formatting rules in their own section

Claude follows explicit formatting instructions well when they're isolated and unambiguous. Don't bury them in prose.

Output format:
- Respond only in valid JSON matching this shape: {"status": string, "steps": string[]}
- Do not include markdown, code fences, or explanatory text outside the JSON
- If you cannot complete the request, set "status" to "error" and explain in "steps"

If you need structured output reliably in production, pair this with a short example in the prompt. Models imitate examples more consistently than they follow abstract rules.

Use ordered priorities, not a wall of rules

When you have multiple constraints, rank them. If instructions conflict (and they often do as a prompt grows), the model needs to know which one wins.

Priority order when instructions conflict:
1. Safety and legal constraints always win
2. Stay within the documented product scope
3. Prefer brevity over completeness
4. Match the user's language and tone

Give explicit refusal and escalation behavior

Don't just say "don't give medical advice." Tell the model what to do instead.

If asked for medical, legal, or financial advice, decline and suggest the user
consult a licensed professional. Do not hedge with partial advice first.

Keep it shorter than you think you need

Long system prompts don't automatically produce better behavior — they increase the chance of self-contradiction and dilute the instructions that matter most. A well-organized 300-word system prompt usually outperforms a 2,000-word one. If your prompt is growing unbounded, that's usually a sign some of that content should move into retrieved context or tool results instead of permanent instructions.

Version and test your system prompts like code

Treat system prompt changes as deploys. Keep them in source control, test against a fixed set of representative inputs before shipping, and log which prompt version produced which output. This matters more once you have a real user base, because a "small wording tweak" can measurably shift tone or format for everyone at once.

Example: Customer Support Assistant

You are a support assistant for CloudBackup, a file backup SaaS.

Scope:
- Answer questions about backup schedules, storage limits, and restore steps
- Do not discuss pricing changes, refunds, or account cancellation — escalate these

Tone: concise, calm, no exclamation marks, no emoji.

Format:
- Use short paragraphs or numbered steps, never long unbroken text
- Always end troubleshooting answers with: "Did this resolve your issue?"

If the user's issue requires account-specific data you don't have, say so and
ask them to share the relevant detail rather than guessing.

Example: Tool-Calling Agent

When Claude has access to tools, the system prompt should describe when to use them, not just that they exist — the tool schema itself already tells Claude what parameters to pass.

You have access to a search_orders tool. Use it whenever a user references
an order number, a purchase date, or asks "where is my order." Do not guess
order status from memory. If search_orders returns no results, tell the user
and ask them to double check the order number.

If you're building this kind of agent on Claude's API, the tool-calling flow and schema format are covered in the tools docs, and streaming the intermediate reasoning and tool calls back to a frontend is covered in the streaming docs.

Common Mistakes

If you're exposing a Claude-backed assistant as an internal API for other teams or apps, SubToAPI turns your existing Claude access into HTTPS endpoints with application-level API keys, so each service gets its own sub_live_... key while you manage system prompts centrally. The quickstart and messages docs show the request format, and pricing covers plans from Solo to Scale.

FAQ

Does the system prompt count against the context window? Yes. It's sent with every request and counts toward input tokens, so keep it focused — bloated system prompts cost money on every single call.

Should I put few-shot examples in the system prompt or in messages? Short format examples work well in the system prompt. Longer or variable few-shot examples are easier to maintain as prior turns in the messages array, especially if you need to swap them per use case.

Can I change the system prompt mid-conversation? Technically yes on each request, but it's risky — Claude may treat a sudden shift in role or rules as inconsistent with earlier turns. If behavior needs to change significantly, it's usually cleaner to start a new conversation.

Turn your Claude access into an HTTPS API

SubToAPI gives you application API keys, streaming, tool use and usage insights on top of your existing Claude access — set up in minutes.

Start free  Read the quickstart →