mcpField
C
compare-docs

compare-docs

github.com/lennonliDocuments1168 installsUpdated 40w ago
Repository

About compare-docs

A document comparison skill that identifies substantive differences, errors, and inconsistencies across two files. It is intended for reviewing contracts, financial reports, and revised documents, with optional focus areas and a generated report.

Key features

  1. 01Compare DOCX, PDF, Markdown, and text files
  2. 02Extract DOCX content with pandoc
  3. 03Check numbers, dates, clauses, and definitions
  4. 04Create a structured Markdown comparison report
  5. 05Convert the report to DOCX

Use cases

  1. 01Reviewing revised legal contracts
  2. 02Checking financial reports for changed figures
  3. 03Comparing document versions with a chosen focus

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/lennonli/compare-docs --skill compare-docs

After installing, type/compare-docsin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

.gitignore
README.md
scripts/
compare_docs.py
scripts/comparators/
spell_check.py
llm_client.py
logic_check.py
consistency_check.py
fuzzy_logic.py
scripts/parsers/
office_parser.py
section_chunker.py
table_parser.py
scripts/reporters/
md_reporter.py
scripts/utils/
nlp_utils.py

Details

From the project README

Document Comparison Skill

This skill compares two documents to find substantive differences, errors, or inconsistencies. It is particularly useful for legal contracts, financial reports, or revised document versions.

Usage

# Compare two specific files
/compare-docs file1.docx file2.docx

# Compare with specific focus
/compare-docs file1.docx file2.docx --focus "financial data"

Workflow

  1. Input Verification:

    • Verify both input files exist.
    • Determine file type (.docx, .pdf, .md, .txt).
  2. Content Extraction:

    • If files are .docx, use pandoc to convert them to Markdown for clear text analysis.
      pandoc -t markdown "file1.docx" -o "file1.md"
      pandoc -t markdown "file2.docx" -o "file2.md"
      
    • If files are .pdf, use available PDF reading tools.
  3. Analysis & Comparison:

    • Read the extracted content.
    • Compare the documents section by section or key-value by key-value.
    • Focus Areas:
      • Numbers & Dates: Check for discrepancies in financial figures, dates, percentages, and quantities.
      • Key Clauses: Identify added, removed, or modified clauses (especially in legal/contractual contexts).
      • Definitions: Check for changes in defined terms.
    • Note: Ignore minor formatting changes unless explicitly requested.
  4. Report Generation:

    • Create a Markdown report (comparison_report.md) structured as follows:
      • Summary: Brief overview of the comparison result.
      • Critical Differences (High Risk): Data mismatches, missing clauses, conflicting obligations.
      • Substantive Changes: Changes in meaning or scope.
      • Stylistic/Format Changes: (Optional) Brief mention of layout or phrasing changes that don't alter meaning.
      • Recommendations: Actionable advice based on findings.
  5. Output formatting & Delivery:

    • Convert the Markdown report to a professional .docx document using pandoc.
      pandoc "comparison_report.md" -o "Comparison_Report.docx"
      
    • Open the file: Automatically open the generated document so the user can view it immediately.
      • On macOS: open "Comparison_Report.docx"
      • On Windows: start "Comparison_Report.docx"
      • On Linux: xdg-open "Comparison_Report.docx"
    • Inform the user of the report location.
  6. Cleanup:

    • Remove temporary intermediate files (e.g., converted .md files) to keep the workspace clean.

Example Output Structure

Comparison Report

1. Executive Summary

...

2. Key Discrepancies

ItemFile A ValueFile B ValueImpact
Revenue$10M$12MSignificant
............

3. Detailed Clause Analysis

...

Comments

Markdown supported