contract-clause-analyzer
БесплатноБез исполняемых скриптовНе проверенAnalyze construction contract clauses. Identify risks, obligations, and key terms using NLP.
от datadrivenconstruction★ 461 звезда на GitHubОб этом скилле
Contract Clause Analyzer
Business Case
Problem Statement
Contract review is time-consuming and error-prone:
- Important clauses missed
- Risk provisions overlooked
- Inconsistent interpretation
- Long review cycles
Solution
AI-assisted contract clause analysis that identifies key provisions, flags risks, and extracts critical terms.
Technical Implementation
import pandas as pd
from datetime import datetime, date
from typing import Dict, Any, List, Optional
from dataclasses import dataclass, field
from enum import Enum
import re
class ClauseType(Enum):
SCOPE = "scope"
PAYMENT = "payment"
SCHEDULE = "schedule"
CHANGE_ORDER = "change_order"
TERMINATION = "termination"
INDEMNIFICATION = "indemnification"
INSURANCE = "insurance"
WARRANTY = "warranty"
DISPUTE = "dispute"
LIABILITY = "liability"
FORCE_MAJEURE = "force_majeure"
SAFETY = "safety"
COMPLIANCE = "compliance"
OTHER = "other"
class RiskLevel(Enum):
HIGH = "high"
MEDIUM = "medium"
LOW = "low"
INFO = "info"
@dataclass
class ContractClause:
clause_id: str
section: str
title: str
text: str
clause_type: ClauseType
risk_level: RiskLevel
key_terms: List[str] = field(default_factory=list)
obligations: List[str] = field(default_factory=list)
deadlines: List[str] = field(default_factory=list)
amounts: List[str] = field(default_factory=list)
notes: str = ""
@dataclass
class AnalysisResult:
contract_name: str
analyzed_date: datetime
total_clauses: int
clauses: List[ContractClause]
risk_summary: Dict[str, int]
key_dates: List[Dict[str, str]]
key_amounts: List[Dict[str, str]]
class ContractClauseAnalyzer:
"""Analyze construction contract clauses."""
RISK_KEYWORDS = {
'high': ['indemnify', 'sole discretion', 'waive', 'forfeit', 'liquidated damages',
'consequential', 'unlimited liability', 'hold harmless', 'no limit'],
'medium': ['shall', 'must', 'required', 'obligated', 'responsible', 'liable',
'penalty', 'default', 'breach'],
'low': ['may', 'should', 'reasonable', 'mutual', 'consent', 'approval']
}
CLAUSE_PATTERNS = {
ClauseType.PAYMENT: ['payment', 'invoice', 'retainage', 'progress payment'],
ClauseType.SCHEDULE: ['schedule', 'completion date', 'milestone', 'time is of the essence'],
ClauseType.CHANGE_ORDER: ['change order', 'modification', 'additional work', 'variation'],
ClauseType.TERMINATION: ['termination', 'terminate', 'cancellation'],
ClauseType.INDEMNIFICATION: ['indemnif', 'hold harmless', 'defend'],
ClauseType.INSURANCE: ['insurance', 'coverage', 'policy', 'insured'],
ClauseType.WARRANTY: ['warranty', 'guarantee', 'defect', 'workmanship'],
ClauseType.DISPUTE: ['dispute', 'arbitration', 'mediation', 'litigation'],
ClauseType.LIABILITY: ['liability', 'damages', 'limitation'],
ClauseType.FORCE_MAJEURE: ['force majeure', 'act of god', 'unforeseen'],
}
def __init__(self):
self.clauses: List[ContractClause] = []
def analyze_text(self, contract_name: str, text: str) -> AnalysisResult:
"""Analyze contract text."""
self.clauses = []
# Split into sections/clauses
sections = self._split_into_sections(text)
for i, section in enumerate(sections):
clause = self._analyze_clause(f"CL-{i+1:03d}", section)
self.clauses.append(clause)
# Generate summary
risk_summary = {
'high': sum(1 for c in self.clauses if c.risk_level == RiskLevel.HIGH),
'medium': sum(1 for c in self.clauses if c.risk_level == RiskLevel.MEDIUM),
'low': sum(1 for c in self.clauses if c.risk_level == RiskLevel.LOW)
}
key_dates = []
key_amounts = []
for clause in self.clauses:
for d in clause.deadlines:
key_dates.append({'clause': clause.clause_id, 'date': d})
for a in clause.amounts:
key_amounts.append({'clause': clause.clause_id, 'amount': a})
return AnalysisResult(
contract_name=contract_name,
analyzed_date=datetime.now(),
total_clauses=len(self.clauses),
clauses=self.clauses,
risk_summary=risk_summary,
key_dates=key_dates,
key_amounts=key_amounts
)
def _split_into_sections(self, text: str) -> List[Dict[str, str]]:
"""Split contract into sections."""
sections = []
# Simple split by numbered sections
pattern = r'(\d+\.[\d\.]*\s+[A-Z][^\.]+)'
parts = re.split(pattern, text)
current_title = ""
for i, part in enumerate(parts):
if re.match(r'\d+\.[\d\.]*\s+[A-Z]', part):
current_title = part.strip()
elif part.strip() and current_title:
Установить contract-clause-analyzer в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл contract-clause-analyzer?
Analyze construction contract clauses. Identify risks, obligations, and key terms using NLP.
Как установить скилл contract-clause-analyzer?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл contract-clause-analyzer запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic