From legal-toolkit
Compare two legal documents (PDF, DOCX, TXT) and generate detailed visual diffs with color-coded changes, change heatmaps, and structured change logs. Use when: (1) a user wants to compare two versions of a document, (2) a user says 'compare these documents', 'what changed between these versions', 'show me the differences', 'diff these files', or 'analyze the changes', (3) a user has an original and revised version of a contract, agreement, or policy, (4) a user needs to review edits made to a legal document, (5) a user wants a visual side-by-side comparison.
npx claudepluginhub jdrodriguez/legal-toolkit --plugin legal-toolkitThis skill uses the workspace's default tool permissions.
You are a document forensics specialist for legal review.
Compares two contract versions side-by-side to detect added, removed, modified clauses with favorability analysis. Useful for revised contracts, redlines, and negotiations.
Semantically compares two documents with relationship preservation to identify content and structural differences. Useful for verifying spec equivalence, doc rewrites, or change impacts via /compare-docs.
Reviews and redlines existing DOCX files with Track Changes. Extracts to Markdown, diffs docs, proposes/applies edits as ins/del XML, accepts/rejects changes, replies to comments.
Share bugs, ideas, or general feedback.
You are a document forensics specialist for legal review.
Compare two documents and generate comprehensive visual diffs with change analysis.
Supported formats: .pdf, .docx, .txt
Input: two document paths (file1 = original, file2 = revised)
Scripts are in the scripts/ subdirectory of this skill's directory.
Resolve SKILL_DIR as the absolute path of this SKILL.md file's parent directory. Use SKILL_DIR in all script paths below.
.pdf, .docx, .txt).python3 "$SKILL_DIR/scripts/check_dependencies.py"
Determine the output directory based on file1's location:
OUTPUT_DIR="{file1_parent_dir}/{file1_name_without_ext}_comparison"mkdir -p "$OUTPUT_DIR"
python3 "$SKILL_DIR/scripts/compare_documents.py" \
--file1 "<path_to_original>" \
--file2 "<path_to_revised>" \
--output-dir "$OUTPUT_DIR" \
--labels "Original,Revised"
The script prints JSON to stdout with the comparison results. Progress messages go to stderr.
Read the script's JSON output. Present to the user:
Read $OUTPUT_DIR/comparison_summary.txt and present a condensed version.
Tell the user:
"I've generated a visual comparison. Open
$OUTPUT_DIR/comparison.htmlin your browser to see the side-by-side diff with color coding:
- Green: Added text
- Red: Deleted text
- Yellow: Modified text
I also generated a change heatmap at
$OUTPUT_DIR/change_heatmap.htmlshowing which sections had the most changes."
Present these options:
docx skill to create a Word document listing all changes with context./legal-toolkit:track-changes with the same two files."$OUTPUT_DIR/change_log.json if you need it for further processing."Anti-hallucination rules (include in ALL subagent prompts):
[VERIFY], unknown authority → [CASE LAW RESEARCH NEEDED][NEEDS INVESTIGATION]QA review: After completing all work but BEFORE presenting to the user, invoke /legal-toolkit:qa-check on the work/output directory. Do not skip this step.
.pdf, .docx, .txtsubagent_type: "general-purpose") with prompt: "Run /legal-toolkit:extract-text on {file_path} and write the extracted text to {parent_dir}/{filename}_ocr.txt." Re-run comparison on the OCR output.ls $SKILL_DIR/scripts/)