← Back to Blog
Tutorials

How to Write a System Prompt for Claude — Step-by-Step Guide

February 3, 2026  ·  10 min read

What Is a System Prompt?

A system prompt is a block of instructions given to an AI model before any user conversation begins. It establishes the model's role, behavioral rules, output format preferences, and constraints that persist throughout the entire session. If a user-facing prompt is what you ask the AI, the system prompt is what you tell the AI it fundamentally is.

For Claude specifically, the system prompt is processed with especially high fidelity. Anthropic has trained Claude to treat system prompt instructions as authoritative — Claude will prioritize them over conflicting user instructions (within safety limits) and will return to them when uncertain how to handle an edge case. This makes system prompt engineering particularly important and particularly rewarding for Claude-based applications.

How Claude Handles System Prompts Differently Than GPT

While both Claude and GPT-4o support system prompts, they handle them differently in practice. Claude tends to follow system prompt instructions more literally and persistently. If you tell Claude to always respond in bullet points, it will — consistently — even as the conversation evolves. GPT models sometimes drift from system prompt constraints as a conversation grows longer.

Claude also has a native affinity for XML-structured instructions. You can use tags like <instructions>, <context>, and <format> to organize your system prompt into clearly delineated sections, and Claude will parse and prioritize them appropriately. GPT models respond better to markdown headers and plain paragraphs.

Additionally, Claude places strong weight on the distinction between "must do" and "should do" language. Explicit constraints ("never" / "always" / "you must") are treated as hard rules; preferences ("prefer" / "try to") are treated as defaults that can flex.

The Anatomy of a Strong Claude System Prompt

A well-structured system prompt for Claude has five components:

1. Role

Define who the assistant is. This primes Claude's vocabulary, level of expertise, and default behavioral stance. Be specific — "senior technical writer who specializes in API documentation for developer audiences" is far more useful than "writing assistant."

2. Task

Describe what the assistant is here to do. What kinds of requests will it receive? What is the primary goal of each interaction? This helps Claude correctly interpret ambiguous requests.

3. Constraints

List what the assistant must never do, and what it must always do. Constraints are your guardrails. For customer-facing applications, this typically includes staying on-topic, avoiding speculation, and following escalation procedures.

4. Format

Specify output structure expectations: response length, use of bullet points or prose, heading levels, code block conventions, and how to handle follow-up questions.

5. Tone

Define the communication style: formal vs. conversational, terse vs. expansive, empathetic vs. neutral. Claude can modulate tone very precisely when given explicit guidance.

Using XML Tags in Claude System Prompts

Claude's training specifically recognizes XML-style tags as structural delimiters. This is one of Claude's most distinctive prompting advantages — you can organize complex system prompts into clearly scoped sections that Claude treats as distinct instruction layers.

<role>
You are a senior customer support specialist for Acme Corp, a B2B SaaS platform.
</role>

<context>
Acme Corp sells project management software to small and mid-sized businesses.
Common issues: login errors, billing questions, integration setup, data export.
</context>

<instructions>
- Always greet the customer by name if provided
- Diagnose before prescribing: ask one clarifying question if the issue is unclear
- Escalate to human support if the customer mentions legal, refund disputes over $500, or data loss
- Never speculate about feature release dates
</instructions>

<format>
Keep responses under 120 words. Use numbered steps for troubleshooting. End with a check-in question.
</format>

Weak vs. Strong System Prompts: Real Examples

Customer Support

Weak: "You are a helpful customer support agent. Be nice and help users."

Strong: "You are a Tier-1 support agent for CloudBase SaaS. Your goal is to resolve issues in the fewest exchanges possible. Always collect account email before troubleshooting. Do not promise refunds — direct billing disputes to billing@cloudbase.io. Never say 'I don't know' — instead say 'Let me look that up' and ask a clarifying question. Tone: warm but efficient. Max response length: 100 words."

Code Review

Weak: "Review my code and find bugs."

Strong: "You are a senior software engineer performing code review with a focus on correctness, security, and maintainability. For each issue found: state the line number, classify the severity (Critical / Warning / Suggestion), explain the problem in one sentence, and provide a corrected code snippet. Do not rewrite working code unless there is a clear improvement. Assume Python 3.11+ and PEP 8 style conventions."

Content Writing

Weak: "Help me write content for my company."

Strong: "You are a B2B content strategist writing for Meridian Analytics, a data intelligence platform targeting CFOs and finance directors. Voice: authoritative, data-driven, no jargon for jargon's sake. Never use the words 'leverage,' 'synergy,' or 'game-changer.' All claims must be supportable — flag anything that needs a source with [VERIFY]. Default format: short paragraphs, max 3 sentences each, with one punchy subheading per 150 words of body copy."

Best Practices for Claude System Prompts

  • Be explicit, not implicit: Claude will not assume constraints you haven't stated. If you need something, write it down.
  • Avoid ambiguity in constraints: "Be concise" is ambiguous. "Responses must be under 100 words unless a step-by-step explanation is needed" is not.
  • Test edge cases deliberately: Try inputs that are off-topic, adversarial, or ambiguous and see how your system prompt holds up.
  • Version your system prompts: Treat them like code. Track changes and the reason for each change.
  • Use XML tags for complex prompts: The more sections your system prompt has, the more XML structure helps Claude parse priorities correctly.
  • Separate "always" from "usually": Hard rules and soft defaults should use different language so Claude can distinguish them.

Skip the blank page — use pre-built system prompts

GenPrompt's Skills Library has ready-made system prompts for customer support, code review, legal analysis, sales, and 10 other domains — all downloadable as Markdown files for Claude Projects.

Browse the Skills Library →

Product

  • Public Library
  • Public Library

Resources

  • Free PDF Tools
  • About Us
  • FAQ
  • Blog
  • Donate
  • Contact Us

Legal

  • Privacy Policy
  • Terms & Conditions

© 2026 GenPrompt. All rights reserved.

We use essential cookies to operate this site, manage your session, and remember your preferences. We do not serve third-party advertising. See our Privacy Policy for details.