docx

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

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

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 common libraries have pitfalls like wrong default page sizes, broken tables, and invalid tracked changes. This Skill provides tested workflows for creating new documents, editing existing ones at the XML level, and validating the results. ## Core Features & Use Cases - Document Creation: Generate professional .docx files with docx-js, including tables, images, headers, footers, tables of contents, footnotes, hyperlinks, and multi-column layouts. - XML-Level Editing: Unpack existing documents, edit the raw XML for tracked changes, comments, and find-and-replace, then repack with automatic validation and 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 for a quarterly report as a Word file with a table of contents, styled headings, and a data table. The Skill generates the document with docx-js, validates it against OOXML schemas, and delivers a clean .docx. ## 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 JavaScript?

Use the docx npm package (docx-js) to build a Document object with 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 edit an existing .docx file programmatically?

Unpack the .docx into its XML parts with the unpack script, edit the files under word/ directly, then repack with validation. This approach supports tracked changes, comments, and precise find-and-replace that high-level libraries cannot express.

How do I add tracked changes to a Word document?

Insert w:ins and w:del elements around the affected runs in document.xml, replacing entire w:r blocks rather than nesting tags inside runs. Copy the original run's w:rPr formatting into the change runs to preserve fonts and styles.

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 percentages which break in Google Docs. The column widths must sum exactly to the table width.

Can this convert legacy .doc files to .docx?

Yes, legacy .doc files are converted to .docx using LibreOffice in headless mode via the soffice script before any editing. The same tool converts .docx to PDF for page-image rendering with pdftoppm.

What are the limitations of editing Word XML directly?

Auto-repair only fixes invalid durableId values and missing xml:space preserve attributes. Malformed XML, invalid element nesting, missing relationships, and schema violations must be fixed manually, and element ordering inside w:pPr must follow the schema.