📑 Table des matières

Le prompting avancé qui fait vraiment la différence

LLM & Modèles 🟡 Intermédiaire ⏱️ 13 min de lecture 📅 2026-02-24

Advanced Prompting That Really Makes a Difference

You've been using ChatGPT, Claude, or Gemini for months, but you feel like you're not getting the most out of it? You're right. The difference between an average user and an AI expert often comes down to a single word: prompting.

Prompting is the art of communicating with a language model to get exactly what you want. And in 2026, with increasingly powerful models, mastering advanced prompting has become a true superpower.

In this article, we'll explore the techniques that really make a difference: structured system prompts, few-shot learning, chain-of-thought, structured output in JSON, and more. With concrete before/after examples for each technique.

🎯 Why Prompting Still Matters in 2026

One might think that with increasingly intelligent models, prompting becomes less important. The opposite is true. The more powerful a model is, the more it's capable of following complex instructions — and thus, the more advanced prompting makes a difference.

Here's what good prompting changes:

Aspect Basic Prompting Advanced Prompting
Response Quality Correct, generic Precise, adapted, usable
Consistency Variable from one query to another Stable and predictable
Format Free text, reformatting needed Structured, ready to use
Hallucinations Frequent Drastically reduced
Cost Token waste in back-and-forth Correct response on the first try

A well-designed prompt can turn a "medium" model into an expert assistant. A bad prompt can make even the best models hallucinate.

📝 Structured System Prompts

The system prompt is the foundation of any interaction with a Large Language Model (LLM). It's the text that defines who the model is, how it should behave, and what its constraints are.

Before: Naive System Prompt

You are a helpful assistant who helps users.

This prompt is so vague that it's useless. The model will produce generic responses, without personality or constraints.

After: Structured System Prompt

# Role
You are a senior Python development expert with 15 years of experience.
You work as a tech lead in a SaaS startup.

# Communication Style
- Direct and concise responses
- Use informal "tu" (you)
- Always provide functional code examples
- Mention edge cases and common pitfalls

# Constraints
- Python 3.11+ only
- Prioritize readability over performance (unless requested)
- Use type hints systematically
- Never propose code without error handling

# Response Format
1. Short explanation (2-3 sentences max)
2. Code with comments
3. Usage example
4. ⚠️ Attention points (if relevant)

The difference is radical. With the second prompt, each response will be structured, consistent, and adapted to your context.

The SOUL.md and AGENTS.md Approach

If you use OpenClaw, you're already familiar with the concept: the SOUL.md file defines the agent's personality, and AGENTS.md defines its working rules. It's exactly the same principle as the structured system prompt, but taken to the extreme.

Here's an example inspired by the OpenClaw structure:

# SOUL.md — Agent Personality

## Identity
I am Max, a data science specialist.
I work for a team of 5 data scientists.

## Values
- Scientific rigor above all
- Transparency about analysis limitations
- Code reproducibility

## Tone
- Professional but relaxed
- Use analogies to explain complex concepts
- Ask questions when the request is ambiguous

## What I Don't Do
- I don't make predictions without a confidence interval
- I don't recommend a model without cross-validation
- I never say "it's simple" (nothing is simple in data science)
# AGENTS.md — Working Rules

## Response Process
1. Understand the question (rephrase if ambiguous)
2. Verify assumptions
3. Propose an approach
4. Code and test
5. Document limitations

## Code Standards
- Pandas > manual loops
- Always seed random states
- Graphs with labels, titles, and legends
- requirements.txt for each snippet

## When to Escalate
- Dataset > 10GB → suggest Spark/Dask
- Complex model → suggest MLflow for tracking
- Business question → ask for business context

To configure these files in OpenClaw, refer to the guide Configuring OpenClaw: SOUL, AGENTS, and Skills.

The 5 Components of an Effective System Prompt

Here's the structure I recommend for any system prompt:

Component Description Example
Role Who is the model? "Web security expert"
Context In what environment? "Fintech startup, Node.js stack"
Style How to communicate? "Concise, technical, informal"
Constraints What's forbidden? "Never code without validation"
Format How to structure the response? "1. Explanation, 2. Code, 3. Tests"

🔄 Few-Shot Learning: Learning by Example

Few-shot learning involves providing examples of input/output pairs to the model before asking your question. It's the most underrated and effective technique.

Before: Zero-Shot (No Examples)

Extract named entities from this text:
"Apple announced its new MacBook Pro during the WWDC 2026 in Cupertino."

Typical response (variable, inconsistent):

The named entities are: Apple (company), MacBook Pro (product),
WWDC 2026 (event), Cupertino (location).

The format changes with each query. Sometimes it's a list, sometimes a paragraph, sometimes with parentheses, sometimes without.

After: Few-Shot (With Examples)

Extract named entities in JSON format.

Example 1:
Input: "Google acquired DeepMind in 2014 in London."
Output: {"entities": [{"text": "Google", "type": "ORG"}, {"text": "DeepMind", "type": "ORG"}, {"text": "2014", "type": "DATE"}, {"text": "London", "type": "LOC"}]}

Example 2:
Input: "Elon Musk founded SpaceX to colonize Mars."
Output: {"entities": [{"text": "Elon Musk", "type": "PER"}, {"text": "SpaceX", "type": "ORG"}, {"text": "Mars", "type": "LOC"}]}

Now, extract entities from:
Input: "Apple announced its new MacBook Pro during the WWDC 2026 in Cupertino."
Output:

Response (consistent, formatted):

{"entities": [{"text": "Apple", "type": "ORG"}, {"text": "MacBook Pro", "type": "PRODUCT"}, {"text": "WWDC 2026", "type": "EVENT"}, {"text": "Cupertino", "type": "LOC"}]}

How Many Examples Are Needed?

Number of Examples Usage Quality
0 (zero-shot) Simple and obvious tasks Variable
1-2 (few-shot) Define output format Good
3-5 (few-shot) Complex tasks, classification Very good
5+ Ambiguous cases, fine nuances Excellent

💡 Golden Rule: Always include at least one "edge case" example in your few-shots. It shows the model how to handle ambiguous situations.

Few-Shot for Classification

messages = [
    {"role": "system", "content": "You classify support tickets."},

    # Example 1
    {"role": "user", "content": "My payment was debited twice"},
    {"role": "assistant", "content": '{"category": "billing", "priority": "high", "sentiment": "negative"}'},

    # Example 2
    {"role": "user", "content": "How to export my data in CSV?"},
    {"role": "assistant", "content": '{"category": "feature_question", "priority": "low", "sentiment": "neutral"}'},

    # Example 3 (edge case)
    {"role": "user", "content": "Your app is great but the dark mode has a bug"},
    {"role": "assistant", "content": '{"category": "bug_report", "priority": "medium", "sentiment": "mixed"}'},

    # The actual query
    {"role": "user", "content": "I can no longer log in since the update"}
]

Each response will be perfectly formatted in JSON, with the correct categories, because the model has understood the pattern thanks to the examples.

🧠 Chain-of-Thought: Making the Model Think

Chain-of-Thought (CoT) is the technique that has the most impact on the quality of reasoning. The idea is simple: ask the model to show its reasoning step by step before giving its final answer.

Before: Direct Response

How many times does the letter "r" appear in the word "strawberry"?

Response (often incorrect):

The letter "r" appears 2 times in "strawberry".

After: With Chain-of-Thought

How many times does the letter "r" appear in the word "strawberry"?

Think step by step: analyze each letter of the word one by one.

Response (correct):

Let's analyze each letter of "strawberry":
s - no
t - no
r - YES (1)
a - no
w - no
b - no
e - no
r - YES (2)
r - YES (3)
y - no

The letter "r" appears 3 times in "strawberry".

Chain-of-Thought Variants

1. Explicit CoT (simplest)

Simply add "Think step by step" or "Show your reasoning" to the end of your prompt.

2. Structured CoT

Analyze this situation by following these steps:
1. OBSERVATION: What do we see in the data?
2. HYPOTHESIS: What are the possible explanations?
3. VERIFICATION: How to validate each hypothesis?
4. CONCLUSION: What is the most likely answer?

3. CoT with Self-Criticism

Solve this problem in 3 phases:
1. INITIAL ANSWER: your initial response
2. CRITICISM: look for errors in your response
3. FINAL ANSWER: correct and give the definitive answer

This technique is particularly powerful for logic, math, and code problems.

When to Use Chain-of-Thought?

Task CoT Useful? Why
Math / Logic ✅ Very Reduces calculation errors
Code / Debug ✅ Very Forces systematic analysis
Text Analysis ✅ Moderately Improves nuance
Creative Writing ❌ Rarely Can make the text too analytical
Simple Classification ❌ No Unnecessary overhead, slows down
Translation ❌ No The model already does it well

⚠️ Cost Warning: CoT generates more output tokens. If you pay per token, it can double or triple the cost. Use it strategically.

📦 Structured Output: Responses in JSON

Structured output is the most useful technique for developers. Instead of receiving free text that needs to be parsed, you receive directly usable JSON.

Before: Free Text

Analyze this CV and give me the candidate's skills.

Response:

The candidate masters Python, JavaScript, and SQL. He also has experience
with React and Node.js. In terms of soft skills, he mentions teamwork and
project management.

How to extract these data programmatically? It's a parsing nightmare.

After: Structured Output in JSON

Analyze this CV and extract skills.

Respond ONLY in valid JSON with this schema:
{
  "hard_skills": [{"name": "string", "level": "junior|mid|senior", "years": number}],
  "soft_skills": [{"name": "string", "context": "string"}],
  "languages": [{"name": "string", "level": "A1|A2|B1|B2|C1|C2"}],
  "certifications": [{"name": "string", "year": number}]
}

Response:
```json
{
"hard_skills": [
{"name": "Python", "level": "senior", "years": 8},
{"name": "JavaScript", "level": "mid", "years": 5},
{"name": "SQL", "level": "senior", "years": 7},
{"name": "React", "level": "mid", "years": 3},
{"name": "Node.js", "level": "mid", "years": 4}
],
"soft_skills": [
{