| name | redlines |
| title | redlines — Word Document Redlining Library |
| description | Use when you need to generate tracked changes in Word documents from diff output, apply redlines from AI agents to DOCX files, or convert text diffs into native Word revisions. |
| author | LegalQuants |
| author_url | https://github.com/LegalQuants/lq-skills/tree/main/skills/redlines |
| license | Apache-2.0 |
| version | 0.1.0 |
| execution_mode | open |
| jurisdiction | general |
| practice | general |
| language | en |
| tags | ["word","docx","tracked-changes","redlines","document-processing"] |
redlines — Word Document Redlining Library
When to Use
- Converting AI-generated edits into Word tracked changes
- Applying diff output to DOCX files with native revision markup
- Building legal tools that produce redlined documents
- Automated document comparison with Word-compatible output
- "Draft by exception" workflows where you track exceptions to standard clauses
How It Works
Takes diff output (from any source) and applies it to a DOCX as native Word tracked changes. Built by a practising Singapore counsel who needed deterministic document transformation.
Input
- Original DOCX
- Modified text or diff output
Output
DOCX with Word native tracked changes (insertions in blue, deletions in strikethrough)
Usage
import { applyRedlines } from '@houfu/redlines';
const result = applyRedlines({
originalDoc: './contract.docx',
modifiedText: 'modified contract text here',
author: 'LQClaw'
});
result.toDocx('./contract-redlined.docx');
Key Design Decisions
- Deterministic — Same input produces identical output
- Format preservation — Headers, lists, tables survive transformation
- Standard-compliant — Output is valid DOCX that Word renders correctly
- No round-trip through Word — Works headlessly, no Office install required
Audience and Work Shape
Audience: legal engineers and counsel comfortable invoking a JavaScript library from a workflow. Not a self-service tool for a reviewing partner and not intended for non-technical users. The judgment as to which edits to apply sits upstream of this skill; this skill only carries them into the DOCX.
Work shape: Bounded Transactional primitive. Text-in (or diff-in) → DOCX-out. The transform is mechanical. It is not a redline reviewer, not a redline generator, and not a substantive review step.
Scope and Legal Use
This skill provides legal support, not legal advice. Producing a tracked-changes DOCX is mechanical document processing; the redlined output is a draft, not a vetted lawyer redline and not signed-off work product. A successful run means "the supplied edits were carried into the file as Word revisions" — not "these edits are correct" and not "this draft is fit to send."