Agent skill

DOCX Toolkit

by XiaomiMiMo in XiaomiMiMo/MiMo-Code

Produces, edits and reads Microsoft Word files through python-docx and lxml, with a decision table for picking the lightest workflow for a given task.

Apache-2.0Auto-check passedDocuments & Office

Install DOCX Toolkit

skills CLI
$ npx skills add XiaomiMiMo/MiMo-Code --skill docx-official -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install XiaomiMiMo/MiMo-Code docx-official --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/XiaomiMiMo/MiMo-Code.git skills-src && mkdir -p .claude/skills && cp -r skills-src/packages/cli/src/skill/builtin/.bundle/docx-official .claude/skills/docx-official && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
docx-official
GitHub stars
14k
Token cost
~2.4k tokens
SKILL.md length
910 words
Files
14 (incl. scripts)
Skills in repo
22
Repo updated
First seen
Licence
Apache-2.0

At a glance

Produces, edits and reads Microsoft Word files through python-docx and lxml, with a decision table for picking the lightest workflow for a given task.

  • Works in 7 steps: Rely on named styles. Use Heading 1,… → One idea per paragraph. Long paragraphs… → Structure first, prose second. Draft the… → …
  • Drafting a report, contract or letter as a new Word document
  • SKILL.md covers Decision matrix, One-time environment setup, Common commands and Authoring principles, plus 5 more sections
  • Runs Python scripts from its folder; calls uv, python3 and soffice

What it does

Built from scratch against the ECMA-376 / ISO/IEC 29500 specification rather than a proprietary library, the skill picks one of several paths depending on the job: authoring from scratch with python-docx when there is no source file, in-place placeholder replacement when a template just needs filling, an explode-edit-XML-reassemble workflow for deep structural changes, or a dedicated extraction pipeline when only text or metadata is needed. A LibreOffice-based script can render a PDF preview for QA.

Every script carries inline PEP 723 dependency metadata so uv run resolves python-docx and lxml automatically, and a bundled runtime variable lets the skill skip package installation entirely when one is preconfigured. Mixed tasks are expected to follow read, then plan, then edit or create, then validate, in that order.

When your agent uses it

  • Drafting a report, contract or letter as a new Word document
  • Filling an existing Word template while keeping its styling
  • Making a deep structural edit to a .docx that in-place editing cannot reach
  • Extracting text, structure or metadata from a Word file

Example prompts

  • “Fill this RFP template with our company details, keeping its styles intact.”
  • “Extract all the headings and tables from this .docx into plain text.”
  • “Restructure this document with new sections using the explode and reassemble workflow.”
  • “Render a PDF preview of this draft so I can check the layout.”

Requirements

  • Python with python-docx and lxml (resolved automatically by uv run)
  • LibreOffice, optional, for PDF previews

Workflow steps

7 steps, taken from the first numbered list in SKILL.md.

  1. Rely on named styles. Use Heading 1, Heading 2, Normal, Title, Quote, List Bullet, List Number, Caption. They are what makes Word's ToC…
  2. One idea per paragraph. Long paragraphs are fine; run-on paragraphs are not. Break at logical boundaries.
  3. Structure first, prose second. Draft the heading tree, then write inside it. Reviewers scan headings before words.
  4. Tables for tabular data only. Do not use tables to fake multi-column layouts — export to PDF and users see the borders through the layout.
  5. Line length is set by page margins, not by hard breaks. Never insert manual line breaks to control wrapping.
  6. Use fields, not literal text, for things that change — page numbers, dates, ToC, cross-references. python-docx supports field codes via…
  7. Every image needs alt text — accessibility, and Word screams at you in review mode when it's missing.

What it can do on your machine

Read from SKILL.md and the folder at commit 6babeb0. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 8 files in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • uv
    • python3
    • soffice

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • ecma-international.org
    • peps.python.org

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

DOCX Toolkit loads about 2.4k tokens when it runs. Until then it costs about 156 tokens; SKILL.md has 910 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~156
When it runs · the whole SKILL.md, loaded when a task matches
~2.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from XiaomiMiMo/MiMo-Code at commit 6babeb0, republished under its Apache-2.0 licence (© XiaomiMiMo). 910 words, ~2,355 tokens.

Download SKILL.mdSave it as .claude/skills/docx-official/SKILL.md (or your agent's skills folder). This skill also uses 13 other files; get the full folder from GitHub.
name
docx-official
description
Use this skill whenever a Microsoft Word (.docx) file is being produced, opened, transformed, or read. That includes: drafting reports, letters, contracts, RFPs, technical documents, or any long-form written deliverable; extracting text or structure from an existing Word file; filling a Word template with values; converting Word to PDF or plain text; splitting or merging documents; inspecting styles, headings, sections, tables, images, comments, or tracked changes. Trigger on mentions of 'Word doc', 'DOCX', 'Office document', a filename ending in .docx, or requests like 'turn this into a Word report'.
license
Apache-2.0 — see LICENSE for terms and third-party attributions

DOCX Skill

An Apache-2.0 toolkit for producing, editing, and reading Microsoft Word (.docx) files. Written from scratch against the public ECMA-376 / ISO/IEC 29500 specification and built on permissively-licensed tooling (python-docx MIT, lxml BSD-3-Clause, optional external binaries pandoc and soffice) so it can be reused in commercial projects without restriction.

Decision matrix

SituationPathRead first
No source file — build a document from a prompt / dataAuthor from scratch with python-docxcreate.md
You have a .docx template to fill in or lightly modifyPlaceholder replacement via python-docx, keeps stylesedit.md → Workflow A — python-docx in-place edit
Deep structural edits, new sections, custom XML, unusual layoutsExplode → edit XML → assembleedit.md → Workflow B — Explode → edit XML → assemble
You only need the text / structure / metadata out of a .docxExtraction pipelineread.md
Need a PDF preview for QAscripts/render_pdf.py via LibreOfficesee QA below

If the task mixes several of these, do them in this order: read → plan → edit/create → validate.

One-time environment setup

Bundled runtime: when the MIMO_PYTHON environment variable is set, skip uv/python3 and pip installs entirely — run every command below with uv run replaced by "$MIMO_PYTHON" (e.g. "$MIMO_PYTHON" scripts/extract_text.py input.docx). This skill's Python dependencies are preinstalled in that interpreter; pip console scripts are unavailable, so always go through "$MIMO_PYTHON" -m <module>. A bundled LibreOffice is exposed as MIMO_SOFFICE and picked up automatically by the scripts here.

All scripts include PEP 723 inline metadata, so uv run resolves dependencies automatically — no manual install step needed. Just run:

bash
uv run scripts/extract_text.py input.docx

If you don't use uv, install dependencies once:

bash
python3 -m pip install --upgrade python-docx lxml
# Optional but recommended:
#   LibreOffice (for docx → pdf preview):   brew install --cask libreoffice   (macOS)
#                                           apt-get install -y libreoffice    (Debian/Ubuntu)
#   Poppler   (for pdf → image, QA loop):   brew install poppler

Alternatively, if this skill lives in a persistent workspace you can uv init a project, uv add python-docx lxml, and run scripts with uv run scripts/... from the project root — this gives you a lockfile and reproducible environment.

All scripts here use the standard library plus python-docx. No proprietary dependencies.

Common commands

bash
# 1. Extract plain text (best for "what does this file say?" questions)
uv run scripts/extract_text.py input.docx > input.txt

# 2. Explode a .docx into readable XML for structural surgery
uv run scripts/explode.py input.docx exploded/

# 3. Assemble an exploded directory into a fresh .docx
uv run scripts/assemble.py exploded/ output.docx

# 4. Render a .docx as PDF (used for visual QA)
uv run scripts/render_pdf.py output.docx           # writes output.pdf next to it

# 5. Well-formedness check (ZIP integrity + parseable XML + python-docx open)
uv run scripts/audit.py output.docx

# 6. Accept every tracked change without needing Word/LibreOffice
uv run scripts/resolve_revisions.py reviewed.docx clean.docx

# 7. Add a comment to an exploded directory
uv run scripts/annotate.py exploded/ "Please check" --author "Reviewer" --anchor "text"

Every script is a small, self-contained Python file. Read the top of the file for full CLI options.

Authoring principles

Word is a flowing document format, not a slide surface. Users expect it to look like something a human wrote in Word — not a design tool trying to reinvent typography. Keep that in mind:

  1. Rely on named styles. Use Heading 1, Heading 2, Normal, Title, Quote, List Bullet, List Number, Caption. They are what makes Word's ToC, navigation pane, and cross-references work.
  2. One idea per paragraph. Long paragraphs are fine; run-on paragraphs are not. Break at logical boundaries.
  3. Structure first, prose second. Draft the heading tree, then write inside it. Reviewers scan headings before words.
  4. Tables for tabular data only. Do not use tables to fake multi-column layouts — export to PDF and users see the borders through the layout.
  5. Line length is set by page margins, not by hard breaks. Never insert manual line breaks to control wrapping.
  6. Use fields, not literal text, for things that change — page numbers, dates, ToC, cross-references. python-docx supports field codes via low-level XML (see edit.md).
  7. Every image needs alt text — accessibility, and Word screams at you in review mode when it's missing.

Typography defaults (safe starting point)

ElementFontSizeWeightNotes
TitleCalibri Light28ptBoldCentered or left, one line
Heading 1Calibri Light18ptBoldSpace before 12pt
Heading 2Calibri Light14ptBoldSpace before 10pt
Heading 3Calibri12ptBoldSpace before 6pt
BodyCalibri11ptRegularLine spacing 1.15, space after 6pt
CaptionCalibri9ptItalicMuted gray #595959
Code / monoConsolas10ptRegularLeft-aligned, no first-line indent

Change the palette for the topic — muted navy #1F3A5F for legal/finance, warm charcoal #2E2A26 for editorial. Avoid pure #000000 for body text; #1F1F1F reads softer on print.

Show full SKILL.md (352 more words)Show less

Page setup (A4 vs Letter)

Ask the user which one to use. If you cannot ask, default to the region implied by the language (Chinese/European → A4, US English → Letter). Margins:

SizeWidth × HeightStandard margins (T/B/L/R)
A421.0 × 29.7 cm2.54 / 2.54 / 3.18 / 3.18 cm
Letter8.5 × 11.0 in1.00 / 1.00 / 1.25 / 1.25 in

QA checklist — always run before declaring done

Assume something is wrong. Word files fail silently: a broken relationship, an unclosed <w:p>, a missing style — Word will still open the file but strip content or throw a "content had problems" warning. Verify explicitly.

  1. Open cleanly — no repair prompt.
    bash
    uv run python -c "import docx; docx.Document('output.docx')"   # loads without exceptions
  2. Text integrity — no placeholder residue.
    bash
    uv run scripts/extract_text.py output.docx | grep -Ei "TODO|TBD|\{\{|lorem|xxxx"
    Grep must return nothing.
  3. Visual sanity — render a PDF, open the first and last pages, scan for:
    • Widowed headings alone at the bottom of a page.
    • Tables split awkwardly across pages.
    • Images pushed to their own page because they exceeded content width.
    • Missing page numbers, wrong header/footer content.
    bash
    uv run scripts/render_pdf.py output.docx
  4. Style hygiene — every heading uses a real style, not just bold+large text:
    bash
    uv run python -c "
    import docx; d = docx.Document('output.docx')
    for p in d.paragraphs:
        if p.text and p.style.name == 'Normal' and p.runs and p.runs[0].bold:
            print('possible fake heading:', p.text[:80])"

If any of these fail, fix and re-run — don't paper over.

What is out of scope

  • .doc (legacy Word 97-2003) — this skill only targets .docx (Office Open XML). Convert .doc to .docx with LibreOffice first: soffice --headless --convert-to docx old.doc.
  • Live collaborative editing — the Word online API is a separate concern; here we produce and modify files.
  • Macros / VBA — do not generate .docm files. If the user asks for automation, offer a Python script that regenerates the doc instead.

Where each detail lives

  • Creating from scratch: create.md — headings, paragraphs, styles, tables, images, page setup, headers/footers, tables of contents.
  • Editing / templating: edit.md — placeholder replacement, section swap, raw XML surgery, tracked changes, comments.
  • Reading / extracting: read.md — plain-text export, structural walk, metadata, table extraction.
  • Scripts: scripts/ — self-contained CLI utilities used by all of the above.

© XiaomiMiMo, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 13 other files (scripts) in packages/cli/src/skill/builtin/.bundle/docx-official of XiaomiMiMo/MiMo-Code.

  • SKILL.md
  • LICENSE
  • README.md
  • create.md
  • edit.md
  • read.md
  • scripts/annotate.py
  • scripts/assemble.py
  • scripts/audit.py
  • scripts/explode.py
  • scripts/extract_text.py
  • scripts/render_pdf.py
  • scripts/resolve_revisions.py
  • scripts/transcode.py

Open the folder on GitHubat commit 6babeb0

Compare with similar skills

DOCX Toolkit next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

DOCX Toolkit compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
DOCX Toolkit this skillXiaomiMiMo/MiMo-Code14k—~2.4kAutomated safety check: PassApache-2.0
DOCX Creation and Editinganthropics/skills180k6 repos~1.7kAutomated safety check: PassProprietary
Office File Processxstongxue/best-skills2.9k—~1.8kAutomated safety check: PassProprietary
Huashu Markdown Publishing Pipelinealchaincyf/huashu-md-html908—~4.8kAutomated safety check: PassMIT
Word DOCX ToolkitNousResearch/hermes-agent252k—~2.6kAutomated safety check: PassMIT
Industry Bid Document WriterGet00/BiaoShu-SKILL167—~4.6kAutomated safety check: PassApache-2.0

Similar skills

  • DOCX Creation and Editing

    anthropics/skills

    Official

    Creates, edits and reviews Word documents: new files with docx-js, edits through the underlying XML, plus tracked changes, comments and conversions.

    180k GitHub starsUsed in 6 repos~1.7k tokens
    Documents & OfficeAuto-check passed
  • Office File Process

    xstongxue/best-skills

    处理 Office 文档的一站式 skill:Word(.doc/.docx/.dotx)、Excel(.xls/.xlsx/.xlsm/.csv)、PowerPoint(.ppt/.pptx/.potx) 的创建、读取、编辑、提取、转换、校验。触发:『读取 word 文档』『提取 excel 内容』『看 ppt 讲了什么』、.doc 老格式打不开、生成/编辑 Word…

    2.9k GitHub stars~1.8k tokensUpdated 24 days ago
    Documents & OfficeAuto-check passed
  • Huashu Markdown Publishing Pipeline

    alchaincyf/huashu-md-html

    Converts files and web pages into clean Markdown, then turns Markdown into polished HTML, Word, PDF and EPUB using four templates.

    908 GitHub stars~4.8k tokensUpdated 1 mo ago
    Documents & OfficeAuto-check passed
  • Word DOCX Toolkit

    NousResearch/hermes-agent

    Creates, reads, edits and templates Word .docx files with python-docx scripts, including tracked changes, comments, tables of contents and health checks.

    252k GitHub stars~2.6k tokensUpdated today
    Documents & OfficeAuto-check passed
  • Industry Bid Document Writer

    Get00/BiaoShu-SKILL

    Converts a tender document into Markdown, extracts scoring criteria and requirements, then drafts an industry-formatted technical bid as a Word file.

    167 GitHub stars~4.6k tokensUpdated 13 days ago
    Documents & OfficeAuto-check passed
  • Doc To Markdown

    daymade/claude-code-skills

    Converts DOCX/PDF/PPTX and saved HTML/HTM to high-quality Markdown with automatic post-processing.

    1.4k GitHub stars~2.5k tokensUpdated today
    Documents & OfficeAuto-check passed

More from XiaomiMiMo/MiMo-Code

All 22 skills in this repo
  • Paper Research on arXiv

    XiaomiMiMo/MiMo-Code

    Searches arXiv, fetches metadata, generates BibTeX, downloads PDFs and finds citations and related papers using a bundled Python script.

    14k GitHub starsUsed in 1 repo~1.5k tokens
    Auto-check passed
  • Agent Skill Creator

    XiaomiMiMo/MiMo-Code

    Interactive guide for creating, reviewing and fixing agent skills (SKILL.md folders), covering structure, frontmatter rules, trigger phrases and validation before sharing.

    14k GitHub stars~1.9k tokensUpdated 4 days ago
    Auto-check passed
  • Drive MiMo Code

    XiaomiMiMo/MiMo-Code

    Lets one MiMoCode process drive another, headless with JSON events or interactively through tmux, to test behavior and visual regressions with parseable evidence.

    14k GitHub stars~3.9k tokensUpdated 4 days ago
    Auto-check passed
  • PDF Toolkit

    XiaomiMiMo/MiMo-Code

    Reads, transforms, composes and fills PDFs with Python scripts for extraction, merging, watermarking, encryption, OCR and form filling.

    14k GitHub stars~1.7k tokensUpdated 4 days ago
    Auto-check passed
  • XLSX Spreadsheet Toolkit

    XiaomiMiMo/MiMo-Code

    Builds, edits, cleans, recalculates and reads Excel workbooks and CSV files with openpyxl and pandas, plus LibreOffice for recalculation and PDF export.

    14k GitHub stars~2.9k tokensUpdated 4 days ago
    Auto-check passed
  • Claude Code Delegation

    XiaomiMiMo/MiMo-Code

    Hands coding work to the Claude Code CLI from the terminal in print, interactive tmux or background mode, only when you explicitly ask for Claude Code.

    14k GitHub stars~1.3k tokensUpdated 4 days ago
    Auto-check passed

Questions about DOCX Toolkit

What does DOCX Toolkit do?

Produces, edits and reads Microsoft Word files through python-docx and lxml, with a decision table for picking the lightest workflow for a given task. Built from scratch against the ECMA-376 / ISO/IEC 29500 specification rather than a proprietary library, the skill picks one of several paths depending on the job: authoring from scratch with python-docx when there is no source file, in-place placeholder replacement when a template just needs filling, an explode-edit-XML-reassemble workflow for deep structural changes, or a dedicated extraction pipeline when only text or metadata is needed. A LibreOffice-based script can render a PDF preview for QA.

When should I use DOCX Toolkit?

DOCX Toolkit fits situations like: drafting a report, contract or letter as a new Word document; filling an existing Word template while keeping its styling; making a deep structural edit to a .docx that in-place editing cannot reach; extracting text, structure or metadata from a Word file.

How do I install DOCX Toolkit in Claude Code?

Run `npx skills add XiaomiMiMo/MiMo-Code --skill docx-official -a claude-code`. Or copy the skill folder (packages/cli/src/skill/builtin/.bundle/docx-official in XiaomiMiMo/MiMo-Code) into .claude/skills/docx-official in your project. Claude Code loads it when a task matches its description.

How do I install DOCX Toolkit in Codex?

Run `npx skills add XiaomiMiMo/MiMo-Code --skill docx-official -a codex`. Or copy the skill folder (packages/cli/src/skill/builtin/.bundle/docx-official in XiaomiMiMo/MiMo-Code) into .agents/skills/docx-official in your project. Codex loads it when a task matches its description.

Can I use DOCX Toolkit in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add XiaomiMiMo/MiMo-Code --skill docx-official -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/docx-official, .gemini/skills/docx-official, .github/skills/docx-official and .opencode/skills/docx-official in your project.

What does DOCX Toolkit need to run?

Going by SKILL.md and its folder, DOCX Toolkit needs Python for the scripts in its folder and the command-line tools its instructions call (uv, python3 and soffice). Our summary lists: Python with python-docx and lxml (resolved automatically by uv run); LibreOffice, optional, for PDF previews.

Does DOCX Toolkit access the network?

SKILL.md names 2 domains. As links in the text: ecma-international.org and peps.python.org. This is read from the text; nothing was executed.

Is DOCX Toolkit safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does DOCX Toolkit use?

DOCX Toolkit is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does DOCX Toolkit use?

About 2.4k tokens (SKILL.md is roughly 9.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to DOCX Toolkit?

Skills that share tags, products or a category with DOCX Toolkit: DOCX Creation and Editing (anthropics/skills, 180k stars), Office File Process (xstongxue/best-skills, 2.9k stars), Huashu Markdown Publishing Pipeline (alchaincyf/huashu-md-html, 908 stars) and Word DOCX Toolkit (NousResearch/hermes-agent, 252k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains DOCX Toolkit?

XiaomiMiMo (a GitHub organization) maintains it in XiaomiMiMo/MiMo-Code, which has 13,601 GitHub stars. The repository holds 22 skills in this directory. The repository was last updated on October 3, 2026.

Source: XiaomiMiMo/MiMo-Code on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.