doc

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

1|Updated Jul 13, 2026
One-click install
npx skills add https://github.com/HalseyYang/Skills-HY --skill doc-halseyyang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: doc
Source: https://github.com/HalseyYang/Skills-HY/tree/main/doc
Command: npx skills add https://github.com/HalseyYang/Skills-HY --skill doc-halseyyang

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 spacing that go unnoticed until delivery. This Skill combines structured DOCX editing with page-by-page visual rendering so formatting issues are caught before the document reaches the client. ## Core Features & Use Cases - Structured DOCX Editing: Create and modify headings, styles, tables, and lists programmatically with python-docx. - Visual Layout Validation: Render DOCX files to PDF and then to PNG pages using LibreOffice and Poppler, or the bundled render_docx.py script, to inspect every page at full zoom. - Iterative Render Loop: Re-render after each meaningful change to confirm typography, margins, alignment, and pagination remain clean. - Use Case: You need to update a 20-page client report in .docx format. Edit the content with python-docx, render the pages to images, inspect each one for layout defects, fix issues, and deliver a polished final document. ## Quick Start Edit this .docx file to update the quarterly figures, then render each page to images 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 programmatically in Python?

Use python-docx to open the file and modify headings, styles, tables, and lists through its document object model. After editing, save the file and re-render it to verify the layout visually.

How to convert DOCX to images for visual review?

Convert the DOCX to PDF with LibreOffice using soffice --headless --convert-to pdf, then rasterize the PDF to PNGs with pdftoppm. The bundled render_docx.py script automates both steps and computes an appropriate DPI.

What dependencies are required to render DOCX pages?

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

Why does DOCX rendering fail with a missing tool error?

The render script raises an error when soffice or pdftoppm is not found on the system PATH. Install LibreOffice and Poppler, then retry; if installation is impossible, fall back to text extraction with python-docx and note the layout risk.

Can python-docx preserve complex formatting when editing?

python-docx preserves most existing styles and structures when modifying content, but highly complex layouts may shift. Always re-render and inspect every page after edits to catch spacing, alignment, or pagination regressions.