compare-documents

Compare legal documents and generate side-by-side diffs, heatmaps, and change logs.

6|Updated Feb 10, 2026
One-click install
npx skills add https://github.com/jdrodriguez/legal-toolkit --skill compare-documents
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: compare-documents
Source: https://github.com/jdrodriguez/legal-toolkit/tree/main/legal-toolkit/skills/compare-documents
Command: npx skills add https://github.com/jdrodriguez/legal-toolkit --skill compare-documents

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires python-docx, pdfplumber, plotly, docx, and includes scripts (resource) components.

What problem does it solve?

Compare two versions of a legal document to quickly surface additions, deletions, and modifications so reviewers can focus on substantive edits instead of manual line-by-line review.

Core Features & Use Cases

  • Extract text from PDF, DOCX, and TXT files and align content at paragraph and word levels for accurate diffs.
  • Produce a side-by-side visual comparison (comparison.html), a change heatmap (change_heatmap.html), a human-readable summary (comparison_summary.txt), and a structured change log (change_log.json) for downstream processing.
  • Use cases include contract version review, policy updates, litigation document tracking, and preparing redlines or change summaries for clients or opposing counsel.

Quick Start

Compare the original and revised files to generate a visual side-by-side diff, heatmap, and structured change log for review.

Frequently Asked Questions about compare-documents

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I compare two versions of a legal document to see what changed?

Compare two legal document versions to surface additions, deletions, and modifications by aligning content at paragraph and word levels. The Skill processes PDF, DOCX, and TXT files to generate visual side-by-side diffs and structured change logs for review.

Can I generate a visual redline and change heatmap for PDF and DOCX files?

Yes, you can generate a visual redline and change heatmap for PDF and DOCX files. The Skill produces comparison.html for side-by-side visual diffs and change_heatmap.html to help reviewers quickly locate substantive edits across document sections.

How do I create a structured change log from a contract version review?

Create a structured change log from a contract version review by processing the original and revised files. The Skill outputs change_log.json containing paragraph- and word-level alignments mapped to document sections, suitable for downstream processing.

Does document comparison work with scanned PDFs or only text-based files?

Document comparison works with text-based PDF, DOCX, and TXT files. The Skill extracts text using pdfplumber and python-docx with graceful fallbacks, but cannot process scanned image-only PDFs that lack an embedded text layer for diff computation.

What is the best way to track textual modifications across policy updates?

The best way to track textual modifications across policy updates is using difflib to compute word-level alignments. The Skill maps changes to document sections and outputs a human-readable comparison_summary.txt alongside visual diffs for redline analysis.

How do I extract text from DOCX and PDF files for diff computation?

Extract text from DOCX and PDF files for diff computation using python-docx and pdfplumber libraries. The Skill applies graceful fallbacks during extraction to handle formatting variations, ensuring accurate paragraph alignment before computing differences.