How It Works
The anatomy of an effective legal AI prompt:
A well-structured legal AI prompt typically includes six components:
1. Role assignment: Specifying the professional role or expertise the AI should adopt. "You are a senior M&A attorney reviewing a purchase agreement" produces more contextually appropriate outputs than "review this contract." Role assignment activates relevant domain knowledge the model has encoded.
2. Task specification: Precisely describing what the AI should do. This is the most important component. Compare:
Weak: "Review this contract."
Strong: "Identify all provisions in this Master Services Agreement that impose obligations on the Service Provider that survive termination of the agreement. For each, state: (1) the section number, (2) the obligation, (3) the duration of survival if specified, and (4) any conditions or exceptions."
The strong version specifies the task (identify survival obligations), the scope (Service Provider obligations), the structure (four-part response format), and the content requirements (section numbers, conditions, exceptions).
3. Legal context: Providing jurisdiction, governing law, applicable regulatory framework, and relevant legal standards. An AI analyzing a non-compete clause needs to know the jurisdiction — what is enforceable in California is void; what is void in California may be enforceable in Florida. Omitting jurisdiction leads the AI to apply generic legal standards that may be wrong for the specific matter.
"Analyze this non-compete provision under California Business and Professions Code Section 16600, as interpreted by California courts following Edwards v. Arthur Andersen LLP."
4. Document or source material: Providing the specific documents the AI should analyze. For grounded analysis, instruct the AI explicitly to base its response only on the provided documents, not on general legal knowledge that might be outdated or hallucinated.
"Based solely on the attached agreement, identify all change of control provisions. Do not speculate about provisions that might typically appear in agreements of this type but are not present in this specific document."
5. Output format specification: Specifying the format, length, and structure of the desired output. "Produce a two-page executive summary in memo format, with section headings for: (1) Key Commercial Terms, (2) Non-Standard Provisions, and (3) Recommended Negotiation Points." Format specifications prevent the AI from generating unhelpfully verbose responses or omitting required structural elements.
6. Constraints and quality guidance: Specifying what the AI should not do, and including explicit quality standards. "Do not cite cases unless you are certain they exist and accurately represent the case's holding. Flag any legal conclusion where you have less than high confidence with '[UNCERTAIN — VERIFY]'." Uncertainty flagging prompts encourage the AI to express calibrated uncertainty rather than generating confident-sounding hallucinated content.
Advanced prompt engineering techniques:
Few-shot prompting: Providing examples of the desired output format before asking the AI to generate its own output. For contract clause extraction, providing two or three examples of correctly formatted clause summaries before asking the AI to extract clauses from the target document significantly improves output consistency and format compliance.
Chain-of-thought prompting: Instructing the AI to show its reasoning step by step before reaching a conclusion. "Before providing your legal analysis, first summarize: (1) the key facts from the contract, (2) the applicable legal standard, (3) how the facts apply to the standard. Then provide your conclusion." This technique improves accuracy on complex legal analysis tasks by making the AI's reasoning process explicit and reviewable.
Grounding instructions: Explicitly instructing the AI to base its response on provided source documents. "Answer the following question based only on the attached case opinions. If the cases do not provide sufficient information to answer the question, say so rather than speculating." This reduces hallucination by constraining the AI's generative license.
Iterative refinement: Treating the first AI response as a draft to be refined through follow-up prompts. "The analysis you provided on Section 8.2 is helpful. Now apply the same analysis framework to Section 12.4, and specifically address how the two sections interact given the cross-reference in Section 12.4(c)." Iterative refinement allows complex legal analysis to be built incrementally.
Prompt engineering in leading legal AI tools:
Harvey AI is designed to work with sophisticated legal prompts — law firms using Harvey have developed internal prompt libraries that encode best practices for common legal tasks (due diligence reviews, legal research memos, contract playbook application). These prompt libraries are proprietary competitive assets for the firms that develop them. CoCounsel has a structured task interface that guides users through providing the information needed for common legal tasks, essentially implementing prompt engineering best practices through its UX rather than requiring users to engineer prompts from scratch. Spellbook uses template-based prompting for contract drafting tasks, with task-specific interfaces that collect the relevant parameters and construct the underlying prompt.
Building a firm prompt library:
Law firms that invest in prompt engineering develop reusable prompt templates for common legal tasks. A prompt library for a corporate practice might include:
- Due diligence review prompt for M&A target contracts (by agreement type)
- Contract playbook application prompt (referencing the firm's specific playbook)
- Legal research memo prompt (specifying jurisdiction, citation format, and memo structure)
- Contract summary prompt (for different summary formats for different audiences)
- Risk flagging prompt (calibrated to the firm's risk tolerance and standard positions)
These prompt templates embed institutional knowledge about how to get the best results from legal AI tools, and represent genuine intellectual property value as firms develop them over time.
Key Considerations for Law Firms
Invest in prompt engineering training: Prompt engineering is a learnable skill, not a natural talent. Law firms that invest in training lawyers to write effective prompts — through workshops, prompt libraries, and documented best practices — will consistently get better results from their legal AI investments than firms that deploy tools without prompt guidance.
Develop practice-group-specific prompt templates: The optimal prompt structure for M&A contract review differs from the optimal structure for litigation research or regulatory compliance analysis. Practice groups should develop prompt templates calibrated to their specific document types, legal standards, and output requirements.
Include verification prompts as standard practice: Every prompt that generates legal citations should include an instruction for the AI to express uncertainty: "Flag any case citation where you are not certain the case exists and accurately reflects the stated holding." This habit reduces the risk of confidently stated hallucinated citations passing undetected through lawyer review.
Document and share effective prompts: When a lawyer discovers an effective prompt structure for a common task, that knowledge should be captured and shared rather than remaining with the individual. Legal knowledge management systems should include prompt libraries alongside precedent documents and work product templates.
Prompt engineering is a mitigation, not a substitute for verification: No matter how well-engineered a prompt is, the professional responsibility baseline is that AI-generated legal research requires verification against primary sources and AI-generated contract analysis requires lawyer review before being relied upon. Prompt engineering improves output quality; it does not create outputs that can be relied upon without verification.
Limitations and Risks
Prompt sensitivity creates inconsistency: The same underlying question phrased differently can produce meaningfully different AI outputs. This sensitivity to prompt formulation means that lawyers without prompt engineering training may get significantly worse results from the same tool than colleagues who have invested in the skill — creating inconsistency in AI-assisted work product quality within a firm.
Prompt length consumes context window: Very detailed, comprehensive prompts can consume significant amounts of the context window, leaving less space for the document being analyzed. For very long documents, there is a tradeoff between prompt comprehensiveness and the amount of document content that fits in the context.
Model updates can change prompt effectiveness: When a vendor updates their AI model, prompt structures that worked reliably with the previous model version may produce different results with the new version. Firms should revalidate their prompt libraries after vendor model updates.
Gaming hallucination constraints has limits: Uncertainty-flagging instructions reduce hallucination rates but do not eliminate them. An AI may comply with an instruction to flag uncertain citations in some responses while failing to flag uncertain citations in others. Uncertainty flagging is a risk reduction technique, not a hallucination elimination mechanism.
Prompts are not protected work product: Detailed prompt templates developed by a law firm may not be protected from disclosure in certain contexts — in litigation, a party might seek to discover the prompts used to generate AI-assisted work product. Firms should consult with their professional responsibility counsel on prompt-related disclosure risks.
Related Tools from Blog