docx-cn

Create, read, and edit Word .docx documents with formatting, tables, images, and tracked changes.

39|1|Updated Jul 2, 2026
One-click install
npx skills add https://github.com/HKU-MMLab/UniClawBench --skill docx-cn-hku-mmlab
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: docx-cn
Source: https://github.com/HKU-MMLab/UniClawBench/tree/main/injection/101_skill_usage/task_101_15_cn_doc_organize/skills/docx-cn
Command: npx skills add https://github.com/HKU-MMLab/UniClawBench --skill docx-cn-hku-mmlab

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Working with Word documents programmatically is error-prone: .docx files are ZIP archives of XML, and naive edits corrupt files, break tables, or lose tracked changes. This Skill provides a complete, validated workflow for creating new Word documents and safely editing existing ones without corrupting the underlying OOXML structure. ## Core Features & Use Cases - Document Creation with docx-js: Generate new .docx files with explicit page sizes, styled headings, bullet/numbered lists, dual-width tables, images, headers, footers, page breaks, and tables of contents, then validate the output. - Safe Editing of Existing Documents: Unpack the .docx to pretty-printed XML, edit directly (including tracked changes and comments with proper author attribution), then repack with schema validation and auto-repair. - Content Extraction and Conversion: Extract text with pandoc (including tracked changes), convert legacy .doc files, accept all tracked changes via LibreOffice, and render pages to images. - Use Case: A user asks to revise a contract draft: unpack the .docx, insert tracked deletions and insertions authored as "Claude", add review comments, repack with validation, and deliver a redlined document that opens cleanly in Word. ## Quick Start Edit the attached report.docx to replace the deadline with a tracked change and add a comment explaining the revision.

Frequently Asked Questions about docx-cn

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

FAQPage Schema
How do I create a Word document programmatically with tables and images?▼

Use the docx-js JavaScript library to build the document with Table, TableRow, TableCell, and ImageRun components, then write it with Packer.toBuffer. Always set explicit page size in DXA units and validate the output file afterward.

How do I edit an existing .docx file without corrupting it?▼

Unpack the .docx into XML with the unpack script, edit the XML files directly, then repack with the pack script which runs schema validation and auto-repair. This preserves relationships, content types, and formatting.

How do I add tracked changes to a Word document?▼

Insert w:ins and w:del elements around the changed runs in document.xml, using w:delText instead of w:t inside deletions. Replace entire w:r blocks rather than nesting change tags inside runs, and preserve the original run properties.

Why do my docx tables render incorrectly in Google Docs?▼

Tables break when using WidthType.PERCENTAGE or missing cell widths. Always use WidthType.DXA, set columnWidths on the table plus matching width on each cell, and ensure column widths sum exactly to the table width.

Can I convert legacy .doc files to .docx for editing?▼

Yes, run LibreOffice headless via the soffice script with --convert-to docx to transform legacy .doc files. The same tool converts .docx to PDF for page image rendering with pdftoppm.

What are the limitations of auto-repair when packing a docx?▼

Auto-repair only fixes invalid durableId values and missing xml:space preserve attributes. It cannot fix malformed XML, invalid element nesting, missing relationships, or schema violations, which must be corrected manually.