docx

Create, edit, and validate Word .docx documents via OOXML manipulation.

Updated Mar 12, 2026
One-click install
npx skills add https://github.com/RavitejaKarra24/dotfiles --skill docx-ravitejakarra24
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docx
Source: https://github.com/RavitejaKarra24/dotfiles/tree/main/agents/.agents/skills/docx
Command: npx skills add https://github.com/RavitejaKarra24/dotfiles --skill docx-ravitejakarra24

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-js cannot open existing files, Word fragments text across runs, and tracked changes or comments require many cross-linked XML parts. This Skill provides tested workflows and scripts to create, read, edit, redline, and comment on .docx and .dotx files reliably. ## Core Features & Use Cases - Document Creation: Generate polished Word documents with the docx npm library, avoiding common pitfalls like A4 defaults, broken table widths, and literal bullet characters. - 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 six required satellite XML files, accept tracked changes via LibreOffice, and render output to PDF for visual verification. - Use Case: A user needs 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 before sending. ## Quick Start Use the docx skill to create a professional Word report with a table of contents and headings, then render it to PDF so I can review the layout.

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 script that requires the preinstalled docx npm package and defines paragraphs, tables, and images. Watch for gotchas: page size defaults to A4, tables need columnWidths plus per-cell widths in DXA, and lists require a numbering config rather than literal bullet characters.

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.

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 the text becomes searchable.

How do I add tracked changes to a Word document?

Wrap inserted runs in w:ins and deleted runs in w:del elements with w:id, w:author, and w:date attributes, using w:delText inside deletions. Validate with validate.py --original plus --author to catch any edits missing tracked-change markup.

Can I add comments to a .docx file with a script?

Yes, comment.py writes comments.xml, commentsExtended.xml, commentsIds.xml, and commentsExtensible.xml plus the required relationships and content-type overrides. It prints the commentRangeStart/End markers you must add to document.xml for the comment to become visible.

What are the limitations of accepting tracked changes programmatically?

pandoc --track-changes=accept never joins paragraphs split by a deleted paragraph mark, leaving stray empty bullets. The accept_changes.py LibreOffice macro joins them correctly except when a deleted paragraph is followed by an empty spacer paragraph.