Skip to main content
Lesson 7 of 14 · Mastering Prompts with Grok

Effective System Instructions

Lesson 7 of 14 Updated July 30, 2026 Beginner
On this page
  1. The art of the system message
  2. Anatomy of an effective system message
  3. Structuring with Markdown or XML
  4. Common errors
  5. Business context
  6. Instruction hierarchy
  7. Practice
  8. Key takeaways

The art of the system message

The system message is the most powerful lever for controlling Grok’s behavior. Written well, it transforms a generalist model into a specialized assistant, perfectly adapted to your use case. Written poorly, it gets ignored or produces undesirable effects.

Prompt structure with system instructions

This lesson teaches you how to structure robust system instructions that guide the model reliably throughout the conversation.

Anatomy of an effective system message

A good system message is organized into clearly defined sections. Here is a proven template:

You are [IDENTITY: role, expertise, personality].

## Context
[Situation, domain, target audience]

## Task
[What the model must do in every interaction]

## Constraints
- [Rule 1]
- [Rule 2]
- [Rule 3]

## Output Format
[Expected structure of responses]

## Do Not
- [What the model must never do]

Worked example

You are a digital strategy consultant specializing in French SMEs. You have 15 years of experience and know the specifics of the European market.

## Context
You advise SME leaders who want to digitize their operations. They have no technical background and have limited budgets (€5,000 to €50,000).

## Task
For every question, provide a structured analysis with concrete, quantified recommendations.

## Constraints
- Always respond in English
- Prioritize open-source solutions and European tools
- Every recommendation must include a cost and timeline estimate
- Maximum 500 words per response

## Output Format
1. Needs analysis (2-3 lines)
2. Recommendations (numbered list)
3. Estimated budget
4. Next steps

## Do Not
- Never recommend solutions without stating their cost
- Do not propose solutions requiring a dedicated technical team
- Do not make unverifiable result promises

Structuring with Markdown or XML

Grok understands Markdown and XML structures very well in system messages. Use them to organize your instructions.

With Markdown

# Role
French certified accountant, specializing in startup taxation.

# Rules
- **Language**: English only
- **Tone**: Professional but accessible
- **Sources**: Always cite the relevant law article

With XML tags

<role>Expert comptable français, spécialisé en fiscalité des startups</role>
<rules>
  <rule>Réponds toujours en français</rule>
  <rule>Cite l'article de loi pertinent</rule>
  <rule>Signale quand une réponse nécessite l'avis d'un professionnel</rule>
</rules>
<output_format>
  1. Résumé de la situation
  2. Analyse juridique
  3. Recommandation pratique
</output_format>

xAI documentation recommends XML tags or formatted Markdown for API-based agents, as they add clarity and reduce ambiguity.

Common errors

Too vague

You are a helpful assistant.

This message adds no value: the model is already designed to be helpful. Be specific.

Too long and contradictory

A 2,000-word system message with contradictory instructions produces unpredictable behavior. Prioritize conciseness and consistency.

Negative instructions without alternatives

Do not write long responses.

Prefer a positive formulation:

Limit each response to 200 words maximum.

Forgetting edge cases

If your assistant must refuse certain requests, specify how:

If the question falls outside your area of expertise, respond: "This question is outside my domain. I recommend consulting [type of professional]."

Business context

Include specific vocabulary, acronyms, and conventions for your domain:

## Terminology
- CAC: Customer Acquisition Cost
- LTV: Lifetime Value
- MRR: Monthly Recurring Revenue
- Churn: Attrition rate

Use these acronyms without redefining them every time.

Instruction hierarchy

When you have many instructions, establish a clear priority:

## Priorities (descending order)
1. Security: Never disclose confidential information
2. Accuracy: Verify facts before stating them
3. Format: Follow the requested output structure
4. Tone: Remain professional and accessible

Practice

Write a complete system message for a use case of your choice. Follow the proposed template (identity, context, task, constraints, format, do not) and test it with 5 different questions. Adjust the instructions based on the results.

Key takeaways

  • Structure your system message into clear sections: identity, context, task, constraints, format, do not
  • Use Markdown or XML to organize instructions
  • Formulate positive instructions rather than negative ones
  • Include vocabulary and conventions specific to your domain
  • Plan for edge cases and tell the model how to handle them
  • Establish a priority hierarchy when instructions are numerous