Install
openclaw skills install contract-risk-reviewContract Risk Analyzer — Upload contract PDF, AI auto-extracts key clauses and annotates risk points, outputs structured risk report (summary + key terms table + 🔴🟠🟡 three-tier risk list). Supports 6 contract types: purchase/sales/service/labor/lease/NDA. Trigger: contract review, contract risk, contract analysis, contract check
openclaw skills install contract-risk-reviewUpload contract PDF → AI auto-extracts key clauses → risk annotation → structured risk report.
No legal judgment — only structured extraction and risk annotation.
# 1. Upload contract PDF and analyze
result = analyze_contract(
pdf_path="/path/to/contract.pdf",
api_key="sk-...", # OpenAI-compatible API Key (user-provided)
base_url="https://api.openai.com/v1",
model="gpt-4o-mini",
user_focus="payment cycle and breach liability",
)
# result returns:
# {
# "contract_type": "Purchase Contract",
# "summary": "This contract is a purchase agreement between XXX and YYY for...",
# "key_terms": [
# {"category": "Parties", "content": "...", "risk": ""},
# ...
# ],
# "risks": [
# {"level": "🔴", "item": "Amount clause left blank", "suggestion": "..."},
# ...
# ],
# "report_markdown": "..." # Full report in Markdown
# }
# 2. Push Feishu card (optional)
send_feishu_notification(
open_id="ou_xxx",
report_markdown=result["report_markdown"],
contract_type=result["contract_type"],
)
User: Review this purchase contract
[upload contract.pdf]
→ PDF text extraction → type detection → AI extraction → risk annotation → Returns: risk report (summary + key terms table + risk list)
User: Review this labor contract and send me the report
[upload labor_contract.pdf]
→ Analysis complete → Feishu interactive card pushed to user
# Contract Risk Review Report
**Contract Type:** Purchase Contract
**Review Date:** 2026-04-20
**Disclaimer:** Auto-generated by AI, for reference only, not legal advice.
## 1. Summary
[200-word summary of core contract content]
## 2. Key Terms
| Category | Content | Risk Note |
|----------|---------|-----------|
| Parties | Party A: XXX Co. | — |
| Amount | ¥100,000 | — |
| Payment Terms | Within 30 days after signing | ⚠️ No specific latest payment date |
| Breach Liability | Breaching party compensates losses | ⚠️ No liquidated damages clause |
| ... | ... | ... |
## 3. Risk Points
### 🔴 High Risk (Requires Attention)
1. **Amount clause blank**: Contract amount not fully stated...
2. **Unilateral breach liability**: Party A's liability significantly lighter than Party B's...
### 🟠 Medium Risk (Review Recommended)
1. **Payment without clear deadline**: ...
2. **NDA period exceeds 2 years**: ...
### 🟡 Low Risk (Note)
1. **No termination clause**: ...
| Contract Type | Core Fields |
|---|---|
| Purchase | Party A, Party B, items, amount, payment terms, delivery, quality standards, breach liability |
| Sales | Party A, Party B, items, amount, payment terms, delivery, quality warranty, breach liability |
| Service | Party A, Party B, services, amount, payment terms, service period, acceptance criteria, breach liability |
| Labor | Employer, Employee, position, salary, work location, work hours, contract term, social insurance |
| Lease | Landlord, Tenant, property, rent, deposit, term, renewal, maintenance responsibility |
| NDA | Party A, Party B, confidential content, period, scope, breach liability |
from scripts.pdf_extractor import extract_text
# PyMuPDF primary, pdfplumber fallback
text = extract_text(pdf_path)
from scripts.ai_extractor import extract_fields
fields = extract_fields(
text=contract_text,
contract_type="Purchase",
api_key="sk-...",
base_url="https://api.openai.com/v1",
model="gpt-4o-mini",
)
from scripts.risk_analyzer import annotate_risks
risks = annotate_risks(
text=contract_text,
fields=extracted_fields,
)
from scripts.report_generator import generate_report
report = generate_report(
contract_type=contract_type,
summary=summary,
key_terms=key_terms,
risks=risks,
)
from scripts.feishu_notifier import send_feishu_notification
notification = send_feishu_notification(
open_id="ou_xxx",
report_markdown=report_markdown,
contract_type=contract_type,
contract_name="Contract Name",
risk_summary={"🔴": 1, "🟠": 2, "🟡": 0},
top_risks=[{"level": "🔴", "item": "High risk item"}],
)
# Agent sends via feishu_im_user_message tool:
feishu_im_user_message(
action="send",
receive_id_type="open_id",
receive_id=notification["open_id"],
msg_type="interactive",
content=notification["card_json"],
)
Graceful degradation: If Feishu authorization is not granted, only output local report — do not error out.
Users provide their own API key (OpenAI-compatible), supports:
| Tier | Price | Contracts/Mo | Features |
|---|---|---|---|
| Free | ¥0 | 3/mo | Basic risk annotation, text summary |
| Standard | ¥29/mo | 30/mo | 6 contract types, Excel report |
| Pro | ¥99/mo | 200/mo | Batch processing, risk comparison |
| Max | ¥299/mo | Unlimited | API priority |
Q: Are scanned PDFs supported? A: Basic support for text-based PDFs. Scanned documents need OCR — pair with miaoda-doc-parse skill.
Q: Are English contracts supported? A: Yes, configure a model that supports English in base_url.
Q: Is contract content stored? A: No — content is processed and deleted immediately, fully compliant with data privacy requirements.
Q: How is API configured? A: User passes api_key at call time via the api_key parameter, supports OpenAI-compatible endpoints.
Q: Can multiple contracts be processed in batch? A: Pro tier supports batch processing — upload multiple PDFs and generate comparison reports.
contract-risk-analyzer/
├── SKILL.md
├── README.md
├── references/
│ ├── contract_types.md
│ └── risk_library.md
└── scripts/
├── main.py # Entry: analyze_contract()
├── pdf_extractor.py # PyMuPDF + pdfplumber text extraction
├── contract_type_detector.py # Type detection
├── ai_extractor.py # AI field extraction
├── risk_analyzer.py # Risk annotation
├── report_generator.py # Report generation
├── feishu_notifier.py # Feishu card push
└── test_contract_analyzer.py
MIT
For paid plans, visit YK-Global.com