CommunityResearch & Data Analysisgithub.com

liusite66-dev/compare-contract-risk-migration-skill

Agent Skill: Compare 2 to 5 versions of Chinese commercial contracts, semantically align clauses, and generate a traceable XLSX risk migration report.

What is compare-contract-risk-migration-skill?

This skill enables an AI agent to compare multiple versions (2–5) of Chinese commercial contracts, perform semantic clause alignment, and produce a structured XLSX risk migration report that is fully traceable. It is designed for use with AI coding agents like Claude Code, Cursor, or similar platforms that support user-defined skills and script execution. The skill enforces a strict workflow: the user must provide an explicit version order and analysis stance (buyer/seller/neutral); the agent may connect to authorized legal databases (e.g., PKULaw, Wolters Kluwer) as MCP sources, but falls back to official public sources; it uses a Python pipeline to prepare contract bundles, run risk rules from a reference document, and generate the final report. The output captures clause-level changes (added, deleted, modified, split, merged, restored) with deterministic risk statuses and severity levels, while marking low-confidence matches for manual review. It does not modify original contracts, generate redlined DOCX, or judge signature validity. The skill is most suitable for general commercial contracts (sale, service, licensing, SaaS, NDA) but warns users that specialized contracts require expert review.

Works with~Claude Code~Codex CLI~Cursor
npx skills add liusite66-dev/compare-contract-risk-migration-skill

Installed? Explore more Research & Data Analysis skills: affaan-m/uspto-database, affaan-m/scholar-evaluation, affaan-m/literature-review · View all 6 →

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

/compare-contract-risk-migration-skill

Compare 2–5 versions of Chinese general-purpose commercial contracts that the user has explicitly ordered, and generate a traceable risk migration XLSX.

Safety Gate

Before reading any contract, state whether the current environment is local or a cloud-based agent. In a cloud environment, you must explicitly inform the user that the contract will be read by the cloud model and obtain their confirmation for this session. Do not preview, convert, or hash the contract without confirmation. It is recommended to first redact trade secrets and personal information.

Workflow

  1. Obtain from the user the explicit version order, analysis stance (buyer/seller/neutral), contract name, and attachment affiliation. Do not sort by filename or modification time on behalf of the user.
  2. Prompt the user to connect to legally authorized databases such as PKULaw, Wolters Kluwer (Wolters Kluwer), Yuandian Legal Intelligence, or other regulatory database MCP/API. If none is provided or all calls fail, use official public sources from the National People's Congress, the State Council, the Supreme People's Court, regulatory agencies, and similar bodies.
  3. Run python3 scripts/run_pipeline.py prepare .... Use version_label=file_path for each --version parameter; use --attachment version_label=file_path for attachments.
  4. Read contract-bundle.json and its temporary Markdown. Read references/analysis-schema.md for the required output contract, and read references/risk-rules.md for deterministic risk floors.
  5. First extract clauses by contract components and clause levels, then combine title, number, definition, cross-references, text similarity, and context to establish a stable clause_id. Low-confidence or multi-candidate matches must be marked as Needs manual confirmation.
  6. Identify additions, deletions, modifications, moves, splits, merges, and restorations between adjacent versions. Format-only changes are listed separately; cross-reference failures caused by renumbering are substantive risks.
  7. The risk migration status can only be: New risk, Risk increased, Risk reduced, Risk transferred, Risk eliminated, Risk continued, Risk recurring, Pending confirmation. The risk level can only be: High, Medium, Low. When a deterministic rule floor is triggered, do not downgrade the level.
  8. Retrieve information only for high-risk changes, suspected mandatory regulatory issues, and matters that require determining legal effects. Read references/source-policy.md for MCP/public fallback and provenance requirements. When sources conflict, keep them in parallel and mark them as needing manual confirmation.
  9. Output modification direction and negotiation points, do not generate full replacement clauses. After generating JSON that complies with the analysis contract, run python3 scripts/run_pipeline.py report ... --cleanup.
  10. Only report to the user the output path, risk migration statistics, high-risk items, and pending matches; remind the user that the XLSX still contains trade secrets.

Boundaries

  • Applicable to general-purpose commercial contracts such as sales, services, licensing, SaaS, and NDAs.
  • For specialized contracts such as labor, investment and financing, M&A, construction, finance, and cross-border, only perform text migration and advise the user to seek specialized review.
  • Do not modify original contracts, do not generate redlined DOCX, and do not judge signature authenticity, effectiveness status, or full compliance of unchanged clauses.
  • Do not save account credentials, passwords, cookies, tokens, or MCP authentication information. Do not use model memory as a definitive legal basis.
  • If neither network nor MCP is available, continue version comparison and clearly mark the unchecked scope in the report.

Gotchas

  • MarkItDown does not guarantee stable original page numbers for PDF/DOCX; when positioning is unstable, write "page number needs manual confirmation."
  • Clause renumbering, movement, splitting, and merging cannot be judged solely by line-by-line diff.
  • The user-specified version order is the sole source of ordering; file timestamps are only recorded, not used for sorting.
  • This skill only reviews risks arising from changes; it is not equivalent to a full contract review.

Related Skills