docx

Create, edit, and validate .docx Word documents at the XML level.

Updated Mar 6, 2026
One-click install
npx skills add https://github.com/pczhao1210/reuseable-agents-and-skills --skill docx-pczhao1210
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docx
Source: https://github.com/pczhao1210/reuseable-agents-and-skills/tree/main/.agents/skills/docx
Command: npx skills add https://github.com/pczhao1210/reuseable-agents-and-skills --skill docx-pczhao1210

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Provides a robust, reproducible workflow to create, inspect, and modify Microsoft Word .docx files at the XML level so users can generate polished documents, reliably apply tracked-change edits and comments, and avoid common rendering issues across platforms.

Core Features & Use Cases

  • Unpack and repack .docx archives for safe XML editing and validation.
  • Create new documents with precise page sizing, styles, tables, images, headers/footers, and Table of Contents control.
  • Edit existing documents while preserving tracked changes, comments, and formatting; merge runs and simplify redlines to make edits deterministic.
  • Validate OOXML structure and relationships against XSDs and auto-repair common issues (durableId, xml:space, broken relationships).
  • Use case: Convert a legacy DOCX with heavy tracked changes into a cleaned, validated Word report with accepted changes, images embedded correctly, and full-width tables that render across Word, Google Docs, and PDF exports.

Quick Start

Create a new Word document titled "Quarterly Report" with US Letter page size, a Table of Contents, two headings, one image, and a formatted two-column table using the docx workflow.

Frequently Asked Questions about docx

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

FAQPage Schema
How do I programmatically edit a Word document while preserving tracked changes and comments?

To edit Word documents while preserving tracked changes and comments, you can unpack the .docx archive for safe XML-level editing and repack it, ensuring formatting and redlines remain intact and deterministic.

What is the best way to validate OOXML structure and fix broken relationships in a .docx file?

Validating OOXML structure and fixing broken relationships in a .docx file involves unpacking the archive and running XSD validation against the XML, which can auto-repair common issues like durableId and xml:space errors.

How do I embed images and create full-width tables in a Word document that render correctly across Google Docs and PDF exports?

Embedding images and creating tables that render correctly across platforms requires inserting elements with DXA sizing and applying table dual-width rules during the document generation workflow.

Can I use Python libraries to unpack and repack .docx files for automated document processing?

Yes, you can use Python libraries like lxml and defusedxml to unpack and repack .docx files, enabling automated XML-level editing, validation, and programmatic document generation.

Does automated .docx generation support Table of Contents control and custom page sizing?

Automated .docx generation supports precise page sizing, custom styles, headers, footers, and Table of Contents control, allowing you to create polished documents programmatically from start to finish.

Why do my tracked changes become inconsistent when converting legacy Word documents to new formats?

Inconsistent tracked changes during conversion often stem from unmerged runs or complex redlines; merging runs and simplifying redlines before conversion ensures edits remain deterministic across formats.