docx

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

Updated Feb 4, 2026
One-click install
npx skills add https://github.com/pchemguy/AISandbox --skill docx-pchemguy
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: docx
Source: https://github.com/pchemguy/AISandbox/tree/main/docs/AgentSkills/anthropics/skills/skills/docx
Command: npx skills add https://github.com/pchemguy/AISandbox --skill docx-pchemguy

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 the right workflows and tooling. ## Core Features & Use Cases - Document Creation: Generate new Word documents from scratch using the docx-js JavaScript library with styles, tables, lists, images, headers, and footers. - Editing & Redlining: Modify existing documents with tracked changes and comments using a Python Document library that handles OOXML infrastructure, 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 review the attached contract.docx and add tracked changes updating all payment terms from 30 days to 60 days.

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 headers with required formatting rules.

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

Unpack the .docx with the provided unpack script, then use the Python Document library to insert <w:ins> and <w:del> elements via replace_node or suggest_deletion. The library auto-injects RSIDs, author, and date attributes, 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 in word/document.xml directly.

Does this support adding comments to Word documents?▼

Yes, the Document library's add_comment method anchors comments to document nodes and automatically manages comments.xml, commentsExtended.xml, commentsIds.xml, and people.xml infrastructure. It also supports replying to existing comments via reply_to_comment.

Why does my generated Word document fail to open?▼

Common causes include standalone PageBreak elements outside a Paragraph, missing ImageRun type parameters, unicode bullets instead of numbering config, or invalid tracked change nesting. Follow the critical rules in docx-js.md and ooxml.md, and rely on the library's save validation.