Workshop: Building an Expert Prompt
On this page
Workshop Objective
This workshop walks you through building a complete expert prompt step by step. You will create a specialized assistant for a real-world use case by applying every technique covered in this course: roles, parameters, few-shot prompting, chain of thought, and structured system instructions.
By the end of this workshop, you will have a production-ready prompt to integrate into your tools or workflow.
The Project: Contract Analysis Assistant
We will build an assistant capable of analyzing commercial contracts and extracting key information, risks, and negotiation points.
This use case combines several techniques: structured extraction, critical analysis, and drafting recommendations.
Step 1: Define the System Message
Start with the skeleton of the system message. Identify the necessary sections:
You are an in-house counsel specializing in French commercial law, with 10 years of experience negotiating B2B contracts.
## Mission
You analyze commercial contracts and provide a structured assessment including: key clauses, identified risks, recommended negotiation points, and an overall risk score.
## Context
You work for a French SME in the technology sector (50 employees, €8 million annual revenue). The contracts analyzed are primarily vendor contracts, service agreements, and partnership deals.
## Constraints
- Always respond in English
- Base your analysis on French commercial law
- Systematically flag any clause that is unusual or unfavorable
- Clearly indicate when an analysis requires validation by a lawyer
- Never provide definitive legal advice
## Output Format
[to be defined in the next step]
Test this system message with a simple contract text. Obze the default response format and identify what you want to improve.
Step 2: Structure the Output Format
After the first test, define the expected format precisely:
## Output Format
### 1. Summary (3-5 lines)
Contract type, parties, main subject, duration.
### 2. Key Clauses
For each important clause:
- **Title**: clause name
- **Summary**: what it stipulates (1-2 lines)
- **Assessment**: favorable / neutral / unfavorable
- **Comment**: why this assessment
### 3. Identified Risks
Numbered list, from most critical to least critical:
- Risk description
- Severity: critical / high / moderate / low
- Mitigation recommendation
### 4. Negotiation Points
The 3-5 points to prioritize in negotiation, with a suggested alternative wording.
### 5. Overall Risk Score
Rating from 1 (very low) to 10 (very high) with a 2-line justification.
Retest with the same contract. The result should now be structured and immediately actionable.
Step 3: Add Few-Shot Examples
To calibrate the quality of assessments, add an example input/output pair to your conversation:
[
{"role": "system", "content": "[your complete system message]"},
{"role": "user", "content": "Analyze this clause: 'The service provider commits to a guaranteed result obligation on all deliverables. Any delay will be penalized at 5% of the total amount per day of delay, without cap.'"},
{"role": "assistant", "content": "### Clause: Guaranteed Result Obligation and Penalties\n- **Summary**: The provider is subject to a guaranteed result obligation (not best efforts) with delay penalties of 5% per day without cap.\n- **Assessment**: Unfavorable\n- **Comment**: The absence of a cap on penalties is a major risk. Under French law, uncapped penalties can exceed the total contract amount. Additionally, the guaranteed result obligation (vs. best efforts) transfers all risk to the provider. Recommendation: negotiate a penalty cap at 10–15% of the total amount and propose a reinforced best efforts obligation."},
{"role": "user", "content": "[new contract to analyze]"}
]
This example shows the model the expected level of detail and tone.
Step 4: Calibrate Parameters
For an analysis task requiring rigor and consistency:
{
"model": "grok-4.20-0309-reasoning",
"temperature": 0.3,
"max_completion_tokens": 3000,
"reasoning": {"effort": "high"}
}
Justification for choices:
- Reasoning model: Contract analysis requires structured reasoning
- Low temperature: We want rigor, not creativity
- High tokens: Complete contract analysis can be long
- High effort: Legal nuances require deep reasoning
Step 5: Test and Iterate
Test your prompt with 3–5 different contracts and verify:
- Completeness: Are all sections of the format filled?
- Relevance: Are the identified risks real and properly assessed?
- Consistency: Is the risk score consistent with the listed risks?
- Clarity: Can a non-lawyer understand the recommendations?
For each problem identified, adjust one thing at a time:
- If risks are underestimated: Add “Be conservative in your risk assessment. In case of doubt, classify the risk at the higher level.”
- If the format drifts: Add a second few-shot example to reinforce the structure
- If the analysis is too technical: Add “Explain each risk in terms understandable by a non-lawyer executive”
Step 6: Document the Final Prompt
Once satisfied with the result, document your prompt:
- The complete system message
- The few-shot examples
- The parameters (model, temperature, tokens)
- The test cases and results obtained
- The adjustments made and their impact
This document is your prompt recipe: it allows you to reproduce, share, or adapt it to a new use case.
Put It Into Practice
Apply this 6-step methodology to your own use case. Choose a topic you know well so you can evaluate the quality of the responses. Iterate until you achieve a professional-quality result.
Key Takeaways
- Building an expert prompt follows a 6-step process: system, format, examples, parameters, tests, documentation
- The system message is the foundation: invest time to structure it correctly
- Few-shot examples calibrate the level of detail and tone of responses
- Test with varied cases and adjust one aspect per iteration
- Document your final prompt to reproduce and improve it