logo
15

System Prompt Case Studies

⏱️ 30 min

System Prompt Case Library

A collection of real system prompt designs from major AI companies. Study these cases to understand industry best practices, then apply them to your own AI Agent development.


Case Overview

CompanyProductCore FeatureLearning Value
AnthropicClaude.ai, Claude CodeRLHF safety design, multi-roleAgent safety boundary design
OpenAIGPT-4o, Agent ModeFunction Calling, message channelsTool calling conventions
GoogleGemini CLI, Guided LearningProject conventions, workflowsCode agent best practices
xAIGrok 3/4, PersonasPersona system, X platform integrationPersonalized role design
OthersPerplexity, Kagi, RaycastSearch strategies, format specsVertical domain design

Anthropic Claude

Claude.ai & Claude Code

Core design philosophy: Safe, helpful, honest

Key features:

  • RLHF safety mechanisms: Constitutional AI design
  • CLAUDE.md configuration: Users can customize agent behavior
  • Tool specifications: Detailed Tool Use constraints
  • Multi-role switching: Adapts to different scenarios via system prompt

Best suited for:

  • Coding assistant development
  • Long document processing
  • Applications requiring high safety

Typical design pattern:

You are Claude, made by Anthropic...
You can use tools to complete tasks...
NEVER do X without explicit permission...

Deep dive into Claude System Prompts


OpenAI GPT

GPT-4o & Agent Mode

Core design philosophy: General-purpose, flexible, rich ecosystem

Key features:

  • Function Calling: TypeScript Namespace-style tool definitions
  • Message channel system: analysis / commentary / final separation
  • Financial activity restrictions: Explicit Allowed / Not Allowed lists
  • Safe browsing rules: Defense against Prompt Injection

Best suited for:

  • Browser automation
  • Complex multi-step tasks
  • Applications requiring tool calling

Typical design pattern:

namespace tools {
	type function_name = (_: { param: string }) => any;
}

Deep dive into GPT System Prompts


Google Gemini

Gemini CLI & Guided Learning

Core design philosophy: Project conventions first, workflow-driven

Key features:

  • Project conventions first: NEVER assume — analyze existing code first
  • Five-step workflow: Understand → Plan → Implement → Verify Tests → Verify Standards
  • Guided learning: Socratic teaching method
  • Self-verification loops: Emphasis on testing and standards checks

Best suited for:

  • Code agent development
  • Educational AI applications
  • Scenarios requiring strict workflows

Typical design pattern:

## Software Engineering Tasks
1. Understand: Think about the user's request...
2. Plan: Build a coherent plan...
3. Implement: Use available tools...
4. Verify (Tests): Run project tests...
5. Verify (Standards): Run linting...

Deep dive into Gemini System Prompts


xAI Grok

Grok 3/4 & Persona System

Core design philosophy: Personalization, real-time information, X platform integration

Key features:

  • Persona system: Multi-personality role switching
  • X platform integration: Native X search and analysis support
  • Render components: Dedicated citation and formatting system
  • Real-time information: No strict knowledge cutoff date

Available Personas:

  • Companion
  • Unhinged Comedian
  • Loyal Friend
  • Homework Helper
  • Not a Doctor / Not a Therapist

Best suited for:

  • Social media applications
  • Personalized chatbots
  • Applications requiring real-time information

Typical design pattern:

You are Grok, a [personality] chatbot...

## Style Rules:
- match the user's vulgarity
- always write in lowercase
- use abbreviations like rn ur bc

Deep dive into Grok System Prompts


Other AI Products

Perplexity, Kagi, Raycast AI

Three products, three distinct approaches:

ProductPositioningCore Design
PerplexityAI search engineReal-time search strategy, voice interaction specs
Kagi AssistantPremium search assistantMost detailed format specification system
Raycast AIDesktop productivity toolUser system preference injection

Learning value:

  • Perplexity: How to design search-oriented AI (re-search on every follow-up)
  • Kagi: How to design detailed output format specifications
  • Raycast: How to integrate user system preferences (language, timezone, units)

Deep dive into other AI product System Prompts


Design Pattern Comparison

From these cases, we can distill several core design patterns:

1. Identity Definition Patterns

CompanyStyle
Claude"You are Claude, made by Anthropic"
GPT"You are ChatGPT, a large language model..."
Grok"You are Grok, a [persona] chatbot..."

2. Tool Definition Patterns

CompanyStyle
OpenAITypeScript Namespace
AnthropicXML-format Tool Definition
GrokXML Function Call

3. Safety Boundary Patterns

CompanyApproach
ClaudeNEVER / ALWAYS keywords
GPTAllowed / Not Allowed lists
GrokBoundaries (Never Do) sections

How to Apply These Cases

1. Choose a Reference Template

Pick the best reference based on your use case:

  • Coding assistant → Reference Claude Code, Gemini CLI
  • Search application → Reference Perplexity
  • Chatbot → Reference Grok Personas
  • Browser automation → Reference GPT Agent Mode

2. Reuse Design Patterns

Directly reuse proven design patterns:

SYSTEM_PROMPT = """
# Identity (reference: Claude)
You are [Your Agent Name], a [role] assistant.

# Tools (reference: OpenAI)
You have access to the following tools...

# Constraints (reference: Grok)
## Boundaries (Never Do):
- Never do X without permission
- Never share Y information

# Output (reference: Kagi)
Format your response with proper markdown...
"""

3. Iterate and Optimize

  1. Start with a simple version
  2. Observe agent behavior
  3. Gradually add constraints and examples
  4. Test edge cases
  5. Refine safety boundaries

Further Reading


These cases all come from real products, showing how top companies approach system prompt design. Study them, then develop your own style.

📚 相关资源