All skills
zh-xx avatar

/contract-review

@a6fab73
by Jee Czh-xx/legal-assistant-skills173 stars
22

Contract review skill that adds comment-based issue annotations without changing original text. Enforces a four-layer review (entity verification, basic, business, legal), writes structured comments (issue type, risk reason, revision suggestion) with risk level encoded via reviewer name, and generates a contract summary, consolidated opinion, and Mermaid business flowchart (with rendered image). Output language must follow the contract’s language.

Use this Skill: https://skilld.dev/gh/zh-xx/legal-assistant-skills/contract-review

This session only. Nothing lands on disk.

referencesexamples.md

≈1.4k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Contract Review Examples

Quick Start

# -*- coding: utf-8 -*-
from scripts.workflow import ContractReviewWorkflow

comments = [
    {
        "search": "Total Price",
        "comment": """[Issue Type] Payment Terms
[Risk Reason] The total amount is stated as USD 100,000 in Section 3.2, but the payment clause lists USD 1,000,000 in Section 5.1.
[Revision Suggestion] Align the total amount across clauses and clarify tax inclusion.""",
        "risk_level": "High",
    }
]

workflow = ContractReviewWorkflow("Contract.docx", "Reviewer")
workflow.run_full_workflow(comments, "Contract_Reviewed.docx")

Contract Summary (English)

# -*- coding: utf-8 -*-
summary_text = """I. Basic Contract Information
Item\tContent
Contract Name\tNot specified
Contract Type\tNot specified
Parties\tParty A: Not specified
Party B: Not specified
Signing Date\tNot specified
Term\tNot specified
Contract Amount\tNot specified
II. Business Model Overview
Brief description: Not specified
III. Key Clause Elements
3.1 Transaction Elements
Element\tDetails
Subject Matter/Services\tNot specified
Quantity/Specs\tNot specified
Pricing Structure\tNot specified
Payment Terms\tNot specified
Delivery Terms\tNot specified
3.2 Rights and Obligations
Party A main rights/obligations:
Not specified
Party B main rights/obligations:
Not specified
3.3 Performance Safeguards
Clause Type\tDetails
Liability/Default\tNot specified
Guarantees/Security\tNot specified
Acceptance Standards\tNot specified
Quality Warranty\tNot specified
3.4 Risk Allocation & Special Terms
Risk Allocation:
Not specified
Special Terms:
Not specified
3.5 Dispute Resolution & Termination
Item\tDetails
Dispute Resolution\tNot specified
Amendment\tNot specified
Termination\tNot specified
Governing Law\tNot specified
IV. Key Timeline Milestones
Not specified
"""

workflow = ContractReviewWorkflow("Contract.docx", "Reviewer")
workflow.run_full_workflow(
    comments,
    "Contract_Reviewed.docx",
    summary_text=summary_text,
    summary_filename="Contract_Summary.docx",
    summary_font="Times New Roman",
)

Consolidated Opinion (English)

# -*- coding: utf-8 -*-
opinion_text = """This agreement is a goods sales contract under which our side purchases specific devices from the counterparty for a total amount of USD 100,000, payable as a 30% prepayment and 70% balance after acceptance, with delivery and acceptance milestones defined in the contract.

After review, the following key risks require attention: 1. Product model names are inconsistent across clauses, which may cause delivery disputes; 2. The prepayment amount does not match the stated percentage, potentially causing payment execution issues; 3. Delivery timing is stated as “reasonable time,” which is ambiguous and may lead to delay disputes."""

workflow = ContractReviewWorkflow("Contract.docx", "Reviewer")
workflow.run_full_workflow(
    comments,
    "Contract_reviewed.docx",
    opinion_text=opinion_text,
    opinion_filename="Consolidated_Opinion.docx",
    opinion_font="Times New Roman",
)

Business Flowchart (Mermaid)

# -*- coding: utf-8 -*-
flowchart_mermaid = """flowchart TD
    A[Contract Signed] -->|?| B[Performance]
"""

workflow = ContractReviewWorkflow("Contract.docx", "Reviewer")
workflow.run_full_workflow(
    comments,
    "Contract_reviewed.docx",
    flowchart_mermaid=flowchart_mermaid,
)

Full Workflow Example

# -*- coding: utf-8 -*-
#!/usr/bin/env python3
import sys
from pathlib import Path

skill_dir = Path(__file__).parent.parent
sys.path.insert(0, str(skill_dir))

from scripts.workflow import ContractReviewWorkflow

contract_path = "path/to/contract.docx"
output_path = "contract_reviewed.docx"
report_path = "review_report.txt"
reviewer = "Reviewer"

comments = [
    {
        "search": "Total Price",
        "comment": """[Issue Type] Payment Terms
[Risk Reason] Amount mismatch between pricing and payment clauses.
[Revision Suggestion] Align total amount and clarify tax.""",
        "risk_level": "High"
    }
]

summary_text = """I. Basic Contract Information
Item\tContent
Contract Name\tNot specified
Contract Type\tNot specified
Parties\tParty A: Not specified
Party B: Not specified
Signing Date\tNot specified
Term\tNot specified
Contract Amount\tNot specified
"""

opinion_text = """This agreement is a services contract between our side and the counterparty with defined scope, pricing, and milestones.

After review, the following key risks require attention: 1. Payment timing is unclear; 2. Acceptance criteria are missing."""

flowchart_mermaid = """flowchart TD
    A[Contract Signed] -->|?| B[Performance]
"""

workflow = ContractReviewWorkflow(
    contract_path=contract_path,
    reviewer_name=reviewer,
    enable_smart_keyword_expansion=False,
)

workflow.run_full_workflow(
    comments=comments,
    output_docx_filename=output_path,
    report_filename=report_path,
    summary_text=summary_text,
    summary_filename="Contract_Summary.docx",
    summary_font="Times New Roman",
    opinion_text=opinion_text,
    opinion_filename="Consolidated_Opinion.docx",
    opinion_font="Times New Roman",
    flowchart_mermaid=flowchart_mermaid,
    render_flowchart=True,
    parallel_outputs=True,
)

print(f"✓ Added comments: {len(workflow.comments_added)}")
print(f"✗ Failed comments: {len(workflow.comments_failed)}")

Language Notes

  • Output must follow the contract’s language.
  • For Chinese contracts, use the Chinese labels in language.md and set summary_font / opinion_font to Fangsong (仿宋).

Source: SKILL.md on GitHub

1 warning16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The skill is a contract review utility that processes .docx files using local tools like pandoc and Mermaid CLI. It demonstrates good security practices by using the defusedxml library to handle XML safely and restricts its shell commands to specific, necessary utilities. No malicious behavior was detected.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: MEDIUM · 1 issue

  • Runlayer7mo

    1/26 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at a6fab73. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Steadyupdated 7 months ago

README badge

README badge for zh-xx/legal-assistant-skills/contract-review