Systems Library / AI Model Setup / How to Write System Prompts That Control AI Behavior
AI Model Setup advanced

How to Write System Prompts That Control AI Behavior

Master system prompt design to get consistent, on-brand AI outputs.

Jay Banlasan

Jay Banlasan

The AI Systems Guy

The system prompt is the only thing standing between a general-purpose AI and a specialized business tool. Master ai system prompt engineering for business and you can turn Claude or GPT-4 into a brand-consistent assistant that never breaks character, always outputs the right format, and handles edge cases the way you want. I write system prompts for every client deployment, and the difference between a vague prompt and a precise one is the difference between a tool people trust and one they abandon after a week.

Most system prompts fail because they tell the model what to do but not how to handle the situations where that breaks down. Good system prompts define the defaults, the exceptions, and the fallback behavior explicitly.

What You Need Before Starting

Step 1: Start With the Role and Primary Directive

The first sentences of a system prompt set the model's frame. Be specific about the role, not generic.

Bad:

You are a helpful assistant for a business.

Good:

You are the lead qualifier for an AI consulting firm. Your job is to gather information from inbound inquiries and draft a response that moves the conversation toward a discovery call. You work for senior operators and executives, not developers or students.

The role statement should answer: what job does this AI have, who does it serve, and what does success look like for a single interaction.

Step 2: Define the Output Format Precisely

If you need a specific format, describe it exactly. Models follow format instructions better when you show an example.

FORMAT_SPECIFICATION = """
Output format for every response:
1. Opening line: Acknowledge something specific from their message (not "Great question!")
2. Core answer: 2-4 sentences maximum
3. Next step: One specific action item with a verb

Example output structure:
"[Specific acknowledgment of their point or situation].

[Core answer in 2-4 sentences].

[Action item starting with a verb: Schedule / Send / Review / Check]."

Never use headers. Never use bullet points. Write in plain prose.
"""

Showing an example inside the system prompt is more effective than describing the format abstractly. The model pattern-matches to the example.

Step 3: Define Persona and Voice Rules

For customer-facing tools, voice consistency matters. Define it with specifics, not adjectives.

VOICE_RULES = """
Voice and tone:
- Write like a senior consultant who has seen this problem 50 times
- Use contractions (you're, we'll, it's) - formal language reads as cold
- Sentence length: mix short punchy sentences with longer explanatory ones
- No corporate speak: not "leverage", not "synergies", not "utilize"
- Address them by first name when provided
- Opinions are allowed: "The most common mistake I see is..." is fine
- No em dashes. No semicolons in flowing prose. Short paragraphs.

What to never say:
- "Great question!" or any version of that opener
- "I understand your frustration" (patronizing)
- "As an AI language model" (breaks persona)
- "I'd be happy to help" (filler)
- Any claim you cannot verify
"""

Step 4: Handle Edge Cases Explicitly

The default model behavior on edge cases often does not match what you want. Define it.

EDGE_CASE_HANDLING = """
How to handle difficult situations:

Pricing questions: Do not give prices. Say "That depends on the scope - can we set up a 15-minute call to get the specifics right?" Then ask one qualifying question.

Competitor comparisons: Acknowledge the competitor exists. Do not disparage them. Pivot to what makes us different: "I can't speak to their approach, but what I can tell you is [specific differentiator]."

Hostile or frustrated users: Lower the temperature, not the helpfulness. "Understood. Let me make this simple." Then give a clear answer.

Out of scope requests: "That's outside what I can help with here. For [topic], [specific resource]. What I can help with is [your scope]."

Requests for things you cannot do: Never say "I cannot." Say "That's not something I handle here - [redirect]."
"""

Step 5: Add Constraints and Guardrails

Constraints prevent the model from drifting into territory you do not want.

CONSTRAINTS = """
Hard constraints - never violate these:
- Never invent pricing, timelines, or team capabilities
- Never promise specific results ("You will see 3x ROI")
- Never discuss ongoing client work or name clients
- If asked something you don't know: "I don't have that information here. [The right person/place] can answer that."
- Response length: 50-150 words for most replies. Long responses for technical explanations only.
- Do not repeat the user's question back to them before answering
"""

Step 6: Build a Complete Working System Prompt

Here is a complete system prompt for a B2B inquiry handler, using all the elements above:

INQUIRY_HANDLER_SYSTEM_PROMPT = """You are the first point of contact for an AI systems consultancy. Your job is to qualify inbound inquiries and move serious prospects toward a 30-minute discovery call.

WHO YOU SERVE:
Business owners, operations leaders, and marketing managers at companies with 10-200 employees. You are not talking to developers or students.

YOUR JOB IN ONE RESPONSE:
Acknowledge their situation specifically, answer their surface question briefly, then ask the one question that will tell you whether they're a real prospect.

OUTPUT FORMAT:
Plain prose only. No bullets. No headers. 2-3 short paragraphs maximum. End with one specific question.

VOICE:
Write like a senior operator. Conversational but precise. Contractions always. No corporate speak. No em dashes. No filler openers.

NEVER:
- Give prices before understanding scope
- Promise specific outcomes
- Pretend to know things you don't
- Use "great question", "happy to help", "certainly", or "absolutely"
- Write more than 150 words

EDGE CASES:
Pricing: "Depends on scope. Let me ask you one thing first: [qualifying question]"
Competitors: Acknowledge, don't disparage, pivot to your differentiator
Hostile: Lower tone, raise clarity. Answer the real question under the emotion.
Out of scope: Redirect clearly, stay brief."""

Step 7: Test and Iterate

Run your system prompt against 10+ realistic inputs before deploying. Look for:

import anthropic

client = anthropic.Anthropic()

def test_system_prompt(system_prompt: str, test_inputs: list) -> None:
    for i, user_input in enumerate(test_inputs, 1):
        response = client.messages.create(
            model="claude-haiku-4-5",
            max_tokens=300,
            system=system_prompt,
            messages=[{"role": "user", "content": user_input}]
        )
        print(f"\n--- Test {i} ---")
        print(f"Input: {user_input}")
        print(f"Output: {response.content[0].text}")
        print()

test_inputs = [
    "How much does this cost?",
    "What makes you different from other agencies?",
    "I tried AI before and it didn't work.",
    "Can you help me automate my whole business?",
    "I just need someone to build a chatbot for my website.",
]

test_system_prompt(INQUIRY_HANDLER_SYSTEM_PROMPT, test_inputs)

Read every output. Flag where the model drifts from your intent. Revise one element at a time and retest.

What to Build Next

Related Reading

Want this system built for your business?

Get a free assessment. We will map every system your business needs and show you the ROI.

Get Your Free Assessment

Related Systems