docx

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

Updated Apr 7, 2026
One-click install
npx skills add https://github.com/NT-boop-star/BRMV-tract --skill docx-nt-boop-star
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docx
Source: https://github.com/NT-boop-star/BRMV-tract/tree/main/antigravity/skills/docx
Command: npx skills add https://github.com/NT-boop-star/BRMV-tract --skill docx-nt-boop-star

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires docx, pandoc, defusedxml, Pillow, and includes scripts (resource) and references (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 broken tables, invalid page breaks, and lost tracked changes. This Skill provides tested workflows and scripts to create, read, and edit .docx files correctly. ## Core Features & Use Cases - Document Creation: Generate professional Word documents with docx-js, including styles, tables, lists, images, headers/footers, footnotes, and tables of contents. - Document Editing: Unpack existing .docx files, edit the raw XML, and repack with validation and auto-repair, supporting tracked changes and comments. - 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 valid docx-js code, validates the output, and delivers a polished .docx. ## Quick Start Use the docx skill to create a Word document report with a title page, table of contents, and a formatted data table.

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 Paragraph, TextRun, Table, and ImageRun elements, then save 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 edit an existing .docx file programmatically?

A .docx file is a ZIP archive of XML, so unpack it with the provided unpack script, edit the XML in the word/ directory directly, then repack with validation and auto-repair. This approach supports tracked changes, comments, and image insertion.

How do I add tracked changes to a Word document?

Wrap inserted text in <w:ins> elements and deleted text in <w:del> elements containing <w:delText>, placed as siblings of runs rather than inside them. The Document class in scripts/document.py automates attribute injection, RSIDs, and validation for redlining.

Why does my docx table render incorrectly in Word or Google Docs?

Tables need dual widths: set columnWidths on the table and a matching width on each cell, always using WidthType.DXA since percentages break in Google Docs. Also use ShadingType.CLEAR instead of SOLID to prevent black cell backgrounds.

Can this skill handle PDFs or Google Docs?

No, it is scoped to .docx files only and explicitly excludes PDFs, spreadsheets, and Google Docs. Legacy .doc files must first be converted to .docx using LibreOffice before editing.

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

Run the accept_changes.py script with the input and output file paths. It uses a LibreOffice macro in headless mode to accept all tracked changes and produce a clean document.