#What it does
The DOCX skill handles all Word document operations -- creating new documents with docx-js, editing existing ones by unpacking/repacking XML, reading and extracting content, working with tracked changes and comments, and converting between formats. It produces professional documents with proper formatting, styles, and structure.
#How to use
Activate when any .docx file is involved as input or output. This includes creating reports, memos, letters, templates, or any Word document deliverable.
Create a professional report as a Word document with a table of contents
Edit the existing contract.docx to add tracked changes
#Skill instructions
#Quick Reference
| Task | Approach |
|------|----------|
| Read/analyze content | pandoc or unpack for raw XML |
| Create new document | docx-js with proper styles and validation |
| Edit existing document | Unpack, edit XML, repack |
#Creating New Documents
Uses docx-js (JavaScript) to generate .docx files with:
- Explicit page size (US Letter: 12240 x 15840 DXA)
- Style overrides for built-in headings with
outlineLevelfor TOC support - Proper lists using
LevelFormat.BULLET(never Unicode bullets) - Tables with dual widths (
columnWidthson table ANDwidthon each cell, always DXA) - Images with required
typeparameter - Hyperlinks (external and internal with bookmarks)
- Headers/footers with page numbers
- Table of Contents using
HeadingLevelonly
#Editing Existing Documents
Three-step workflow:
- Unpack: Extract XML with pretty-printing and smart quote conversion
- Edit XML: Direct string replacement for tracked changes, comments, content modifications
- Pack: Validate with auto-repair, condense XML, create DOCX
#Tracked Changes
Supports insertions, deletions, rejecting another author's changes, and restoring deleted content -- all with proper XML structure and formatting preservation.
This skill is from the Anthropic Skills Repository.