redline-emailer
Translates contract redlines into client-ready or opposing-counsel emails. Accepts three input modes: (1) a .docx with tracked changes, (2) a redlined PDF…
от bstevescherer★ 43 звезды на GitHub
Установить redline-emailer в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Input Modes
| Mode | Trigger | Input |
|---|---|---|
| A: .docx Tracked Changes | User provides a .docx with Track Changes |
Parse Word XML for w:del/w:ins elements |
| B: Redlined PDF | User provides a .pdf with redline formatting |
Parse PDF for strikethrough/underline/color-coded text |
| C: Verbal Description | User describes changes, no file | Work from the attorney's description |
Auto-detect the mode from what the user provides. See references/intake-questions.md Q1.
Instructions
Step 1: Load References
Read before doing anything:
references/intake-questions.md— short intake flow (4 questions, most auto-detectable)references/email-templates.md— tone guides and structural templates for both recipient typesreferences/validation-rules.md— quality checks per recipient type
Step 2: Run Intake
Follow references/intake-questions.md. This should take 60 seconds or less.
What you must know before proceeding:
- Input mode (auto-detect from file type)
- Recipient: client or opposing counsel
- Contract identity: title, parties
- Special instructions (if any)
Do NOT re-ask questions the attorney already answered in their initial request. If the attorney says "write the redline email for opposing counsel" and drops a .docx, you have all four answers — go straight to Step 3.
Step 3: Extract Changes
This step varies by input mode.
Mode A: .docx with Tracked Changes
Extract changes from Word XML. The .docx format uses the same elements that
redline_engine.py writes — we're reading them instead.
Namespace:
W = 'http://schemas.openxmlformats.org/wordprocessingml/2006/main'
Element patterns:
<w:del>→<w:r>→<w:delText>= deleted text<w:ins>→<w:r>→<w:t>= inserted text
Extraction approach:
- Load the .docx with
python-docx:doc = Document(filepath) - Walk
doc.element.bodylooking for{W}deland{W}inselements - Substitutions: When
w:delandw:insare siblings in the samew:p, they represent a substitution (old → new) - Pure deletions: A
w:delwith no adjacentw:ins= text was removed - Pure additions: A
w:inswith no adjacentw:del= text was added - Comments: Parse
word/comments.xmlfrom the .docx zip archive forw:commentelements — these provide reviewer context for each change. Match comments to changes viaw:commentRangeStart/w:commentReferenceIDs.
Grouping: For each change, find the nearest preceding paragraph with a
heading style (e.g., Heading 1, Heading 2) to determine which contract
section it belongs to. If no heading styles are used, fall back to pattern
matching: "Section X.X", "Article Y", numbered paragraphs.
Output: A structured change list:
[
{ section: "Section 4.2 — Limitation of Liability",
type: "substitution",
old: "twelve (12) months",
new: "twenty-four (24) months",
comment: "Per client instruction — doubled the liability cap" },
...
]
Mode B: Redlined PDF
Parse the PDF for redline formatting. Redlined PDFs come in two flavors — detect which one and apply the right strategy.
Format detection: Scan the first 2-3 pages using PyMuPDF (fitz):
import fitz
doc = fitz.open(filepath)
page = doc[0]
blocks = page.get_text("dict")["blocks"]
Check text spans for formatting flags:
- Strikethrough flag present → Strikethrough + underline format
- Red/colored text without strikethrough → Track Changes exported to PDF
- Neither → Uncertain format (trigger fallback)
Strikethrough + underline format:
- Spans with strikethrough flag = deleted text
- Spans with underline flag (especially if also colored/red) = inserted text
- The
fitzspanflagsfield: bit 0x100 = strikethrough (check viaspan["flags"] & 2**8) - Group by surrounding text context and section headings
Track Changes exported to PDF:
- Look for visual patterns: red text, margin annotations, inline "[Deleted: ...]" text
- Balloon-style comments in margins may appear as separate text blocks positioned outside the main content area (check x-coordinate relative to page margins)
- This format is harder to parse reliably — extract what you can
Fallback (uncertain format or low-confidence extraction): Present the extracted text to the attorney:
"I extracted the following text from the PDF but I'm not fully confident in which parts are additions vs. deletions. Can you confirm or correct?"
Show the extracted text with your best guess at markup, and let the attorney correct before proceeding to email generation.
Grouping: Same heading/section detection as Mode A, applied to the PDF text flow.
Mode C: Verbal Description
No document processing. The attorney describes the changes. Structure their
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- README.md
- reference/email-templates.md
- reference/intake-questions.md
- reference/validation-rules.md
- skill.yml
FAQ
Что делает скилл redline-emailer?
Translates contract redlines into client-ready or opposing-counsel emails. Accepts three input modes: (1) a .docx with tracked changes, (2) a redlined PDF with strikethrough/underline formatting, or (3) a verbal description of changes. Produces a copy-paste-ready email, tone-matched to the recipient: plain-English for own clients, professional legal cover for opposing counsel. Use when the attorney says "write the redline email", "summarize these changes for the client", "draft a cover email for the redline", "explain these edits to opposing counsel", or "turn this redline into an email". Do NOT use for drafting contracts or generating redlines — use the relevant drafter skill. Do NOT use for diffing two clean (non-redlined) document versions.
Как установить скилл redline-emailer?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл redline-emailer запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
AnthropicUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
xlsx
AnthropicUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
pptx
AnthropicUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…