Doc

From CarlosCaPe/octorato · View interactive version

Doc is an AI agent skill from the GitHub repository CarlosCaPe/octorato. 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.

How to use this skill

Skill file

DOCX Skill

When to use

Workflow

  1. Prefer visual review (layout, tables, diagrams).
  1. Use python-docx for edits and structured creation (headings, styles, tables, lists).
  2. After each meaningful change, re-render and inspect the pages.
  3. If visual review is not possible, extract text with python-docx as a fallback and call out layout risk.
  4. Keep intermediate outputs organized and clean up after final approval.

Temp and output conventions

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

Final checks

Lessons Learned

LibreOffice footer rendering limitations (2026-03-27)

Context: Generating DOCX with python-docx, rendering to PDF via LibreOffice headless.

  1. PAGE fields created programmatically don't render in footers.
  1. SDT (Structured Document Tags) block subsequent runs in footer paragraphs.
  1. Text box vertical alignment requires per-footer-type calibration.
  1. Flatpak sandbox file visibility.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.