docx

Create, edit, and validate Word .docx documents via XML manipulation and docx-js scripts.

3|1|Updated Nov 30, 2025
One-click install
npx skills add https://github.com/PALabs-v1/AI_friend --skill docx-palabs-v1
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docx
Source: https://github.com/PALabs-v1/AI_friend/tree/main/.claude/skills/docx
Command: npx skills add https://github.com/PALabs-v1/AI_friend --skill docx-palabs-v1

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Working with Word documents programmatically is error-prone: docx-js cannot open existing files, Word fragments text across XML runs, and tracked changes or comments require many cross-linked files. This Skill provides tested workflows and scripts to create, edit, redline, comment on, and validate .docx and .dotx files reliably. ## Core Features & Use Cases - Document Creation: Generate new Word documents with the docx npm library, with guidance on page size, tables, lists, images, and tables of contents. - Editing & Redlining: Unzip, merge fragmented runs, edit document.xml directly, and validate tracked changes against the original with XSD schema checks. - Comments & Review: Add threaded comments with all required satellite XML files, and accept tracked changes via LibreOffice automation. - Use Case: A lawyer asks you to redline a contract: unpack the .docx, merge runs, wrap edits in w:ins/w:del elements, then validate with --author to confirm every change is tracked. ## Quick Start Ask the assistant to create a professional Word report with a table of contents, or to edit and validate an existing .docx file.

Frequently Asked Questions about docx

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

FAQPage Schema
How do I create a Word document programmatically with docx-js?

Write a Node.js script that requires the preinstalled docx npm package and defines paragraphs, tables, and images. Watch for gotchas: page size defaults to A4, tables need widths on both the table and every cell, and PageBreak must sit inside a Paragraph.

How do I edit an existing .docx file?

Unzip the .docx, run merge_runs.py to coalesce fragmented text runs, edit word/document.xml in place without reformatting, then rezip. The docx npm library cannot open existing files, so direct XML editing is the supported approach.

How do I add tracked changes to a Word document?

Wrap inserted runs in w:ins elements and deleted runs in w:del with w:id, w:author, and w:date attributes; deleted text uses w:delText instead of w:t. Validate with validate.py --original file.docx --author "Name" to catch any untracked edits.

Why does find-and-replace fail in Word document XML?

Word splits visible text across many w:r runs due to revision IDs and spell-check markers, so phrases rarely exist as contiguous strings. Running merge_runs.py first merges adjacent identically-formatted runs so search text becomes findable.

Can this skill handle PDFs or Google Docs?

No, it is scoped to .docx and .dotx files only. It should not be used for PDFs, spreadsheets, or Google Docs; legacy .doc files must first be converted to .docx with LibreOffice.

How do I verify a generated Word document looks correct?

Convert the output to PDF with LibreOffice headless, then rasterize pages with pdftoppm and visually inspect the images. Additionally run validate.py to check the XML against XSD schemas and catch structural errors.