docx

Validate, repair, and manipulate DOCX files by unpacking, editing, and repacking Office documents.

1|Updated Apr 3, 2026
One-click install
npx skills add https://github.com/nq-rdl/agent-extensions --skill docx-nq-rdl
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: docx
Source: https://github.com/nq-rdl/agent-extensions/tree/main/skills/docx
Command: npx skills add https://github.com/nq-rdl/agent-extensions --skill docx-nq-rdl

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Word documents are central to business communication, but creating, editing, and validating DOCX files can be error-prone and time-consuming without automation.

Core Features & Use Cases

  • Create new .docx documents with structured layouts, page formatting, and content preservation.
  • Edit and manipulate existing Word files, including inserting text, images, tables, and tracking changes, while preserving styles and formatting.
  • Validate and repair DOCX XML, manage relationships, content types, and whitespace preservation, and re-pack to a clean DOCX.

Quick Start

Use the docx skill to unpack a DOCX, inspect or modify its XML, and re-pack it into a valid Word document.

Frequently Asked Questions about docx

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

FAQPage Schema
How do I validate and repair a corrupted DOCX file?▼

To validate and repair a DOCX file, you unpack the Office document, inspect its XML structure, and use schema validation to fix invalid relationships or content types before repacking it into a clean archive.

Can I edit Word documents with Python while preserving whitespace and tracked changes?▼

Yes, you can edit Word documents by manipulating the internal XML directly, which allows you to preserve whitespace, merge text runs, and handle tracked changes without breaking the existing formatting.

What is the best way to unpack and repack a DOCX file for content manipulation?▼

The best way to unpack and repack a DOCX file is to extract its underlying XML components, modify the document structure or text, and rebuild the archive while ensuring all content types and relationships remain valid.

Does lxml work with Python for parsing and modifying Office document XML?▼

Yes, lxml is used to parse and modify Office document XML, enabling scripts to inspect elements, apply schema validation, and repair structural issues within the unpacked DOCX file.

Why does my edited DOCX file show format errors after modifying the XML?▼

Edited DOCX files show format errors when content types or relationships become invalid across edits, which requires validating the XML against XSD schemas and repairing the structure before repacking.

Do I need defusedxml to safely validate DOCX XML in Python?▼

Yes, defusedxml is required to safely parse and validate DOCX XML, protecting against XML external entity attacks while using lxml to inspect and manipulate the document structure.