docx

Create, read, and modify Word .docx documents programmatically.

Updated Apr 10, 2026
One-click install
npx skills add https://github.com/ImaginerLabs/skill-manager --skill docx-imaginerlabs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docx
Source: https://github.com/ImaginerLabs/skill-manager/tree/main/skills/document-processing/docx
Command: npx skills add https://github.com/ImaginerLabs/skill-manager --skill docx-imaginerlabs

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Many workflows require programmatic creation, inspection, and modification of Microsoft Word documents but fail because .docx files are ZIP archives of XML with fragile relationships, tracked changes, and media handling. This Skill provides a deterministic, scriptable approach to create polished .docx files, extract and reorganize content from existing documents, manage tracked changes and comments, and validate or repair OOXML issues.

Core Features & Use Cases

  • Unpack / Pack DOCX: Extract and reassemble the ZIP-based .docx package with pretty-printed XML for safe editing.
  • Tracked changes & comments: Add, reply to, accept, or validate tracked changes and comments (defaults to author "Claude" unless specified).
  • XML-safe editing: Guidance and tools to edit word/ XML while preserving xml:space, RSIDs, relationships, paraId/durableId constraints, and media references.
  • Creation helpers: Recommendations for generating documents with docx-js and rules for page size, styles, tables, images, lists, TOC, headers/footers, and multi-column layouts.
  • Validation & Repair: Schema-based validation against ISO/IEC29500 XSDs, content-type and relationship checks, and auto-repair for common ID/whitespace issues.
  • Use Case: Convert a heavily redlined contract into a clean, validated final .docx by unpacking, merging/simplifying redlines, reviewing comments, accepting or producing tracked changes, and repacking after validation.

Quick Start

Unpack report.docx to an unpacked/ directory, add or review tracked changes and comments using the provided scripts, then run the pack tool to produce a validated final.docx.

Frequently Asked Questions about docx

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

FAQPage Schema
How do I programmatically generate Word documents with formatted content and tables?

Programmatic generation of Word documents with content, images, and tables is handled by unpacking the DOCX ZIP package, editing the XML structure, and repacking it with validation against OOXML schemas.

Can I accept or reject tracked changes in a DOCX file using a script?

Tracked changes in a DOCX file can be added, replied to, accepted, or validated via scripts that safely edit the underlying XML while preserving whitespace and relationship constraints.

Does docx-js work for creating complex Word templates with headers, footers, and multi-column layouts?

Creation helpers provide recommendations for generating documents with docx-js, including rules for page size, styles, headers, footers, lists, TOC, and multi-column layouts.

What's the best way to extract and reorganize content from existing Word files?

Content extraction and reorganization from existing Word files is achieved by unpacking the DOCX ZIP archive into pretty-printed XML, editing the necessary parts, and repacking into a validated output file.

Why does editing Word XML break my document's formatting and tracked changes?

Editing Word XML breaks formatting when xml:space preservation, RSIDs, relationship references, or paraId constraints are disrupted, requiring schema-based validation and auto-repair for common whitespace and ID issues.

What is OOXML schema validation and when do I need it for DOCX files?

OOXML schema validation checks DOCX XML against ISO/IEC29500 XSDs to ensure structural compliance, needed when repairing corrupted documents or verifying that edited XML will open correctly in Microsoft Word.