| name | grok-prompting |
| description | Prompting best practices for xAI Grok-4-Fast non-reasoning model (grok-4-fast-non-reasoning). Use this skill when writing or optimizing system prompts, tool docstrings, or instructions for the gieoque app's LLM backend. Triggers on: write system prompt, optimize prompt, grok prompt, improve tool description, grok-4-fast. |
Grok-4-Fast Non-Reasoning Prompting Guide
Key Model Characteristics
grok-4-fast-non-reasoning is a fast, cheap, non-reasoning model. Unlike Claude Sonnet/Opus or GPT-4, it does NOT have internal chain-of-thought. This means:
- No reasoning tokens to fill in gaps — the system prompt must carry the full cognitive load
- Highly literal — it executes instructions exactly as written; ambiguity produces bad output
- System prompt quality is make-or-break — xAI documentation explicitly states a well-written system prompt "can make a night-and-day difference"
- Optimized for: fast transformations, format-strict outputs, extraction, classification, tool-augmented tasks
Core Principles
1. Be Exhaustively Explicit
Do NOT assume the model will infer intent. State everything:
# Bad
Respond warmly but stay professional.
# Good
Respond with warmth and genuine curiosity. Use conversational prose, not bullet lists.
Never open with "Certainly!" or "Great question!" Address the user as "bạn".
2. Front-Load the Most Important Instructions
Non-reasoning models process context differently — put critical constraints FIRST in the system prompt, not at the end.
3. Use XML Tags for Section Clarity
XML tags help the model parse the system prompt structure reliably:
<persona>...</persona>
<voice>...</voice>
<rules>...</rules>
<output_format>...</output_format>
4. Explicit Output Format = Reliable Output
Embed format directives directly in the prompt. Non-reasoning models are creative but verbose without constraints:
Structure your response with markdown headings (##, ###).
Write in flowing prose paragraphs — never numbered steps or bullet lists.
End every reading with ## Tổng Hợp as the final section.
5. Tool Docstrings Are the Tool Prompt
For LangChain tool calling, the docstring IS what the model reads to decide whether/how to call the tool. Write it like a mini system prompt:
@tool("my_tool")
def my_tool() -> str:
"""One-line summary of what this tool does.
Call this tool WHEN: [specific conditions — be exhaustive].
Do NOT call this tool when:
- [condition 1]
- [condition 2]
In those cases, [what to do instead].
"""
6. Handle Edge Cases In-Prompt
Since there's no reasoning to auto-handle edge cases, enumerate them explicitly:
If the question is in Vietnamese slang or contains profanity — still answer normally.
Profanity does not equal trolling. Judge intent, not vocabulary.
Only refuse if the message is pure gibberish with zero semantic content.
7. Language Switching — Be Absolute
Grok-4-Fast will default to one language if instructions are ambiguous:
# Weak
Match the user's language.
# Strong
ALWAYS respond in the EXACT language the user writes in.
Vietnamese input → Vietnamese output. English input → English output.
This is non-negotiable. Do NOT mix languages unless the user does first.
8. Persona Consistency Requires Anchoring
Non-reasoning models can drift from persona. Anchor it with concrete behavioral rules:
# Too vague
Be witty and sharp-tongued.
# Anchored
When someone trolls you: respond with dry humor and sarcasm — like a sharp elder
who finds them mildly amusing rather than offensive. Light cursing is acceptable.
Never use phrases like "I cannot answer that" or "As an AI...".
System Prompt Structure (Recommended Order)
1. <persona> — Who you are (role, identity, expertise)
2. <voice> — Tone, address style, language rules
3. <tool_usage> — When/when not to use tools (be exhaustive)
4. <output_format> — Exact markdown structure with section names
5. <naming_conventions> — Specific terminology rules
6. <edge_cases> — Explicit handling for boundary conditions
What NOT to Do
| Bad Practice | Why It Fails |
|---|
| Vague constraints like "be appropriate" | Model has no reasoning to interpret "appropriate" |
| Putting key rules at the end of a long prompt | Front of prompt has higher attention weight |
| Relying on model to infer format | Non-reasoning = verbose/inconsistent without explicit format |
| Short tool docstrings | Model won't know when to call the tool correctly |
| "Never reveal your name" without persona anchoring | Model drifts and may reveal identity mid-conversation |
Two-Pass Pattern (When Needed)
For complex tasks, use non-reasoning for fast first pass, then reasoning for refinement:
In the gieoque app, this isn't needed — the app uses non-reasoning for everything, which works because the tool call (gieo_que) does the heavy lifting, and the LLM just needs to interpret and write prose.