docx

Create and edit Word docx files using JavaScript and Python tools.

Updated Jun 26, 2026
One-click install
npx skills add https://github.com/wangx7/skills-collection --skill docx-wangx7
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docx
Source: https://github.com/wangx7/skills-collection/tree/main/anthropics-skills/skills/docx
Command: npx skills add https://github.com/wangx7/skills-collection --skill docx-wangx7

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Creating and editing Word documents programmatically is notoriously difficult due to the complex XML-based OOXML format. This Skill eliminates the need to manually manipulate ZIP archives and raw XML by providing high-level JavaScript APIs for document generation and robust Python tooling for editing existing documents with tracked changes, comments, and precise formatting control.

Core Features & Use Cases

  • Document Generation: Create new docx files from scratch using the docx JavaScript library with full control over styles, tables, images, headers, footers, and table of contents.
  • Document Editing & Analysis: Modify existing Word documents by unpacking the XML, making targeted edits, and repacking—with full support for tracked changes, comments, and smart quote typography.
  • Use Case: A legal team needs to redline a contract and add comments. Use this Skill to unpack the document, insert tracked changes with proper attribution, add comment threads, and repack a valid docx file that preserves all formatting.

Quick Start

Use the docx skill to generate a new Word document with a title, body text, and a formatted table, then save it as report.docx.

Frequently Asked Questions about docx

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

FAQPage Schema
How do I programmatically add tracked changes and comments to an existing Word document?

To add tracked changes and comments to an existing Word document, this Skill unpacks the docx XML structure, inserts tracked changes with proper attribution and comment threads, then repacks a valid file preserving all original formatting.

What is the best way to automate Word document generation with complex formatting like tables and headers?

Automating Word document generation with complex formatting is handled by the docx JavaScript library, enabling programmatic creation of new docx files with full control over styles, tables, images, headers, footers, and table of contents.

Can I edit the raw XML inside a docx file without breaking its formatting?

Yes, you can edit raw XML inside a docx file without breaking formatting by using Python helper scripts and LibreOffice to unpack the OOXML structure, make targeted XML edits, validate the changes, and repack the document.

Do I need LibreOffice to unpack and manipulate existing docx files?

Yes, LibreOffice is required along with Python helper scripts to unpack, edit, validate, and repack existing Word documents, while new document generation only requires the docx JavaScript library.

What are the limitations of using JavaScript APIs for Word document automation?

JavaScript APIs for Word document automation are limited to generating new docx files from scratch, whereas editing existing documents, extracting legacy doc content, and applying tracked changes require Python tooling and LibreOffice for XML manipulation.