Manipulate .docx files with high layout fidelity using Python-based tools and visual rendering checks.
Install
mkdir -p .claude/skills/doc-cdrguru && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/18707" && unzip -o skill.zip -d .claude/skills/doc-cdrguru && rm skill.zipInstalls to .claude/skills/doc-cdrguru
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Use when the task involves reading, creating, or editing `.docx` documents, especially when formatting or layout fidelity matters; prefer `python-docx` plus the bundled `scripts/render_docx.py` for visual checks.Key capabilities
- →Read or review DOCX content with layout fidelity
- →Create or edit DOCX files with professional formatting
- →Validate visual layout before delivery
- →Convert DOCX to PDF and PNGs for visual checks
- →Use `python-docx` for structured editing
- →Extract text from DOCX as a fallback
How it works
The workflow prioritizes visual review by converting DOCX to PDF and then to PNGs. It uses `python-docx` for structured edits and re-renders after each change to inspect pages, falling back to text extraction if visual review is not possible.
Inputs & outputs
When to use doc
- →Edit professional documentation
- →Create docx reports from code
- →Validate document layout
- →Extract text from Word files
About this skill
DOCX Skill
When to use
- Read or review DOCX content where layout matters (tables, diagrams, pagination).
- Create or edit DOCX files with professional formatting.
- Validate visual layout before delivery.
Workflow
- Prefer visual review (layout, tables, diagrams).
- If
sofficeandpdftoppmare available, convert DOCX -> PDF -> PNGs. - Or use
scripts/render_docx.py(requirespdf2imageand Poppler). - If these tools are missing, install them or ask the user to review rendered pages locally.
- If
- Use
python-docxfor edits and structured creation (headings, styles, tables, lists). - After each meaningful change, re-render and inspect the pages.
- If visual review is not possible, extract text with
python-docxas a fallback and call out layout risk. - Keep intermediate outputs organized and clean up after final approval.
Temp and output conventions
- Use
tmp/docs/for intermediate files; delete when done. - Write final artifacts under
output/doc/when working in this repo. - Keep filenames stable and descriptive.
Dependencies (install if missing)
Prefer uv for dependency management.
Python packages:
uv pip install python-docx pdf2image
If uv is unavailable:
python3 -m pip install python-docx pdf2image
System tools (for rendering):
# macOS (Homebrew)
brew install libreoffice poppler
# Ubuntu/Debian
sudo apt-get install -y libreoffice poppler-utils
If installation isn't possible in this environment, tell the user which dependency is missing and how to install it locally.
Environment
No required environment variables.
Rendering commands
DOCX -> PDF:
soffice -env:UserInstallation=file:///tmp/lo_profile_$$ --headless --convert-to pdf --outdir $OUTDIR $INPUT_DOCX
PDF -> PNGs:
pdftoppm -png $OUTDIR/$BASENAME.pdf $OUTDIR/$BASENAME
Bundled helper:
python3 scripts/render_docx.py /path/to/file.docx --output_dir /tmp/docx_pages
Quality expectations
- Deliver a client-ready document: consistent typography, spacing, margins, and clear hierarchy.
- Avoid formatting defects: clipped/overlapping text, broken tables, unreadable characters, or default-template styling.
- Charts, tables, and visuals must be legible in rendered pages with correct alignment.
- Use ASCII hyphens only. Avoid U+2011 (non-breaking hyphen) and other Unicode dashes.
- Citations and references must be human-readable; never leave tool tokens or placeholder strings.
Final checks
- Re-render and inspect every page at 100% zoom before final delivery.
- Fix any spacing, alignment, or pagination issues and repeat the render loop.
- Confirm there are no leftovers (temp files, duplicate renders) unless the user asks to keep them.
When not to use it
- →When formatting or layout fidelity is not important
- →When working with plain text files
- →When visual review is not possible and text extraction is sufficient
Limitations
- →Requires `soffice` and `pdftoppm` (or `pdf2image` and Poppler) for visual rendering
- →If visual review is not possible, layout risk must be called out
- →Delivers a client-ready document with specific quality expectations
How it compares
This skill emphasizes visual validation and structured editing with `python-docx`, ensuring layout fidelity and professional formatting, unlike simple text-based document processing that ignores visual presentation.
Compared to similar skills
doc side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| doc (this skill) | 0 | 4mo | Review | Intermediate |
| pdf-creator | 0 | 28d | Review | Intermediate |
| docstring | 8 | 9mo | No flags | Beginner |
| pr-draft-summary | 3 | 4mo | No flags | Beginner |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by cdrguru
View all by cdrguru →You might also like
pdf-creator
seaworld008
Create PDF documents from markdown with proper Chinese font support using weasyprint. This skill should be used when converting markdown to PDF, generating formal documents (legal, trademark filings, reports), or when Chinese typography is required. Triggers include "convert to PDF", "generate PDF",
docstring
pytorch
Write docstrings for PyTorch functions and methods following PyTorch conventions. Use when writing or updating docstrings in PyTorch code.
pr-draft-summary
openai
Create a PR title and draft description after substantive code changes are finished. Trigger when wrapping up a moderate-or-larger change (runtime code, tests, build config, docs with behavior impact) and you need the PR-ready summary block with change summary plus PR draft text.
business-document-generator
ailabs-393
This skill should be used when the user requests to create professional business documents (proposals, business plans, or budgets) from templates. It provides PDF templates and a Python script for generating filled documents from user data.
releasenote
DataDog
Create or update release notes for changes in the current branch using Reno, following dd-trace-py's conventions and the guidelines in docs/releasenotes.rst.
report-research
numerai
Write a complete Numerai experiment report in experiment.md (abstract, methods, results tables, decisions, next steps) and generate/link the standard show_experiment plot(s). Use after running any Numerai research experiments, or when a user asks for a “full report”, “write up”, “experiment.md update”, or “generate the standard plot”.