docx

Create and modify Word documents by manipulating OOXML structures with Python.

9|2|Updated Jan 12, 2026
One-click install
npx skills add https://github.com/Kastalien-Research/thoughtbox-dot-claude --skill docx-kastalien-research
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docx
Source: https://github.com/Kastalien-Research/thoughtbox-dot-claude/tree/main/.claude/skills/document-skills/docx
Command: npx skills add https://github.com/Kastalien-Research/thoughtbox-dot-claude --skill docx-kastalien-research

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This skill enables reliable, programmatic creation, modification, and analysis of Word documents (.docx) by manipulating OOXML data and document structures, reducing manual editing time and errors.

Core Features & Use Cases

  • Create new Word documents from structured inputs and templates.
  • Apply and review tracked changes, redlines, and comments for collaborative editing.
  • Automate common formatting tasks, insert images, and manage content types/relationships in large document workflows.
  • Use Case: A legal team auto-generates contract drafts from templates, tracks edits, and exports final versions.

Quick Start

Install Python dependencies (defusedxml, lxml, Pillow), then run example scripts in scripts/document.py to generate or modify a DOCX file.

Frequently Asked Questions about docx

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

FAQPage Schema
How do I automate Word document generation from templates using Python?

Automating Word document generation from templates is achieved by manipulating OOXML data structures with Python. This skill uses lxml and defusedxml to safely modify document relationships, insert images, and generate final .docx files from structured inputs.

Can I apply tracked changes and inline comments to a .docx file programmatically?

Applying tracked changes and inline comments to a .docx file programmatically is fully supported. The skill modifies OOXML structures to add redlines and annotations, enabling auditable collaborative editing workflows for professional document review.

What Python libraries are needed to manipulate OOXML structures for document automation?

Manipulating OOXML structures for document automation requires defusedxml, lxml, and Pillow. These dependencies enable safe XML parsing, document relationship validation, and image processing when creating or editing Word documents.

Is there a way to analyze and validate document relationships in existing Word documents?

Analyzing and validating document relationships in existing Word documents is handled by the skill's internal editors and defusedxml. It audits OOXML structures to ensure safe modifications and validate content types within large document workflows.

What's the best approach for batch editing multiple Word documents without corrupting the formatting?

The best approach for batch editing Word documents without corrupting formatting is direct OOXML manipulation using Python. By leveraging lxml and defusedxml, the skill applies auditable modifications to content types and relationships while preserving the original document structure.