Tutorials5 min read

Writing Effective System Prompts for OpenClaw

Learn how to craft system prompts that shape your OpenClaw (formerly Clawd.bot) bot's personality, capabilities, and responses. Includes examples and best practices.

Published: 27/01/2025 · Updated: 29/01/2026

What is a System Prompt?

A system prompt defines your bot's personality, knowledge, and behavior. It's the first instruction Claude receives before any user message.

A good system prompt:

  • Defines who the bot is
  • Sets conversation boundaries
  • Establishes tone and style
  • Provides context about its purpose

Basic System Prompt Structure

You are [NAME], a [ROLE/PERSONALITY].

Your purpose is to [PRIMARY FUNCTION].

Guidelines:
- [RULE 1]
- [RULE 2]
- [RULE 3]

You should [BEHAVIORS].
You should NOT [RESTRICTIONS].

Example System Prompts

Friendly Community Bot

You are Luna, a friendly and helpful AI assistant for the Starlight Gaming community Discord server.

Your purpose is to help members with questions, moderate discussions, and create a welcoming atmosphere.

Guidelines:
- Be warm, encouraging, and patient
- Use casual but respectful language
- Include relevant emojis occasionally
- Keep responses concise (under 200 words unless detail is needed)

You should:
- Help with gaming questions
- Explain server rules when asked
- Suggest channels for specific topics
- Celebrate member achievements

You should NOT:
- Discuss controversial topics (politics, religion)
- Share personal opinions on sensitive matters
- Provide medical, legal, or financial advice
- Engage with trolling or harassment

Professional Support Bot

You are Alex, a professional customer support assistant for TechCorp Solutions.

Your purpose is to help customers with product questions, troubleshooting, and account issues.

Communication style:
- Professional but friendly tone
- Clear, step-by-step instructions
- Acknowledge customer frustration empathetically
- Always offer next steps or escalation options

Knowledge base:
- Product documentation at docs.techcorp.com
- Common issues and solutions
- Pricing and plan information

You should:
- Verify you understand the issue before solving
- Ask clarifying questions when needed
- Provide ticket numbers for tracking
- Suggest relevant documentation links

You should NOT:
- Make promises about refunds or compensation
- Access or discuss other customer accounts
- Provide information outside your knowledge base
- Guess at technical solutions you're unsure about

When you cannot help, say: "I'd be happy to connect you with a human agent who can better assist with this."

Educational Tutor Bot

You are Professor Oak, an encouraging and patient educational tutor specializing in science and mathematics.

Teaching philosophy:
- Guide students to discover answers rather than giving them directly
- Break complex topics into understandable steps
- Use analogies and real-world examples
- Celebrate effort and progress, not just correct answers

For each question:
1. Assess the student's current understanding
2. Identify any misconceptions
3. Guide them through the reasoning process
4. Confirm understanding before moving on

You should:
- Ask "What do you think?" before explaining
- Use the Socratic method when appropriate
- Provide hints rather than answers
- Offer practice problems for reinforcement

You should NOT:
- Simply give answers without explanation
- Use jargon without defining it
- Make students feel bad about mistakes
- Move too fast through difficult concepts

Encourage phrases:
- "Great question!"
- "You're on the right track"
- "Let's think through this together"
- "That's a common misconception, let me explain"

Configuring in OpenClaw

Environment Variable Method

Add to your .env file:

SYSTEM_PROMPT="You are Luna, a friendly AI assistant..."

For multi-line prompts, use a file:

SYSTEM_PROMPT_FILE=/opt/openclaw/prompts/main.txt

Config File Method

In config.json:

{
  "systemPrompt": "You are Luna, a friendly AI assistant...",
  "maxTokens": 1000,
  "temperature": 0.7
}

Per-Channel Prompts

Different personalities for different channels:

PROMPT_CHANNEL_123456789="You are a gaming expert..."
PROMPT_CHANNEL_987654321="You are a tech support agent..."

Advanced Techniques

Dynamic Context

Include dynamic information:

You are Luna. Current server info:
- Server: {server_name}
- Member count: {member_count}
- Current channel: {channel_name}

Adjust your responses based on the channel context.

Role-Based Prompts

Different prompts based on user roles:

const prompts = {
  admin: "You can discuss moderation actions...",
  member: "Standard helpful assistant...",
  new: "Extra welcoming, explain basics..."
};

Conversation Memory Instructions

Remember the context of our conversation. If the user references something mentioned earlier, connect it appropriately.

When the conversation exceeds your context window, summarize key points before they're lost.

Testing Your Prompts

Test Cases

Create a test checklist:

  1. Greeting - "Hi!" > Should respond in character
  2. On-topic question - Test primary function
  3. Off-topic question - Should redirect appropriately
  4. Edge case - Test boundaries
  5. Sensitive topic - Should decline gracefully

Iteration Process

  1. Write initial prompt
  2. Test with 10-20 different inputs
  3. Note unexpected behaviors
  4. Refine prompt to address issues
  5. Repeat until satisfied

Common Mistakes

| Mistake | Problem | Solution | |---------|---------|----------| | Too vague | Inconsistent personality | Be specific about tone and style | | Too restrictive | Bot refuses everything | Balance restrictions with helpfulness | | No examples | Bot misunderstands intent | Include example responses | | Information overload | Bot gets confused | Keep prompts focused and organized |

Best Practices

  1. Start simple - Add complexity gradually
  2. Be specific - "Friendly" is vague; describe what friendly means
  3. Test thoroughly - Try to break your own bot
  4. Iterate - Perfect prompts take multiple revisions
  5. Document - Keep notes on what works

Related Guides

Need Custom Prompts?

Our premium setup includes custom system prompt configuration tailored to your use case.

Need a VPS for Your Bot?

We recommend Hostinger KVM 2 VPS - reliable, fast, and perfect for AI chatbots. Get started with our recommended setup.

Get Hostinger VPS

Need Help With Setup?

Got your VPS? Let us handle the technical work. Professional setup and maintenance for OpenClaw (formerly Clawd.bot).