docx

Create and modify .docx documents with tracked changes and comments via python-docx or OOXML.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires python-docx, lxml, defusedxml, and includes scripts (resource) and references (resource) components.

What problem does it solve?

Enables programmatic creation, modification, and review of professional Word (.docx) documents while preserving formatting, tracked changes, comments, and cross-engine compatibility (Word and WPS). It removes manual error-prone editing and produces studio-quality covers, TOCs, tables, charts, and academically or legally compliant layouts.

Core Features & Use Cases

  • Precise document generation and editing with validated cover recipes and layout rules for academic, report, contract, and copywriting scenarios.
  • Robust tracked-changes and comment workflows using either python-docx (simple comments) or OOXML-level manipulation for complex redlining and replies.
  • Post-generation validation and TOC placeholder insertion via provided Python utilities to detect blank pages, cover overflow, spacing issues, table and image problems, and page-numbering rules.
  • Chart and image embedding with aspect-ratio preservation, three-line table styles for academia, and scene-specific font and pagination handling.

Quick Start

Use this skill to generate or update a .docx with a validated cover, TOC placeholders, preserved images, and tracked changes using the scripts and libraries included in the skill.

Frequently Asked Questions about docx

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

FAQPage Schema
How do I generate .docx documents with tracked changes and comments programmatically?

Programmatic .docx generation with tracked changes and comments uses python-docx for simple comments or OOXML-level manipulation for complex redlining and replies. This approach automates review workflows while preserving formatting and metadata across Word and WPS engines.

Can I validate a .docx file for layout issues like cover overflow or blank pages after generation?

Post-generation validation of .docx files detects blank pages, cover overflow, spacing issues, table and image problems, and page-numbering rule violations. Provided Python utility scripts automate this validation to ensure documents meet academic, report, or contract layout standards.

What's the best way to insert a table of contents placeholder and enforce cover recipes in a Word document?

Inserting TOC placeholders and enforcing validated cover recipes in Word documents is handled through included Python utilities and layout rules. This ensures consistent cover formatting and TOC generation for academic theses, contracts, and automated reporting workflows.

Does python-docx support embedding images with aspect-ratio preservation and three-line academic table styles?

python-docx supports embedding images with aspect-ratio preservation and applying three-line table styles for academic layouts. These features ensure charts and images maintain visual integrity while meeting scene-specific font and pagination handling requirements.

How do I handle complex tracked changes and comment replies that python-docx cannot modify directly?

Complex tracked changes and comment replies that exceed python-docx capabilities require direct OOXML-level manipulation using lxml and defusedxml. This approach accesses underlying XML structures for advanced redlining operations not exposed by the standard python-docx API.

Why do my generated .docx files display inconsistently between Microsoft Word and WPS Office?

Cross-engine .docx compatibility issues between Word and WPS arise from inconsistent style definitions and unsupported OOXML features. Applying validated layout rules, consistent style enforcement, and post-generation validation scripts ensures documents render correctly across both office suites.