docx

Create, edit, and validate Word .docx documents via docx-js and direct XML manipulation.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Working with Word documents programmatically is error-prone: docx-js defaults to A4 page size, tables render incorrectly without dual widths, tracked changes require precise XML structure, and invalid markup corrupts files. This Skill provides tested patterns and validation tooling to produce correct .docx output on the first attempt. ## Core Features & Use Cases - Document Generation: Build new .docx files with docx-js covering styles, lists, tables, images, headers/footers, footnotes, table of contents, and multi-column layouts, with explicit page-size and DXA width rules. - Surgical Editing of Existing Files: Unpack a .docx to XML, edit tracked changes and comments directly, then repack with schema validation and auto-repair. - Review Workflows: Insert tracked insertions/deletions, add threaded comments, and accept all tracked changes via a LibreOffice macro. - 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, validates the output, and delivers a clean .docx. ## Quick Start Create a Word document report with a title page, table of contents, and a formatted data table, then validate the output file.

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 JavaScript?

Use the docx npm package (docx-js) to build a Document object with sections, paragraphs, tables, and images, then write it with Packer.toBuffer. Always set the page size explicitly since docx-js defaults to A4 rather than US Letter.

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, each carrying a unique w:id, author, and date. Repack the directory and validate against the OOXML schema.

Why does my docx table render incorrectly in Google Docs?

Tables built with WidthType.PERCENTAGE break in Google Docs; always use WidthType.DXA. Set both the table columnWidths array and a matching width on each cell, and make the column widths sum exactly to the table width.

Can I convert a legacy .doc file to .docx?

Yes, run LibreOffice headless with soffice --convert-to docx to transform legacy .doc files before editing. The Skill's soffice helper also handles sandboxed environments where Unix sockets are blocked.

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

Run the accept_changes script, which drives LibreOffice headless with a Basic macro that executes AcceptAllTrackedChanges and saves the file. The output is a clean .docx with all revisions applied.

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 targets .docx creation and OOXML editing only; other formats need their own tools.