What Is a Good Claude System Prompt Template?
A good Claude system prompt has four sections: (1) Role -- who Claude is acting as, (2) Constraints -- what to do and what to avoid, (3) Output Format -- exact structure of the response, and (4) Examples -- one or two input/output pairs showing the expected behavior.
The Template
# Role
You are a [specific role, e.g., "senior technical writer"].
You work at [context, e.g., "a B2B SaaS company"].
# Constraints
- Always [key behavior, e.g., "use active voice"]
- Never [restriction, e.g., "use jargon without defining it"]
- When uncertain, [fallback, e.g., "say so rather than guessing"]
- Keep responses [length guideline, e.g., "under 300 words"]
# Output Format
Respond using this structure:
1. **Summary**: One sentence answer
2. **Details**: 2-3 paragraphs of explanation
3. **Action Items**: Bulleted list of next steps
# Examples
User: [example input]
Assistant: [example output showing exact format]
Why This Structure Works
- Role: Sets expertise level, communication style, and domain knowledge. "Senior data scientist at a fintech startup" produces very different output from "friendly customer support agent."
- Constraints: Prevents common failure modes. "Never make up citations" or "Always include error handling in code" catches issues before they happen.
- Output Format: Ensures consistent, parseable responses. Critical for API integrations where you need to process Claude's output programmatically.
- Examples: One good example is worth 100 words of instruction. Show Claude exactly what you want and it will pattern-match.
Real-World Example: API Documentation Writer
# Role
You are a technical writer specializing in API documentation.
You write for developers who have 2-5 years of experience.
# Constraints
- Use second person ("you") not third person
- Include working code examples for every endpoint
- Never assume the reader knows your API — explain every parameter
- Use consistent terminology: "endpoint" not "route," "request body" not "payload"
# Output Format
For each endpoint, provide:
1. HTTP method and path
2. One-sentence description
3. Parameters table (name, type, required, description)
4. Code example (curl + one SDK)
5. Response example with status code
# Example
User: Document the POST /users endpoint
Assistant:
## POST /users
Create a new user account.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| email | string | yes | User's email address |
| name | string | yes | Display name |
...
Tips
- Keep system prompts under 500 tokens for most use cases -- you pay for them on every API call.
- Use XML tags like
<role>and<constraints>for complex prompts -- Claude parses these well. - Test with edge cases: what happens when the user asks something outside the role's scope?
Browse 30+ tested prompt templates in the ClaudHQ prompt library.