docx

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

Updated Jun 14, 2026
One-click install
npx skills add https://github.com/ironkid90-s/lucky5-v7 --skill docx-ironkid90-s
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docx
Source: https://github.com/ironkid90-s/lucky5-v7/tree/main/.github/skills/docx
Command: npx skills add https://github.com/ironkid90-s/lucky5-v7 --skill docx-ironkid90-s

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires docx, pandoc, defusedxml, lxml, 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 for creating new documents, editing existing ones at the XML level, and validating output against OOXML schemas. ## Core Features & Use Cases - New Document Generation: Build .docx files with docx-js including styles, tables, images, headers/footers, table of contents, footnotes, hyperlinks, and multi-column layouts, with explicit page-size and DXA width rules. - Surgical Editing of Existing Documents: Unpack → edit XML → repack workflow supporting tracked changes (insertions/deletions), comments with threaded replies, image insertion, and smart-quote typography. - Validation and Repair: Schema validation against OOXML XSDs, redlining validation, and auto-repair of common issues like invalid durableIds and missing xml:space attributes. - Use Case: A user asks for a quarterly report as a Word file with a table of contents, styled headings, a financial table, and page numbers; 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 a title page, table of contents, and a formatted data table, saved as a .docx 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 library (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 in DXA units since docx-js defaults to A4, and validate the output file afterward.

How do I edit an existing .docx file programmatically?

Unpack the .docx into its XML parts with the unpack script, edit the XML in word/document.xml directly, then repack with validation. This approach supports tracked changes, comments, and image insertion while preserving the original formatting.

How do I add tracked changes to a Word document?

Insert w:ins and w:del elements around the affected runs in document.xml, using w:delText instead of w:t inside deletions. Replace entire w:r blocks rather than nesting change tags inside runs, and copy the original run properties to preserve formatting.

Why does my generated docx table render incorrectly?

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

Can this skill convert .doc or PDF files?

Legacy .doc files can be converted to .docx with LibreOffice headless before editing, and .docx files can be converted to PDF or page images via soffice and pdftoppm. The skill does not edit PDFs, spreadsheets, or Google Docs.

How do I accept all tracked changes in a docx file?

Run the accept_changes.py script, which drives LibreOffice headless with a Basic macro to accept all revisions and save a clean document. LibreOffice must be installed on the system for this to work.