Skip to content
/docxOfficial

Create, read, edit, or manipulate Word documents (.docx files). Handles tables of contents, headings, page numbers, letterheads, tracked changes, comments, and more.

DocumentsWordDOCXOfficeΒ· 2 min read

Quick import: Download the .md file and save it to .claude/commands/ (Claude Code), .cursorrules (Cursor), or paste as a system prompt in ChatGPT, Gemini, or any LLM API.

#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 outlineLevel for TOC support
  • Proper lists using LevelFormat.BULLET (never Unicode bullets)
  • Tables with dual widths (columnWidths on table AND width on each cell, always DXA)
  • Images with required type parameter
  • Hyperlinks (external and internal with bookmarks)
  • Headers/footers with page numbers
  • Table of Contents using HeadingLevel only

#Editing Existing Documents

Three-step workflow:

  1. Unpack: Extract XML with pretty-printing and smart quote conversion
  2. Edit XML: Direct string replacement for tracked changes, comments, content modifications
  3. 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.

AnthropicΒ·
View all skills