Skills

docx skill: read, write, and edit Word documents

For agent tasks that handle .docx/.dotx; first try a read-only pandoc look, do not use it for PDFs or spreadsheets, and do not npm install first.

Official source · docx

Install

require('docx'); npm install docx only if require fails

Who it is for

For people who need an agent to create, read, edit, or handle Word documents (.docx / .dotx): reports, memos, letters, templates, or extracting, reordering, replacing images, find-and-replace, tracked changes, and comments in an existing Word file. The evidence says to use this skill when the user mentions a Word document, .docx, .dotx, or asks for a formal document with a table of contents, headings, page numbers, or a letterhead.

Not for PDFs, spreadsheets, Google Docs, or general coding unrelated to document generation. The evidence locks that with Do NOT use; do not extend it to other formats.

Admit the dependency surface first: docx (npm, preinstalled), pandoc, LibreOffice (soffice), pdftoppm (Poppler). Without pandoc on the read path, the first read cannot proceed. The evidence does not name a required agent marketplace; do not infer a store or one-click install.

First try in 3 minutes

Prerequisite: the current agent has loaded the skill named docx, and pandoc can be called on this machine or from that skill directory. Officially docx is preinstalled; do not run npm install first. Only if require('docx') fails, run npm install docx.

The recommended main path is a read-only look, not an immediate edit. In a conversation where the skill is loaded, run the official read command on a .docx you own:

pandoc -t markdown file.docx

Replace file.docx with the real filename. This reads the file and emits Markdown. It is a read, not a lossless guarantee. Confirm the path first so you do not convert a document that should stay private. The evidence does not describe undo. Success is the command finishing with Markdown text. The evidence does not say how to pick the skill in the agent UI; it only says to use it when Word work is needed.

If you later edit an existing document, stop first: the official path is unzip → edit word/document.xml → zip, and it states docx-js cannot open existing files. That is a write and changes the archive; confirm you have a copy. Do not start the first try on the write path.

Use cases

Case 1: Read. Use pandoc -t markdown file.docx to turn an existing Word file into Markdown and check that headings and body appear. The evidence covers this read command only, not other converters.

Case 2: Edit an existing document. Follow the official three steps on the archive and change word/document.xml, then zip it back. docx-js cannot open existing files, so do not “open the old file with docx-js.” That is an explicit side-effect path; back up first. The evidence does not give a full script; leave missing parameters unknown.

Limits

The read path depends on pandoc. The write path depends on unzip / edit XML / zip, and may later use LibreOffice and pdftoppm for checks that are not part of this first try. Do not use it for PDFs, spreadsheets, or Google Docs. A preinstalled docx does not skip npm install docx when require('docx') fails. The evidence does not name supported agent UIs, undo, or a permission model; keep gaps unknown and do not write “no risk.”