법률 분야 프롬프트 패턴
계약서 분석, 조항 추출, 관할권을 고려한 법률 프롬프트를 다룹니다.
법률 분야 프롬프트 패턴은(는) CoddyKit의 무료 AI Prompt Engineering 강의입니다. 이것은 4개 중 1번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 AI Prompt Engineering 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. AI Prompt Engineering 강의에는 총 4개의 강의가 포함되어 있습니다.
법률 분야 프롬프트 작성이 다른 이유
법률 분야의 프롬프트 작성에는 관할 인식, 정밀한 언어, 위험 의식 및 필수 면책 고지가 필요합니다. 주의사항 없이 조언을 제공하는 법률 인공지능 도구는 사용자를 법적 책임에 노출시킵니다. 분야별 패턴은 이러한 제약을 체계적으로 다룹니다.
변호사 페르소나 시스템 프롬프트
명시적인 관할 범위와 함께 전문가 페르소나를 설정하면 모델의 분석을 올바르게 구성할 수 있습니다. 항상 기밀 유지 및 면책 고지 안내를 포함해야 합니다.
LEGAL_SYSTEM_PROMPT = '''You are an experienced commercial lawyer reviewing contracts
under New York law (NYCL, UCC Article 2, and applicable federal law).
When analyzing contracts:
1. Identify the governing law clause and note if it conflicts with NY law.
2. Flag any provisions that deviate from NY commercial norms.
3. Use precise legal terminology — do not paraphrase statutes.
4. Always cite the relevant section or clause number from the contract.
5. Structure your analysis as: [Issue] -> [Risk Level: LOW/MEDIUM/HIGH] -> [Recommendation].
DISCLAIMER: This analysis is for informational purposes only and does not
constitute legal advice. Always consult a licensed attorney before acting
on any legal analysis. Attorney-client privilege does not apply to this
communication.'''
import anthropic
client = anthropic.Anthropic(api_key='YOUR_API_KEY')계약 조항 추출 패턴
추출 프롬프트는 기계가 구문 분석할 수 있는 출력을 반환하도록 구조화해야 합니다. 원하는 항목과 출력 형식을 정확히 지정하여 문서 간 일관성을 확보합니다.
EXTRACTION_PROMPT = '''Extract the following clauses from the contract below.
For each clause, provide:
- clause_type: one of [governing_law, limitation_of_liability, indemnification,
termination, intellectual_property, confidentiality, arbitration, force_majeure]
- section_number: as it appears in the contract
- verbatim_text: exact text of the clause (do not paraphrase)
- jurisdiction_specific_notes: any NY-law-specific observations
If a clause is absent, set verbatim_text to null and note "Not found".
Return a JSON array.
Contract:
{contract_text}'''
import json
def extract_clauses(contract_text):
response = client.messages.create(
model='claude-opus-4-5',
max_tokens=4096,
system=LEGAL_SYSTEM_PROMPT,
messages=[{'role': 'user', 'content':
EXTRACTION_PROMPT.format(contract_text=contract_text)}]
)
return json.loads(response.content[0].text)위험 식별 패턴
위험 식별 프롬프트는 모델에 위험을 심각도별로 분류하고 권장 완화 조치를 제시하도록 지시하므로, 출력이 법률 검토에 바로 활용될 수 있습니다.
RISK_PROMPT = '''Perform a legal risk analysis of the following contract
under New York law. Identify up to 10 risks.
For each risk output:
1. Risk title (concise, max 8 words)
2. Severity: CRITICAL | HIGH | MEDIUM | LOW
3. Clause reference (section number)
4. Risk description (2-3 sentences)
5. Recommended mitigation (1-2 sentences)
Prioritize: limitation of liability caps, indemnification exposure,
unlimited IP assignment, auto-renewal traps, one-sided termination rights.
Contract:
{contract_text}
Format as a numbered list with clear labels.'''
def identify_risks(contract_text):
response = client.messages.create(
model='claude-opus-4-5',
max_tokens=3000,
system=LEGAL_SYSTEM_PROMPT,
messages=[{'role': 'user', 'content':
RISK_PROMPT.format(contract_text=contract_text)}]
)
return response.content[0].text관할을 고려한 비교
다른 관할의 법률이 적용되는 계약을 검토할 때는 모델에 차이점, 즉 예상 관할의 규범과 다른 점을 강조하도록 지시합니다.
JURISDICTION_COMPARE_PROMPT = '''The contract below is governed by {governing_law} law.
I am a New York-based company. Analyze:
1. Key differences between {governing_law} and New York law that affect this contract.
2. Provisions that are enforceable under {governing_law} but may not be under NY law.
3. Choice-of-law risks if we add a NY-law addendum.
4. Recommended: should we negotiate to change governing law to NY? Why or why not?
Contract:
{contract_text}'''
def compare_jurisdictions(contract_text, governing_law):
response = client.messages.create(
model='claude-opus-4-5',
max_tokens=2000,
system=LEGAL_SYSTEM_PROMPT,
messages=[{'role': 'user', 'content':
JURISDICTION_COMPARE_PROMPT.format(
governing_law=governing_law,
contract_text=contract_text
)}]
)
return response.content[0].text시스템 프롬프트의 기밀 유지 조항
법률 회사를 위한 법률 도구를 구축할 때는 고객의 비밀유지 특권을 보호하고 직업적 책임 규정을 준수하도록 시스템 프롬프트에 기밀 유지 조항과 데이터 처리 지침을 포함해야 합니다.
PRIVILEGED_SYSTEM_PROMPT = '''You are a legal research assistant for
{firm_name}, a licensed law firm.
CONFIDENTIALITY NOTICE:
- All documents shared in this session are attorney-client privileged.
- Do not include client names, matter numbers, or identifying details
in any output that may be logged externally.
- Do not store, reference, or infer information from previous sessions.
- Treat all information as confidential per Model Rules of Professional
Conduct 1.6 (Confidentiality of Information).
SCOPE:
- Your role is legal research and document analysis only.
- You do not represent the client and do not provide legal advice directly.
- Flag all outputs with: "Review required by licensed attorney before use."
REFUSAL RULE:
- If asked to draft strategy for concealing evidence or misleading a court,
refuse and explain that this violates professional responsibility rules.'''
print(PRIVILEGED_SYSTEM_PROMPT.format(firm_name='Smith & Associates LLP')[:200])NDA 요약 패턴
비밀유지계약(NDA)은 표준적인 구조를 갖습니다. 대상 추출 프롬프트는 NDA 검토에서 중요한 주요 상업 조건을 추출합니다.
NDA_SUMMARY_PROMPT = '''Summarize this NDA for a business executive.
Extract these exact fields (be concise, max 2 sentences per field):
1. Parties: Who are the disclosing and receiving parties?
2. Purpose: Why is information being shared?
3. Confidential Information Definition: What is and is not covered?
4. Term: How long does confidentiality last?
5. Exclusions: What information is not protected?
6. Return/Destroy: What happens to confidential info after the relationship ends?
7. Remedies: What happens if the NDA is breached?
8. Key Risks: List up to 3 issues that deviate from standard market practice.
NDA Text:
{nda_text}
End with a one-sentence verdict: "This NDA is [FAVORABLE / BALANCED / UNFAVORABLE]
for the receiving party because _____."'''
def summarize_nda(nda_text):
response = client.messages.create(
model='claude-opus-4-5', max_tokens=1500,
system=LEGAL_SYSTEM_PROMPT,
messages=[{'role': 'user', 'content':
NDA_SUMMARY_PROMPT.format(nda_text=nda_text)}]
)
return response.content[0].text피단틱을 사용한 구조화된 법률 출력
법률 분석을 프로그래밍 방식으로 처리해야 하는 처리 흐름에서는 피단틱 모델을 통한 구조화된 출력을 사용하여 모든 항목이 존재하고 올바른 형식으로 지정되도록 합니다.
from pydantic import BaseModel
from typing import List, Optional
from enum import Enum
class RiskLevel(str, Enum):
CRITICAL = 'CRITICAL'
HIGH = 'HIGH'
MEDIUM = 'MEDIUM'
LOW = 'LOW'
class LegalRisk(BaseModel):
title: str
severity: RiskLevel
clause_reference: str
description: str
mitigation: str
class ContractAnalysis(BaseModel):
governing_law: str
contract_type: str
effective_date: Optional[str]
term_years: Optional[float]
risks: List[LegalRisk]
overall_recommendation: str
disclaimer: str = (
'This analysis is informational only and does not constitute '
'legal advice. Consult a licensed attorney before acting.'
)
# Use with structured output (pseudo-code)
# analysis = ContractAnalysis.model_validate_json(llm_response)
# for risk in analysis.risks:
# print(f'[{risk.severity}] {risk.title}: {risk.description}')위험 신호 조항 감지
알려진 위험 신호 계약 조항의 모음을 구축하고 모델에 해당 조항을 감지하도록 지시합니다. 이를 통해 재사용 가능한 실무 지침서를 만들고, 시간이 지나면서 법률 팀의 의견을 반영하여 개선할 수 있습니다.
RED_FLAGS = [
'unlimited indemnification with no cap',
'unilateral right to modify terms without notice',
'IP assignment of all work product ("work for hire" with no carve-outs)',
'non-compete broader than 1 year or 100 miles',
'automatic renewal with short cancellation window (< 30 days)',
'no limitation of liability clause (unlimited damages)',
'mandatory arbitration in unfavorable jurisdiction',
'liquidated damages clause that may be penalty clause under NY law',
]
RED_FLAG_PROMPT = '''Review the contract below for the following red-flag provisions.
For each red flag found, quote the relevant text and rate severity 1-5.
If not found, mark as "Not Present".
Red Flags to Check:
{red_flag_list}
Contract:
{contract_text}'''
def detect_red_flags(contract_text):
flags_text = '\n'.join(f'{i+1}. {f}' for i, f in enumerate(RED_FLAGS))
response = client.messages.create(
model='claude-opus-4-5', max_tokens=2000,
system=LEGAL_SYSTEM_PROMPT,
messages=[{'role': 'user', 'content':
RED_FLAG_PROMPT.format(
red_flag_list=flags_text,
contract_text=contract_text
)}]
)
return response.content[0].text인용 및 법령 참조
법률 분석은 인용을 통해 신뢰성을 얻습니다. 모델에 관련 법령, 규정 및 판례를 인용하도록 지시하고, 인용의 정확성을 확신할 수 없을 때는 항상 표시하도록 합니다.
CITATION_PROMPT = '''Analyze the indemnification clause below under New York law.
For your analysis:
1. Cite the relevant NY statutes (e.g., NY General Obligations Law sections).
2. Reference applicable UCC provisions if relevant.
3. Cite at least one landmark NY case on indemnification interpretation.
4. If you are not certain a citation is accurate, prefix it with
"[VERIFY: " and end with "]" — never fabricate case citations.
5. Distinguish between indemnification for third-party claims vs.
direct damages between the parties.
Indemnification Clause:
{clause_text}'''
# Best practice: always post-process LLM citations with a legal database check
# (Westlaw, LexisNexis API) before relying on them in actual legal work
print('REMINDER: Always verify LLM-generated citations with a legal database.')필수 면책 고지 삽입
모든 법률 인공지능 출력에는 면책 고지가 포함되어야 합니다. 응용 프로그램 계층에서 프로그래밍 방식으로 삽입하고, 매번 포함하도록 모델에 의존하지 마십시오. 이렇게 하면 면책 고지가 실수로 누락되는 일이 없습니다.
LEGAL_DISCLAIMER = (
'\n\n---\n'
'DISCLAIMER: This analysis is generated by an AI system and is '
'provided for informational purposes only. It does not constitute '
'legal advice and does not create an attorney-client relationship. '
'Laws vary by jurisdiction and change over time. Always consult a '
'licensed attorney in your jurisdiction before making legal decisions.'
)
def get_legal_analysis(prompt, system_prompt=LEGAL_SYSTEM_PROMPT):
response = client.messages.create(
model='claude-opus-4-5',
max_tokens=2000,
system=system_prompt,
messages=[{'role': 'user', 'content': prompt}]
)
raw_output = response.content[0].text
# Always inject disclaimer at application layer
return raw_output + LEGAL_DISCLAIMER
analysis = get_legal_analysis('Summarize the key risks in this contract: ...')
print(analysis[-200:]) # Shows disclaimer at end빠른 확인
법률 인공지능 도구를 구축할 때 면책 고지는 어디에 삽입해야 합니까?
법률 분야 프롬프트 작성 요약
법률 분야의 프롬프트 작성에는 다음과 같은 필수 패턴이 필요합니다:
- 관할 범위: 시스템 프롬프트에 적용 법률을 명시
- 구조화된 출력: 기계가 처리할 수 있는 분석을 위해 제이슨 또는 번호 매기기 목록 사용
- 위험 신호 조항 모음: 문제가 되는 것으로 알려진 조항의 실무 지침 모음 유지
- 인용 원칙: 인용을 요구하고 불확실한 인용에는 [VERIFY] 표시
- 필수 면책 고지: 모델에 맡기지 않고 응용 프로그램 계층에서 삽입
- 특권 데이터 처리: 시스템 프롬프트에 기밀 유지 지침 포함
자주 묻는 질문
“법률 분야 프롬프트 패턴” 강의는 무료인가요?
네 — “법률 분야 프롬프트 패턴” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 AI Prompt Engineering 강의 전체를 잠금 해제할 수 있습니다. AI Prompt Engineering 강의에는 총 4개의 강의가 포함되어 있습니다.
“법률 분야 프롬프트 패턴”에서 뭘 배우나요?
계약서 분석, 조항 추출, 관할권을 고려한 법률 프롬프트를 다룹니다. 브라우저에서 직접 실행하는 실습 코드로 AI Prompt Engineering을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
AI Prompt Engineering을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 AI Prompt Engineering은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 1번째 강의입니다.
“법률 분야 프롬프트 패턴” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 AI Prompt Engineering 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 AI Prompt Engineering 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.
이 강의의 모든 강의
- 법률 분야 프롬프트 패턴
- 의료 및 임상 프롬프트 작성
- 금융 및 정량 분석 프롬프트
- 분야 용어집 및 온톨로지 주입