docx

Create, edit, and analyze Word documents with tracked changes and comments.

8|3|Updated Oct 20, 2025
One-click install
npx skills add https://github.com/chongdashu/claude-code-skills-demo --skill docx-chongdashu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docx
Source: https://github.com/chongdashu/claude-code-skills-demo/tree/main/.claude/skills/document-skills/docx
Command: npx skills add https://github.com/chongdashu/claude-code-skills-demo --skill docx-chongdashu

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires defusedxml, pandoc, docx, libreoffice, poppler-utils, and includes scripts (resource) components.

What problem does it solve? Working with .docx files programmatically is difficult because they are ZIP archives of XML files, making tasks like editing content, adding tracked changes, or inserting comments error-prone without a structured workflow. ## Core Features & Use Cases - Document Creation: Generate new Word documents from scratch using the docx-js JavaScript library with styles, tables, lists, images, and headers. - Editing & Redlining: Modify existing documents with tracked changes using a Python Document library that handles OOXML manipulation, RSIDs, and validation automatically. - Content Analysis: Extract text via pandoc, access raw XML for comments and metadata, and convert documents to images for visual review. - Use Case: Review a legal contract by converting it to markdown, planning batched tracked changes, implementing them with the Document library, and verifying the final redlined document. ## Quick Start Ask the assistant to create a new Word document or add tracked changes and comments to an existing .docx file.

Frequently Asked Questions about docx

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

FAQPage Schema
How do I create a Word document with JavaScript?

Use the docx npm library to build documents with Document, Paragraph, and TextRun components, then export with Packer.toBuffer(). The docx-js.md reference covers styles, tables, lists, images, and page setup.

How do I add tracked changes to a docx file in Python?

Unpack the document with the provided unpack script, then use the Document library from scripts/document.py to insert w:ins and w:del elements. It auto-injects RSIDs, authors, and timestamps, then repack with the pack script.

How do I extract text from a .docx file?

Convert the document to markdown using pandoc with the --track-changes=all flag to preserve insertions and deletions. For comments, embedded media, or complex formatting, unpack the file and read the raw XML directly.

Can I add comments to an existing Word document programmatically?

Yes, the Document class provides add_comment and reply_to_comment methods that handle comments.xml, commentsExtended.xml, and related infrastructure automatically. You anchor comments to start and end nodes in document.xml.

Why does my edited docx fail to open in Word?

Common causes include invalid XML structure such as nesting w:ins inside w:r elements, missing content type declarations, or incorrect element ordering in w:pPr. The Document library validates on save to catch these errors.