docx

Create, edit, and validate Word documents using docx-js and OOXML manipulation.

1|Updated Apr 3, 2026
One-click install
npx skills add https://github.com/Pgooone/oh-pgone-claudecode --skill docx-pgooone
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: docx
Source: https://github.com/Pgooone/oh-pgone-claudecode/tree/main/.claude/skill/docx
Command: npx skills add https://github.com/Pgooone/oh-pgone-claudecode --skill docx-pgooone

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Working with Word documents programmatically is error-prone: .docx files are ZIP archives of XML, and naive generation or editing produces corrupt files, broken tables, lost tracked changes, or invalid formatting. This Skill provides tested workflows and scripts to create, read, and edit .docx files reliably. ## Core Features & Use Cases - Document Creation: Generate polished Word documents with docx-js, including tables of contents, headings, lists, tables, images, footnotes, headers/footers, and multi-column layouts, with explicit page size and style control. - Surgical Editing: Unpack existing .docx files, edit the raw XML directly (tracked changes, comments, find-and-replace, image insertion), then repack with schema validation and auto-repair. - Review Workflows: Add threaded comments, insert or delete text as tracked changes attributed to an author, and accept all tracked changes via LibreOffice. - Use Case: A user asks to redline a contract draft. The Skill unpacks the .docx, marks deletions and insertions as tracked changes authored by "Claude", validates the XML against OOXML schemas, and repacks a clean, non-corrupt file. ## Quick Start Use the docx skill to create a professional Word report with a table of contents, headings, and a formatted table, then save it as report.docx.

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 JavaScript?▼

Use the docx npm library (docx-js) to build a Document object with Paragraph, Table, and ImageRun elements, then write it with Packer.toBuffer. Always set the page size explicitly in DXA units since docx-js defaults to A4, and validate the output file afterward.

How do I edit an existing .docx file without corrupting it?▼

Unpack the .docx into its XML parts with the unpack script, edit the XML in word/document.xml directly, then repack with validation enabled. The pack step runs XSD schema validation and auto-repairs common issues like invalid durableIds and missing whitespace preservation.

How do I add tracked changes to a Word document in code?▼

Wrap inserted runs in w:ins elements and deleted runs in w:del elements with w:delText, each carrying an id, author, and date attribute. Replace entire w:r blocks rather than injecting tags inside runs, and copy the original run's w:rPr to preserve formatting.

Why do my generated Word tables render incorrectly?▼

Tables need dual widths: set columnWidths on the table and a matching width on every cell, all in DXA units that sum exactly to the table width. Avoid WidthType.PERCENTAGE, which breaks in Google Docs, and use ShadingType.CLEAR instead of SOLID for cell shading.

Can this skill handle PDFs or Google Docs?▼

No, it is scoped to .docx files only. Legacy .doc files must first be converted to .docx via LibreOffice, and PDFs, spreadsheets, and Google Docs are explicitly out of scope.

How do I accept all tracked changes in a docx file?▼

Run the accept_changes.py script with the input and output file paths. It uses a LibreOffice headless macro to accept all tracked changes and saves a clean document, requiring LibreOffice to be installed.