Skip to content

DOCX

Official Anthropic skill that lets Claude create, read, edit, and validate Word .docx files with tables, images, tracked changes, and comments.

What it does

Teaches Claude how .docx files actually work — they are ZIP archives of XML — and gives it a concrete toolchain for each task. New documents are generated with the docx npm library (page size, styles, tables, images, TOC, headers/footers), existing documents are unpacked to XML, edited in place, and repacked with schema validation. It also handles tracked changes, comments, and .doc→.docx conversion via LibreOffice. Reach for it whenever the deliverable must literally be a Word file, not markdown or a PDF.

Use cases

  • Generate a formatted report or letterhead with a table of contents, page numbers, multi-column layout, and embedded images — produced as a valid .docx that opens cleanly in Word and Google Docs.
  • Apply tracked-changes edits to a contract where Claude marks insertions and deletions authored as Claude, so a human reviewer can accept or reject each change in Word.
  • Extract and restructure content from an existing .docx, including reading tracked changes with pandoc or diving into the raw XML to rewrite tables, replace images, or bulk find-and-replace.

When to use it

  • The user asks for a Word doc, .docx, memo, letter, report, or template as a deliverable file.
  • You need to edit an existing .docx while preserving formatting, comments, or tracked changes.
  • Content must round-trip through Microsoft Word or Google Docs without style loss.
  • The task involves inserting or replacing images, headers, footers, or a table of contents in a Word file.

When NOT to use it

  • The output should be a PDF, spreadsheet, or Google Doc — use the matching skill instead.
  • Plain markdown or HTML is acceptable; generating a .docx adds toolchain overhead for no benefit.
  • You only need to read text from a document and pandoc alone (without this skill’s guidance) already produces what you need.
  • The environment has no Node.js or LibreOffice available — creation and .doc conversion will fail.

Installation

Install in Claude Code

/plugin install docx@anthropic-agent-skills

If you haven’t added the Anthropic marketplace yet, run this first:

Add Marketplace

/plugin marketplace add anthropics/skills

After install, just mention it in conversation:

Prompt

Create a Word document called quarterly-report.docx with a title page, table of contents, three H1 sections, a two-column data table, and a footer showing the page number.

Troubleshooting

Table renders as a black box or wrong width in Google Docs Set both columnWidths on the Table and a matching width on every TableCell, always using WidthType.DXA (never WidthType.PERCENTAGE). For cell shading, use ShadingType.CLEAR rather than SOLID, which some renderers interpret as an opaque black fill.

Generated document opens as A4 instead of US Letter docx-js defaults to A4. Set page size explicitly in the section properties.page.size to { width: 12240, height: 15840 } DXA for US Letter. For landscape, pass the portrait dimensions and add orientation: PageOrientation.LANDSCAPE — docx-js swaps them internally.

Accepting tracked changes leaves empty paragraphs or list items behind When deleting a whole paragraph, also mark the paragraph mark as deleted by adding <w:del/> inside <w:pPr><w:rPr> in addition to wrapping the run content in <w:del>. Without both, the paragraph mark survives and Word keeps an empty line.

Repacked .docx fails to open or validation errors after editing XML Run python scripts/office/pack.py unpacked/ output.docx --original document.docx — its auto-repair handles common issues like oversized durableId values and missing xml:space="preserve". For structural errors, unpack again and check element order inside <w:pPr> and that comment range markers are siblings of <w:r>, not nested inside runs.