docx

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

1|Updated Aug 11, 2026
One-click install
npx skills add https://github.com/Chia1104/agent-air --skill docx-chia1104
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: docx
Source: https://github.com/Chia1104/agent-air/tree/main/skills/claude/synced/b066812a-c7a5-4354-b574-f3c218098a45_0fdbac1f-d2db-4307-8341-b45c4d0d68f9/docx
Command: npx skills add https://github.com/Chia1104/agent-air --skill docx-chia1104

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Working with Word documents programmatically is error-prone: docx-js cannot open existing files, Word fragments text across XML runs, and tracked changes or comments require many cross-linked files. This Skill provides tested workflows and scripts to create, read, edit, redline, and comment on .docx and .dotx files reliably. ## Core Features & Use Cases - Document Creation: Generate new Word documents with the docx npm library, avoiding common pitfalls like A4 default page size, broken table widths, and incorrect list formatting. - Editing & Redlining: Unzip existing .docx files, merge fragmented runs for reliable find-and-replace, edit document.xml directly, and validate tracked changes against the original with XSD schema checks. - Comments & Cleanup: Add threaded comments with all six required satellite XML files, and accept all tracked changes via LibreOffice to produce clean copies. - Use Case: A lawyer asks you to redline a contract: unpack the .docx, wrap edits in <w:ins>/<w:del> elements, validate with --author to confirm every change is tracked, and deliver the annotated file. ## Quick Start Use the docx skill to create a professional Word report with a table of contents and page numbers, then render it to PDF to verify the output.

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 docx-js?▼

Write a Node.js script that requires the preinstalled docx npm package and defines paragraphs, tables, and sections. Watch for gotchas: page size defaults to A4, tables need columnWidths plus per-cell widths in DXA, and lists require a numbering config rather than literal bullet characters.

How do I edit an existing .docx file?▼

Unzip the .docx, run merge_runs.py to coalesce fragmented text runs, edit word/document.xml in place without reformatting, then rezip. The docx npm library cannot open existing files, so direct XML editing is the supported approach.

Why does find-and-replace fail in 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. Running merge_runs.py merges adjacent identically-formatted runs without changing rendering, making text searchable.

How do I add tracked changes to a Word document?▼

Wrap inserted runs in <w:ins> and deleted runs in <w:del> with w:id, w:author, and w:date attributes, using <w:delText> inside deletions. Validate with validate.py --original file.docx --author "name" to catch any edit missing tracked-change markup.

Can I add comments to a .docx file with a script?▼

Yes, comment.py writes comments.xml, commentsExtended.xml, commentsIds.xml, and commentsExtensible.xml plus the required relationships and content-type overrides. It prints the commentRangeStart/End markers you must add to document.xml for the comment to become visible.

What are the limitations of accepting tracked changes programmatically?▼

pandoc --track-changes=accept never joins paragraphs after a deleted paragraph mark, leaving stray empty bullets. The accept_changes.py script uses LibreOffice and joins them correctly except when a deleted paragraph is followed by an empty spacer paragraph.