docx

Automates Word (.docx) creation, editing, and formatting with Python scripts using lxml and defusedxml for XML-safe output.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

The Word document skill streamlines the creation, modification, and formatting of Word documents (.docx), reducing manual effort and ensuring consistent styling across titles, tables, images, and tracked changes.

Core Features & Use Cases

  • Create new documents with structured formatting (headings, TOC, page numbers, letterheads)
  • Read, edit, and format existing documents while preserving layout and styles
  • Insert images, tables, and text with tracked changes and comments for collaboration
  • Use cases include building templates, generating client-ready reports, and transforming data into polished Word outputs

Quick Start

Create a Word document with a polished title and a simple table of contents using the docx skill.

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 with Python scripts?

You can automate Word document generation by running Python scripts that apply structured formatting, insert images and tables, and build templated reports end-to-end without manual effort.

Can I edit existing .docx files while preserving layout and styles?

Yes, you can read and edit existing .docx files while preserving their original layout and styles by safely modifying the underlying XML structure.

How do I add tracked changes and comments to a Word document programmatically?

You can add tracked changes and comments to a Word document programmatically by applying XML edits that insert revision marks and annotations for collaboration.

Does this Word automation approach require lxml and defusedxml?

Yes, it requires lxml and defusedxml-based tooling to ensure safe XML edits, maintain schema-compliant outputs, and protect against malicious XML payloads.

What is the best way to create templated reports and proposals in Word format?

The best way to create templated reports and proposals is to use Python scripts that generate Word documents with consistent styling, headings, tables of contents, and letterheads.

What are the limitations of using lxml for Word document formatting?

Using lxml for Word document formatting requires strict adherence to the .docx XML schema, meaning incorrect node manipulation can corrupt document integrity and break formatting.