docx-cn

Unpack, edit, and repack .docx files with XML-level validation.

8|Updated Feb 25, 2026
One-click install
npx skills add https://github.com/SenseTime-FVG/sensenova-claw --skill docx-cn
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docx-cn
Source: https://github.com/SenseTime-FVG/sensenova-claw/tree/main/.sensenova-claw/skills/docx-cn
Command: npx skills add https://github.com/SenseTime-FVG/sensenova-claw --skill docx-cn

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Many workflows require programmatic creation, precise editing, or safe validation of Word .docx files while preserving formatting, images, tables, comments, and tracked changes. This Skill removes fragile manual XML editing and inconsistent toolchains by providing reproducible unpack/edit/pack tools, tracked-change handling, comment management, and validators to prevent corrupt output.

Core Features & Use Cases

  • Unpack & Repack: Extract .docx to editable XML, pretty-print and repack with validation and auto-repair.
  • Create & Edit: Guidance and scripts for generating documents (docx-js) and for XML-level edits while preserving styling and TOC requirements.
  • Tracked Changes & Comments: Tools to add comments, merge/simplify tracked changes, accept changes via LibreOffice, and enforce author conventions.
  • Validation & Repair: XSD-based validators, relationship/content-type checks, ID constraint repairs, and whitespace preservation fixes to avoid corrupt files.
  • Conversions & Media: Helpers for converting legacy .doc, producing images from pages, and adding images with correct relationships and content types.
  • Use Case: Batch-process a set of client contracts to normalize styles, merge reviewer comments, accept specific authors' changes, and produce validated final .docx files.

Quick Start

Use the docx-cn skill to unpack document.docx, make edits or add comments using the provided scripts, accept tracked changes with the LibreOffice helper, and repack to a validated output.docx.

Frequently Asked Questions about docx-cn

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

FAQPage Schema
How do I programmatically edit a Word .docx file while preserving formatting and images?

Programmatically edit a .docx file by unpacking it to editable XML, applying XML-level edits, and repacking with validation to preserve formatting and images. This workflow ensures reproducible modifications without corrupting the document.

What is the best way to batch process Word documents to accept tracked changes from specific authors?

Batch process Word documents to accept tracked changes using scripts that enforce author conventions and a LibreOffice helper to accept specific authors' changes. This produces validated final .docx files with normalized reviewer inputs.

How does XSD-based validation prevent corrupt .docx files?

XSD-based validation prevents corrupt .docx files by checking relationships, content types, and ID constraints, then applying auto-repair fixes for whitespace preservation. Using defusedxml and lxml ensures document integrity before repacking.

Can I convert legacy .doc files and generate document images using LibreOffice?

Yes, you can convert legacy .doc files and generate page images using LibreOffice conversion helpers. The workflow supports adding images with correct relationships and content types to produce valid .docx output.

Do I need docx-js to create Word documents from templates?

You need docx-js to create Word documents from templates, as it provides creation guidance and scripts. This complements XML-level unpack and pack tools for editing, tracked-change handling, and validation within the same document-processing workflow.

Why do my Word documents break after manual XML editing?

Word documents break after manual XML editing due to invalid relationships, incorrect content types, or ID constraint errors. Using XSD-based validators with defusedxml and lxml applies auto-repair and whitespace preservation fixes to avoid corrupt files.