Contract Compare: Agent-Based Contract Clause-Level Difference Comparison

Preface

Contract revisions often span multiple rounds: legal drafts a version, the business team revises it, and ultimately, the signature page may not match the main text. Manually cross-referencing PDFs or Word documents clause by clause is time-consuming and prone to missing details like “a deleted breach liability clause.” While general conversational models can assist in reading documents, they lack fixed parsing, clause segmentation, and structured output, leading to inconsistent results that are difficult to integrate directly into approval workflows.

Below is an introduction to the SkillHub community skill Contract Compare (coordinates @user_26bdbd50/contract-compare, version 1.0.0). It provides a unified SKILL.md workflow on the Agent side and includes an executable Python comparison script to generate Markdown diff reports from two or more contracts. In paid tiers, it also supports Excel export and risk assessment.

What is this

Contract Compare (also referred to as “合同智能比对 / Contract Smart Compare” within the package) is an AI diff analysis Skill designed for contract documents: it automatically identifies numbered clauses, compares additions, deletions, and modifications, and generates structured reports.

  • Source: SkillHub Community (community), Publisher user_26bdbd50
  • Category: professional
  • Platform Info (SkillHub page and index): Rating 100000, 792 downloads; Tags include requires_api_key=true, indicating that a Large Language Model API Key must be configured to run the comparison.

Official Access:

  • SkillHub Page: https://www.skillhub.cn/skills/user_26bdbd50/contract-compare
  • Skill Coordinate Page: https://api.skillhub.cn/user_26bdbd50/contract-compare

Core Features

The following capabilities are derived from the SKILL.md and implementation notes within the skill package, categorized by subscription plan.

Clause Extraction and Comparison

  1. Smart Clause Extraction: Identifies numbered clauses such as “Article 1 / Article X”; supports TXT and DOCX; STANDARD and above support PDF; STANDARD and above support OCR for JPG/PNG scans.
  2. Diff Classification: Compares clause by clause, marking added, deleted, and modified clauses; PRO supports multi-version timelines (3 or more versions).
  3. Risk Assessment and Summary (PRO): Provides high/medium/low risk judgments for diff clauses and generates summaries of key clauses.
  4. Output Formats: All tiers support Markdown output; STANDARD+ supports Excel export; PRO offers additional risk summary reports.

Plans and Limitations (Official Pricing Table)

Plan Monthly Fee Key Points
FREE Free 5 times/month, 2 contracts, TXT/DOCX only, Markdown report
STANDARD ¥29/month Unlimited usage, PDF/Image OCR, Diff classification, Excel export
PRO ¥99/month All STANDARD capabilities + Multi-version comparison, Risk assessment, Key clause summary

STANDARD/PRO require a subscription Token CONTRACT_COMPARE_TOKEN (prefix CONTRACT-COMPARE-), validated via the yk-global API. Paid subscription details can be found in the skill documentation at YK-Global.com.

Installation and Activation

1. Install SkillHub CLI (if not already installed)

command -v skillhub && skillhub --version

If not installed, follow the official SkillHub instructions (full installation example):

curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash

2. Install Contract Compare

When installing, you must use --dir to point to the current Agent’s skills directory; otherwise, it defaults to ./skills/ which may not be recognized.

skillhub install contract-compare --namespace user_26bdbd50 --dir ~/.cursor/skills/

Other common paths (from SkillHub installation docs): Claude Code uses ~/.claude/skills/; Codex uses ~/.codex/skills/ or .agents/skills/ under the project. Replace --dir based on your actual client.

You can also let the Agent install it via official prompts: refer to https://skillhub.cn/install/skillhub.md and install @user_26bdbd50/contract-compare.

3. Python Dependencies and OCR (Optional)

Enter the skill directory and install dependencies:

pip install -r requirements.txt

For image OCR, Tesseract must also be installed locally (the skill documentation provides example commands for Ubuntu/macOS).

4. Environment Variables

Variable Name Description Required
OPENAI_API_KEY OpenAI API Key One of (OpenAI or Anthropic)
ANTHROPIC_API_KEY Anthropic API Key One of (OpenAI or Anthropic)
CONTRACT_COMPARE_TOKEN STANDARD/PRO Monthly Token Required for paid tiers
CLAUDE_MODEL Model name, defaults to claude-sonnet-4-20250514 Optional

AI comparison uses user-provided keys; the skill documentation states that keys are not stored or transmitted by the Skill. Uploaded files default to the /tmp/contract-compare/ temporary directory.

Typical Usage

In the skill root directory, call via python -m src.main (path matches SKILL.md).

Two Contract Comparison

python -m src.main compare contract_a.pdf contract_b.pdf --label-a "合同V1" --label-b "合同V2"

Specify output file:

python -m src.main compare contract_a.docx contract_b.docx -o diff_report.md

STANDARD+ exports Excel simultaneously:

python -m src.main compare contract_a.pdf contract_b.pdf --excel -o report/

PRO output includes unchanged clauses:

python -m src.main compare contract_a.docx contract_b.docx --include-same -o full_report.md

Multi-version Comparison (PRO)

python -m src.main multi v1.pdf v2.pdf v3.pdf \
  --labels "初稿" "修改版" "终稿" \
  --dates "2024-01-01" "2024-03-15" "2024-06-01" \
  --output multi_version_report.md \
  --excel

Parse Contract Text Only

python -m src.main parse contract.pdf --max-chars 3000

In Agents like Cursor, after installing the Skill, you can directly provide two contract paths or attachments in the conversation. The Agent will guide the selection of commands and output formats according to SKILL.md; specific interaction depends on whether the client loads the skills directory into the context.

Use Cases and Notes

Who is it for

  • Legal, Business, and Project Managers: Need to compare diff lists between revisions and final drafts, or texts from two rounds of negotiation.
  • Teams already using environments supporting Skills (like Cursor / Claude Code) who want to solidify “read contract + generate report” into a repeatable process.

Limitations and Notes

  1. API Key: requires_api_key=true; AI comparison cannot be completed without configuring OPENAI_API_KEY or ANTHROPIC_API_KEY.
  2. Format and Tier: FREE is TXT/DOCX only, with limits of 5 times/month and 2 files per session; PDF/OCR/Excel/Multi-version/Risk features require STANDARD or PRO.
  3. File Size: The implementation caps single files at 10MB (config.py).
  4. Tech Stack: PDF relies on PyMuPDF, pdfplumber; Word uses python-docx; Excel uses openpyxl; Network request timeout is 10 seconds.
  5. Community Source: The publisher is community user user_26bdbd50. Please review the skill package code and external transmission policies against enterprise compliance requirements before use.

Conclusion

Contract Compare converges contract comparison from “manual page flipping” to “clause-level diffs + optional risk and Excel,” suitable for hanging in Agent Skills for repeatable review assistance. Installation uses the SkillHub coordinate @user_26bdbd50/contract-compare. Comparison details are subject to the SKILL.md within the package.

Official Page: https://www.skillhub.cn/skills/user_26bdbd50/contract-compare

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye