docx

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

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

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 validated workflows for creating professional Word documents and safely editing existing ones. ## Core Features & Use Cases - Document Creation: Generate polished .docx files with docx-js, including tables of contents, styled headings, lists, tables, images, headers, footers, and page numbers, with explicit page size control. - Surgical Editing: Unpack existing documents to XML, perform find-and-replace, insert tracked changes and comments (with replies), then repack with schema validation and auto-repair. - Content Extraction & Conversion: Extract text with pandoc (including tracked changes), convert legacy .doc files, accept all 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 Claude, add review comments, then repack a validated document ready for the counterparty. ## Quick Start Ask the assistant to create a professional Word report with a table of contents, headings, and a formatted table, 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 containing w:delText, each with a unique ID, author, and date. 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, both in DXA units that sum exactly to the table width. Never use WidthType.PERCENTAGE because it breaks in Google Docs, and use ShadingType.CLEAR instead of SOLID for cell shading.

Can I convert legacy .doc files to .docx for editing?

Yes, run LibreOffice headless with the soffice.py helper using --convert-to docx to transform legacy .doc files before editing. The same tool converts .docx to PDF, and pdftoppm from Poppler renders pages to images.

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 macro to accept all tracked changes headlessly and saves a clean document, requiring LibreOffice to be installed.

When should I not use this docx editing approach?

Do not use it for PDFs, spreadsheets, Google Docs, or tasks unrelated to Word document generation. Also note that auto-repair only fixes durableId overflow and missing xml:space attributes; malformed XML or schema violations must be fixed manually.