docx

Create, edit, and validate Word documents via OOXML manipulation and docx-js scripts.

Updated Aug 5, 2026
One-click install
npx skills add https://github.com/amirbiron/claude-skills --skill docx-amirbiron
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docx
Source: https://github.com/amirbiron/claude-skills/tree/main/skills/docx
Command: npx skills add https://github.com/amirbiron/claude-skills --skill docx-amirbiron

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires docx, pandoc, libreoffice, pdftoppm, defusedxml, lxml, and includes scripts (resource) components.

What problem does it solve? Working with Word documents programmatically is error-prone: docx-js has undocumented defaults (A4 page size, broken table widths), and editing existing .docx files requires safely unpacking, modifying, and repacking OOXML without corrupting the document. This Skill provides tested workflows and scripts for creating, editing, reading, and validating Word documents. ## Core Features & Use Cases - Document Creation: Generate .docx files with the docx npm library, with documented gotchas for page size, tables, lists, images, and tables of contents. - Editing & Redlining: Unpack existing documents, merge fragmented text runs, edit document.xml, add tracked changes and comments, then validate against XSD schemas. - Verification & Validation: Render output to PDF for visual inspection and run XSD validation with auto-repair and tracked-change auditing. - Use Case: A lawyer asks you to redline a contract: unpack the .docx, wrap edits in tracked-change elements, add anchored comments, validate with the original, and return a clean redlined file. ## Quick Start Use the docx skill to create a professional Word report with a table of contents, headings, and a formatted table from my notes.

Frequently Asked Questions about docx

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a Word document programmatically with JavaScript?

Use the docx npm library to build documents from Paragraph, Table, and ImageRun elements, then pack them into a .docx file. Set page size explicitly in DXA units, since the default is A4, and use numbering configs rather than literal bullet characters for lists.

How do I edit an existing .docx file?

Unzip the .docx, edit word/document.xml directly, then rezip the directory. The docx-js library cannot open existing files, so direct XML editing is required; run merge_runs.py first so fragmented text runs become searchable.

How do I add tracked changes to a Word document?

Wrap inserted runs in <w:ins> and deleted runs in <w:del> elements with w:id, w:author, and w:date attributes, using <w:delText> instead of <w:t> inside deletions. Validate with the --author flag to catch any edits missing tracked-change markup.

Why does find-and-replace fail on Word document XML?

Word splits visible text across many <w:r> runs due to revision IDs and spell-check markers, so phrases rarely exist as contiguous strings. Run merge_runs.py to coalesce adjacent identically-formatted runs before searching.

Can I add comments to a .docx file programmatically?

Yes, comments require six cross-linked files: comments.xml, commentsExtended.xml, commentsIds.xml, commentsExtensible.xml, plus relationship and content-type entries. The comment.py script writes all of them and prints the marker XML to anchor the comment in document.xml.

What are the limitations of accepting tracked changes programmatically?

Pandoc never joins paragraphs when accepting a deleted paragraph mark, and LibreOffice-based acceptance fails when a deleted paragraph is followed by an empty spacer. Both can leave stray empty bullets, so verify paragraph deletions directly in the XML.