Document Comparison
When to Use
Use this skill when:
- The user uploads two versions of the same document
- The user says /compare
- The user asks "what changed", "what's different", or "show me the differences"
- The user asks for a redline or tracked-changes document
- The user received a counterparty markup and wants to understand the changes
Process
- Identify the two documents — ask the user which is the original and which is the revised version if not clear
- Read both documents via
read_document - Run
comparewith both document paths or texts — this returns a structured diff, similarity percentage, and visual output - Analyze the differences:
- What was added, removed, or modified?
- Which changes are substantive vs. editorial?
- Are any changes risky or favorable?
- Do changes align with playbook positions (if available in context)?
- Present findings with a summary of key changes
- If user wants a Word redline — call
run_code(default Python) to generate a DOCX with tracked changes. Open the original with python-docx, compute a diff against the revised text, and insertw:ins/w:deltracked-change markup via lxml. See/docx-editingskill for OOXML tracked change patterns. Verify the output with structural checks.
Output Format
- Summary: Overall similarity %, number of changes, nature of changes (substantive vs. editorial)
- Key Changes: List of the most significant changes with assessment:
- What changed
- Why it matters (risk/benefit)
- Recommendation (accept / reject / negotiate)
- Full Change List: All detected changes in order
- Action Items: What to do next (accept, push back, request clarification)
Guidelines
- Always present the original vs. revised framing clearly
- Distinguish substantive changes (liability caps, notice periods, governing law) from editorial changes (formatting, numbering, defined terms)
- Prioritize substantive changes in the summary
- If playbook is available, flag changes that deviate from firm positions
- When producing a DOCX redline, confirm which direction the user wants (their changes tracked, or counterparty changes tracked)