πŸ“„

Document Diff Checker

Compare two Word/Text files (e.g., Old vs New Contract) to highlight edits, deletions, and additions.

Document ⭐⭐⭐ Advanced ⏱️ 5 minutes

😫 The Pain Point

The client sent back Contract_v2.docx with changes. You need to know exactly what they changed compared to Contract_v1.docx. Opening two windows side-by-side and scanning line-by-line is exhausting and prone to missing subtle edits.

πŸš€ Agentic Solution

The β€œSpot the Difference” Tool: Reads the content of two files and generates a highlighted report (Deleted/Added).

Key Features:

  • Line-by-Line: Compares text structure.
  • HTML Report: Exports a web-based view (like GitHub Diff): Green for Added, Red for Deleted.

βš”οΈ Phase 1: Commander (Quick Fix)

For a quick text comparison.

Prompt:

β€œI have two large text files: text1.txt and text2.txt. Write a Python script using difflib to generate a diff.html file showing the side-by-side comparison of these files.”

Result: An HTML report file you can open in Chrome.

πŸ—οΈ Phase 2: Architect (Permanent Tool)

For Legal/Admin teams.

Engineering Prompt:

**Role:** Python Tool Developer
**Task:** Create a "Document Comparison Tool" (Word/Text).
**Requirements:**
1.  **GUI:**
    *   Select Original File (A).
    *   Select Modified File (B).
    *   "Compare" button.
2.  **Logic:**
    *   Convert .docx to plain text (using `python-docx`).
    *   Use `difflib.HtmlDiff()` to generate a comparison report.
    *   Save report as `Report_[Timestamp].html` and auto-open it in the default browser.
3.  **Deliverables:** `diff_tool.py`, `run.bat` (Windows), `run.sh` (Mac).

🧠 Prompt Decoding

  • Difflib: A powerful standard Python library. It has a built-in HtmlDiff class that does 90% of the hard work (generating the UI). You don’t need to code a complex GUI, just generate the HTML and open it.

πŸ› οΈ Instructions

  1. Copy Prompt -> Paste -> Run.
  2. Select 2 Files -> Compare -> View Report.

Related Workflows

Explore other categories

πŸ“¬

Get Started with Agentic Working

Subscribe to receive updates from AgenticWorking.io

πŸ“– Free eBook Guide πŸ“¦ 7 Ready-to-use Scripts πŸ”” Weekly Tips

No spam, unsubscribe anytime. Join 1,000+ subscribers.