docx

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Working with Word documents programmatically is error-prone: tables render incorrectly, tracked changes corrupt files, and formatting breaks across platforms. This Skill provides tested workflows and validation tooling to create, read, and edit .docx files reliably. ## Core Features & Use Cases - Document Creation: Generate professional .docx files with docx-js, including tables, images, headers, footers, tables of contents, and custom styles, with built-in validation. - Surgical Editing: Unpack existing documents to XML, make precise edits including tracked changes and comments, then repack with schema validation and auto-repair. - Content Extraction & Conversion: Extract text with pandoc, convert legacy .doc files, accept tracked changes via LibreOffice, and render pages to images. - Use Case: A user asks to redline a contract: unpack the .docx, insert tracked deletions and insertions as valid OOXML, add reviewer comments, then repack into a validated Word file ready for review. ## Quick Start Ask the assistant to create a formatted Word report with headings, a table, and page numbers, or to edit an attached .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 programmatically with JavaScript?

Use the docx npm package (docx-js) to build a Document object with paragraphs, tables, images, and styles, then write it with Packer.toBuffer. Always set the page size explicitly since docx-js defaults to A4, and validate the output file afterward.

How do I add tracked changes to a .docx file?

Unpack the .docx into XML, then wrap inserted text in w:ins elements and deleted text in w:del elements with w:delText, including author and date attributes. Replace entire w:r run elements rather than injecting tags inside runs, and preserve the original w:rPr formatting.

Why do my docx-js tables render incorrectly?

Tables need dual widths: set columnWidths on the table and a matching width on every cell, using WidthType.DXA rather than PERCENTAGE which breaks in Google Docs. The column widths must sum exactly to the table width, and use ShadingType.CLEAR for cell shading.

Can I convert legacy .doc files to .docx?

Yes, convert .doc files using LibreOffice headless mode with the command soffice --headless --convert-to docx. The skill's soffice.py helper handles sandboxed environments where Unix sockets are blocked.

How do I accept all tracked changes in a Word document?

Run the accept_changes.py script with the input and output file paths. It uses a LibreOffice Basic macro to accept all tracked changes headlessly and saves a clean document.

When should I not use this docx skill?

Do not use it for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. It is scoped specifically to creating, reading, and editing .docx files and their OOXML content.