mcpField
O
odt

odt

github.com/sungkhumDocuments037 installsUpdated 37w ago
Repository

About odt

ODT Document Skill is a workflow guide for people reading, creating, editing, or validating ODT documents. It directs tasks to suitable libraries or raw XML methods and provides references for package structure, tracked changes, and language settings.

Key features

  1. 01Extracts text with conversion tools
  2. 02Creates and edits documents with odfdo
  3. 03Handles tracked changes and annotations
  4. 04Supports direct XML package editing
  5. 05Provides validation and conversion workflows

Use cases

  1. 01Summarizing text and tables in an ODT file
  2. 02Editing text while retaining tracked changes
  3. 03Setting language and fonts in document styles
  4. 04Checking package contents and schema validity

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/sungkhum/agent-skills --skill odt

After installing, type/odtin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

agents/
openai.yaml
assets/
Test-Format-ODT-Khmer.odt
Test-Format-ODT.odt
odf/schemas/odf-1.3/
OpenDocument-v1.3-dsig-schema.rng
OpenDocument-v1.3-manifest-schema.rng
OpenDocument-v1.3-metadata.owl
OpenDocument-v1.3-package-metadata.owl
odf/scripts/
annotation_smoke_test.py
example_tracked_changes.py
fetch_schemas.py
pack.py
set_language.py
unpack.py
validate_changes.py
validate_rng_all.py
validate_rng.py
validate.py
references/
odf-schemas.md
odf-xml.md
odfdo.md
odt-change-tracking.md
odt-document.md
odt-language.md
odt-structure.md
tools.md
scripts/
__init__.py
annotation_smoke_test.py
example_tracked_changes.py
fetch_odf_schemas.py
odt_document.py

Details

From the project README

ODT Document Skill

An .odt file is a ZIP package containing XML files and assets. Use high-level libraries when possible; fall back to raw XML for complex formatting, tracked changes, or precise control.

Reference files

TopicFile
Package structurereferences/odt-structure.md
Tracked changesreferences/odt-change-tracking.md
Language/localereferences/odt-language.md
XML patternsreferences/odf-xml.md
odfdo libraryreferences/odfdo.md
ODTDocument APIreferences/odt-document.md
Schema validationreferences/odf-schemas.md
Tools overviewreferences/tools.md

Example prompts

  • "Extract all text from this ODT and summarize headings and tables."
  • "Apply tracked changes to replace these phrases, keeping redlines intact."
  • "Set Khmer language/locale and fonts for all paragraph styles."
  • "Validate this ODT package and report any missing files."
  • "Unpack, edit content.xml, and repack without breaking styles."

Workflow decision tree

TaskApproach
Read/extract textUse pandoc or odfdo-markdown
Create new documentRead references/odfdo.md, use odfdo library
Simple editsRead references/odfdo.md, use odfdo library
Tracked changes/annotationsRead references/odt-document.md, use ODTDocument API
Complex XML editsRead references/odf-xml.md, edit XML directly

Core operations

Text extraction
pandoc document.odt -o document.md      # Convert to Markdown
odfdo-markdown document.odt > out.md    # Alternative
Unpack/pack workflow
python scripts/unpack_odt.py <file.odt> <dir>   # Unpack
# ... edit XML files ...
python scripts/pack_odt.py <dir> <file.odt>     # Repack
Using ODTDocument library

Scripts using ODTDocument require PYTHONPATH set to the skill root. If you're running from a repo root, point it explicitly to the skill folder:

PYTHONPATH=/path/to/repo/skills/odt python your_script.py
# example from repo root
PYTHONPATH=skills/odt python your_script.py
Creating documents with odfdo

Read references/odfdo.md first. Basic example:

from odfdo import Document, Paragraph
doc = Document('text')
doc.body.append(Paragraph('Hello'))
doc.save('output.odt')
Raw XML editing

Read references/odf-xml.md first. Key files:

  • content.xml — main document content
  • styles.xml — document styles
  • META-INF/manifest.xml — package manifest (update when adding files)

Tracked changes workflow

Read references/odt-change-tracking.md for structure details. Key principles:

  • Batch changes: Group 3–10 related changes per batch for debugging
  • Minimal marking: Only mark text that actually changes

Workflow:

  1. Convert to Markdown: pandoc doc.odt -o doc.md
  2. Identify and group changes into batches
  3. Use ODTDocument.suggest_replacement() / suggest_insertion() / suggest_deletion()
  4. Validate: python scripts/validate_changes.py content.xml
  5. Repack and verify in LibreOffice

Language support (Khmer, Thai, Arabic, etc.)

See references/odt-language.md. Helper script:

python scripts/set_language.py styles.xml --lang km --country KH --font "Khmer OS System"

Converting ODT to PDF/images

soffice --headless --convert-to pdf document.odt    # ODT → PDF
pdftoppm -jpeg -r 150 document.pdf page             # PDF → images

Dependencies

Required

  • odfdo: pip install odfdo (ODT creation/editing)
  • defusedxml: pip install defusedxml (safe XML parsing)

Optional

  • pandoc: brew install pandoc (Markdown conversion)
  • LibreOffice: brew install --cask libreoffice (ODT → PDF)
  • jing: Relax NG validator for validate_rng.py
  • Poppler: brew install poppler (pdftoppm for PDF → images)

Validation scripts

python scripts/validate_odt.py <dir> --original <file.odt>     # Package validation
python scripts/validate_changes.py <dir>/content.xml           # Change tracking
python scripts/validate_rng.py <dir>/content.xml               # RNG schema (needs jing)
python scripts/smoke_test.py <file.odt> <work_dir>             # Full roundtrip

Comments

Markdown supported