docx

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

Updated May 23, 2026
One-click install
npx skills add https://github.com/kiranimmadi2/promptforge-ai --skill docx-kiranimmadi2
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docx
Source: https://github.com/kiranimmadi2/promptforge-ai/tree/main/anthropic-skills/skills/docx
Command: npx skills add https://github.com/kiranimmadi2/promptforge-ai --skill docx-kiranimmadi2

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires docx, pandoc, libreoffice, poppler, defusedxml, lxml, 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 with strict schema rules, and common libraries have pitfalls like wrong default page sizes, broken table widths, and invalid tracked changes. This Skill provides tested workflows and validation tooling to reliably create, read, and edit .docx files without corrupting them. ## Core Features & Use Cases - Document Creation: Generate polished Word documents with docx-js, including tables of contents, headings, lists, tables, images, footnotes, headers/footers, hyperlinks, and multi-column layouts, with explicit page size and style control. - Document Editing: Unpack existing .docx files, edit the XML directly to perform find-and-replace, insert tracked changes, and add threaded comments, then repack with schema validation and auto-repair. - Content Extraction & Conversion: Extract text with pandoc (including tracked changes), convert legacy .doc files, accept all tracked changes via LibreOffice, and render documents to PDF or images. - Use Case: A user asks for a quarterly report as a Word file with a table of contents, styled headings, and a data table; the Skill generates it with docx-js, validates the output, and delivers a clean .docx. ## Quick Start Ask the assistant to create a Word document report with a table of contents, headings, and a formatted table, or to edit an uploaded .docx file with tracked changes.

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 paragraphs, tables, and images, then write it with Packer.toBuffer. Always set the page size explicitly 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 the word/ directory directly, then repack with the pack script. Packing runs schema validation with auto-repair for common issues like missing xml:space attributes.

How do I add tracked changes to a Word document?

Insert w:ins and w:del elements around the affected runs in document.xml, using w:delText instead of w:t inside deletions. Replace entire w:r blocks rather than nesting change tags inside runs, and preserve the original run's formatting properties.

Why do my docx-js tables render incorrectly?

Tables need dual widths: set columnWidths on the table and a matching width on every cell, all in DXA units summing to the table width. Never use WidthType.PERCENTAGE, which breaks in Google Docs, and use ShadingType.CLEAR for cell shading.

Can this skill handle PDFs, Google Docs, or spreadsheets?

No, it is scoped to Word .docx files only. It can convert .docx to PDF or images via LibreOffice and pdftoppm for previewing, but it does not create or edit PDFs, spreadsheets, or Google Docs documents.

How do I convert a legacy .doc file to .docx?

Run the soffice.py helper with LibreOffice in headless mode using the --convert-to docx flag. Legacy .doc files must be converted to .docx before any reading or editing workflow can be applied.