doc

Create, edit, and visually validate DOCX documents using python-docx and LibreOffice rendering.

Updated Feb 4, 2026
One-click install
npx skills add https://github.com/pchemguy/AISandbox --skill doc-pchemguy
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: doc
Source: https://github.com/pchemguy/AISandbox/tree/main/docs/AgentSkills/openai/skills/skills/.curated/doc
Command: npx skills add https://github.com/pchemguy/AISandbox --skill doc-pchemguy

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Editing Word documents programmatically often produces layout defects like broken tables, clipped text, or inconsistent styling that go unnoticed until delivery. This Skill combines structured DOCX editing with visual rendering so every page can be inspected before final delivery. ## Core Features & Use Cases - Structured DOCX Editing: Create and modify headings, styles, tables, and lists with python-docx. - Visual Layout Validation: Render DOCX to PDF and PNG pages via LibreOffice and Poppler to inspect formatting at full fidelity. - Iterative Render Loop: Re-render after each change to catch spacing, alignment, and pagination issues. - Use Case: A consultant needs to update a client report in .docx format. The Skill edits the content, renders every page to images, and verifies typography and table alignment before returning the final file. ## Quick Start Edit this .docx file to update the quarterly figures, then render each page and confirm the layout is clean before returning the final document.

Frequently Asked Questions about doc

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

FAQPage Schema
How do I edit a DOCX file in Python?▼

Use python-docx to open the file and modify headings, paragraphs, styles, tables, and lists programmatically. After editing, render the document to images to verify the layout before delivery.

How to convert DOCX to PDF and images for review?▼

Run LibreOffice headless with soffice --convert-to pdf, then use pdftoppm to rasterize the PDF into PNG pages. The bundled render_docx.py script automates both steps with automatic DPI calculation.

What dependencies are needed to render DOCX files?▼

You need the Python packages python-docx and pdf2image, plus the system tools LibreOffice (soffice) and Poppler (pdftoppm). Install them via uv pip, Homebrew, or apt-get depending on your platform.

Why does DOCX rendering fail with missing tool errors?▼

Rendering fails when soffice or pdftoppm is not installed on the system. The script checks for both tools upfront and reports which ones are missing so you can install LibreOffice and Poppler.

Can I edit DOCX files without rendering them visually?▼

Yes, you can extract and edit text with python-docx alone as a fallback, but layout issues like broken tables or clipped text will go undetected. Visual rendering is recommended whenever formatting fidelity matters.