docx

Create, edit, and validate Word .docx documents with tracked changes.

1.2k|53|Updated Dec 24, 2025
One-click install
npx skills add https://github.com/polyuiislab/infiAgent --skill docx-polyuiislab
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docx
Source: https://github.com/polyuiislab/infiAgent/tree/main/skills/docx
Command: npx skills add https://github.com/polyuiislab/infiAgent --skill docx-polyuiislab

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires defusedxml, lxml, and includes scripts (resource) components.

What problem does it solve?

Enables reliable creation, inspection, editing, and validation of Microsoft Word .docx files without manual XML gymnastics or broken formatting. It removes fragile toolchain steps by providing unpack/pack, validation, tracked-changes handling, comment automation, image and table rules, and LibreOffice-based operations to accept changes or convert legacy formats.

Core Features & Use Cases

  • Read & Analyze: Unpack DOCX ZIP/XML, extract text, images, and tracked-change structures for review or migration.
  • Create New Documents: Author production-ready .docx via docx-js guidance (page sizes, styles, TOC, lists, tables, images).
  • Edit Existing Documents: Safe unpack → targeted XML edits → repack flow with helpers for merging runs, simplifying redlines, and preserving whitespace.
  • Tracked Changes & Comments: Add, reply, accept, or validate tracked changes and comments programmatically, using "Claude" as the default author unless otherwise requested.
  • Validation & Repair: XSD schema validators, relationship/content-type checks, durableId/paraId auto-repair, and packing tools to ensure documents are not corrupt.
  • Use Case: Convert a draft with tracked changes into a clean, validated company-branded report with a table of contents and embedded images.

Quick Start

Ask the agent: Convert my draft document into a validated Word (.docx) report with Heading 1/2 styles, a table of contents, accepted tracked changes, and embedded images.

Frequently Asked Questions about docx

High-intent search queries and answers about installing and using this skill.

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

To accept tracked changes in a Word document, the Skill applies LibreOffice-based operations to process redlines, or directly modifies the XML structures within the DOCX ZIP package to validate and clear revision markup.

How do I edit a DOCX file without breaking the XML formatting?

To safely edit a DOCX file without broken formatting, you unpack the ZIP/XML package, apply targeted XML edits using lxml, merge runs, simplify redlines, and repack the document with XSD schema validation to prevent corruption.

Can I convert legacy .doc files to .docx programmatically?

Yes, you can convert legacy .doc files to .docx using LibreOffice-based operations integrated into the workflow, ensuring the resulting document passes XSD/schema validation and auto-repair for structural integrity.

What is the best way to generate a Word report with a table of contents and embedded images?

The best way to generate a Word report is by using docx-js generation rules for page sizes, styles, and TOC, alongside specific ImageRun types and table DXA widths, resulting in a production-ready validated DOCX file.

Why does my DOCX file fail schema validation after unpacking and repacking?

Your DOCX file fails schema validation due to missing relationship or content-type definitions, or invalid durableId and paraId structures, which require XSD schema validators and auto-repair tools to fix during the repacking process.

Do I need lxml and defusedxml to validate Word documents?

Yes, you need lxml and defusedxml to unpack and repack DOCX ZIP/XML structures securely, perform find-and-replace operations, and execute XSD schema validation with auto-repair to ensure Word documents are not corrupt.