docx

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

Updated Apr 16, 2026
One-click install
npx skills add https://github.com/quangtuyennguyen/loan-application-workflow --skill docx-quangtuyennguyen
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: docx
Source: https://github.com/quangtuyennguyen/loan-application-workflow/tree/main/.claude/skills/docx
Command: npx skills add https://github.com/quangtuyennguyen/loan-application-workflow --skill docx-quangtuyennguyen

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 files are ZIP archives of XML with strict schema rules, and naive generation produces corrupt files, broken tables, or lost tracked changes. This Skill provides tested workflows and validation tooling to create, read, and edit .docx files reliably. ## Core Features & Use Cases - Document Generation: Build polished Word documents with docx-js, including tables, images, headers/footers, table of contents, footnotes, hyperlinks, and multi-column layouts, with explicit page sizing and style overrides. - Surgical Editing of Existing Files: Unpack a .docx into readable XML, edit it directly (tracked changes, comments, find-and-replace, image insertion), then repack with schema validation and auto-repair. - Content Extraction & Conversion: Extract text with pandoc (including tracked changes), convert legacy .doc to .docx, render pages to images via LibreOffice and Poppler, and accept all tracked changes programmatically. - Use Case: A user asks for a quarterly report as a Word file with a table of contents, styled headings, and a data table; the Skill generates it with docx-js and validates the output before delivery. ## Quick Start Ask the assistant to create a Word document report with headings, a table, and page numbers, or to edit an existing .docx file with tracked changes.

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 with tables and headings in JavaScript?▼

Use the docx npm library (docx-js) to build a Document with Paragraph, Table, and Heading elements, then write it with Packer.toBuffer. Always set explicit page size in DXA units and define table columnWidths that sum to the table width.

How do I edit an existing .docx file programmatically?▼

Unpack the .docx into its XML parts with the provided unpack script, edit the XML in word/document.xml directly, then repack with the pack script which validates against OOXML schemas and auto-repairs common issues.

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

Insert w:ins and w:del elements around modified runs in document.xml for tracked changes, and use the comment.py script to add comment entries across comments.xml and related parts. Comment range markers must be siblings of w:r elements, never nested inside them.

Why does my generated docx table render incorrectly?▼

Tables need dual widths: set columnWidths on the table and a matching width on every cell, both in DXA units that sum exactly to the table width. Avoid WidthType.PERCENTAGE, which breaks in Google Docs, and use ShadingType.CLEAR instead of SOLID for cell shading.

Can this convert .doc files or accept all tracked changes?▼

Yes, legacy .doc files are converted to .docx via LibreOffice headless mode using the soffice.py helper. The accept_changes.py script runs a LibreOffice macro to accept all tracked changes and produce a clean document.

What are the limitations of docx-js document generation?▼

docx-js defaults to A4 page size, so US Letter dimensions must be set explicitly, and it cannot use newline characters or unicode bullets directly. Table of contents entries require built-in HeadingLevel styles with outlineLevel set, not custom styles.