docx

A tool for reading, creating, and editing Microsoft Word .docx files, including their text, tables, images, headings, page numbers, and tracked changes.

In plain words
What is it for?
Use it to extract or summarise documents, create reports and letters, edit content, find and replace text, and add tracked changes or comments.
Why use it?
It handles common Word-document work without requiring manual XML editing, while supporting lower-level editing when exact document changes are needed.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/hkuds/deeptutor/docx
Any agent
npx skills add HKUDS/DeepTutor --skill docx
Clone the repo
git clone --depth 1 https://github.com/HKUDS/DeepTutor

Made for: Claude Code, Codex.

Per session 91 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,699 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00091 $0.02699
Opus 5 $0.00046 $0.01350
Sonnet 5 $0.00018 $0.00540
Haiku 4.5 $0.00009 $0.00270

Measured 3d ago against content hash 0e71d9f8658f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

docx scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

deeptutor/skills/builtin/docx/SKILL.md · 207 lines

How it starts

The opening of the file, as written. The whole thing — 207 lines — stays where its author put it; the contents beside it link to each section on GitHub.

DOCX (Microsoft Word)

A .docx is a ZIP of XML parts. Body text lives in word/document.xml. Two tiers:

  • Default — python-docx (preinstalled): create, read, and simple edits. Use for almost everything.
  • Advanced — raw OOXML via zipfile: only for what python-docx cannot express — tracked changes (redlines), comments, and exact-fidelity edits that must preserve every untouched byte. See Raw OOXML.

Work in the current directory (uploaded files land here). Write output to a new filename; don't overwrite the source. Run Python through code_execution, save output in the current directory, and refer to the document exactly as the Generated artifacts list names it. Use exec only for a genuinely shell-only command; never put this source in python -c or a heredoc.

Read / extract

from docx import Document

doc = Document("in.docx")
text = "\n".join(p.text for p in doc.paragraphs)  # body paragraphs
for tbl in doc.tables:  # tables
    for row in tbl.rows:
        print([c.text for c in row.cells])

doc.paragraphs skips text inside tables, headers/footers, and text boxes — iterate doc.tables and doc.sections[i].header/.footer for those. Each paragraph's style: p.style.name (e.g. "Heading 1").

To read tracked changes, parse the XML directly — python-docx ignores <w:ins>/<w:del>:

import zipfile, re

xml = zipfile.ZipFile("in.docx").read("word/document.xml").decode("utf-8")
# inserted text = <w:ins>…<w:t>…  deleted = <w:del>…<w:delText>…
print(re.findall(r"<w:t[^>]*>(.*?)</w:t>", xml))

Create

from docx import Document
from docx.shared import Pt, Inches, RGBColor
from docx.enum.text import WD_ALIGN_PARAGRAPH

doc = Document()  # default template page size
doc.add_heading("Quarterly Report", level=0)  # 0 = title; 1..9 = H1..H9
p = doc.add_paragraph("Intro paragraph. ")
run = p.add_run("Bold tail.")
run.bold = True
doc.add_paragraph("First item", style="List Bullet")  # real list style, never a "• " literal
doc.add_paragraph("Step one", style="List Number")

# Table — header row + data
tbl = doc.add_table(rows=1, cols=2)
tbl.style = "Light Grid Accent 1"
tbl.rows[0].cells[0].text, tbl.rows[0].cells[1].text = "Metric", "Value"
for k, v in [("Revenue", "1.2M"), ("Growth", "15%")]:
    c = tbl.add_row().cells
    c[0].text, c[1].text = k, v

doc.add_picture("chart.png", width=Inches(5))  # image, scaled to width
doc.add_page_break()
doc.save("out.docx")

Read the full file on GitHub · 207 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 207 lines · 91 tokens per session scan A 0e71d9f8658f

Subscribe to this mod's changes

docx is a skill published in the GitHub repository HKUDS/DeepTutor (38,271 stars, last pushed yesterday), licensed Apache-2.0. It adds 91 tokens to every session and 2,699 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

ppt-master

AI-driven presentation workflow for generating editable PPTX decks and slides, reconstructing page visuals, creating reusable Brand/Style/Layout/Deck workspaces, filling native PPTX templates, and enhancing finished PPTX files. Use when the user asks to create, generate, reconstruct, regenerate, beautify, redesign…

hugohe3/ppt-master · 108 tokens

doc-reader

Read any common document/data file — PDF, Word (.docx), Excel (.xlsx/.xls), PowerPoint (.pptx), images (OCR), CSV/TSV, plain text, JSON/YAML/TOML, HTML/XML, and most source-code files. Use the readdocument tool.

HKUDS/Vibe-Trading · 65 tokens

bento-slides

Create and edit Bento presentations — single-file .bento.html decks whose document is plain JSON in a "#bento-doc" script block. Use whenever the user wants a slide deck or presentation: starting from NOTHING (it downloads the latest Bento app from bento.page automatically), from source material, or by improving an…

nyblnet/bento · 125 tokens

officecli-pitch-deck

Use this skill when the user is building a fundraising / investor pitch deck — seed, Series A / B / C, convertible note, SAFE round, strategic raise. Trigger on: 'pitch deck', 'investor deck', 'Series A deck', 'Series B deck', 'Series C deck', 'fundraising deck', 'seed pitch', 'VC deck', 'raising capital', 'term sheet…

iOfficeAI/OfficeCLI · 163 tokens

morph-ppt

Use this skill when the user wants a .pptx with smooth cross-slide animation — PowerPoint Morph transitions, Keynote-style continuous motion, shapes that grow / move / rotate as the slide advances. Trigger on: 'morph', 'morph transition', 'smooth transition', 'continuous animation across slides', 'Keynote-style…

iOfficeAI/OfficeCLI · 169 tokens

officecli-academic-paper

Use this skill to build academic-style .docx output: journal / conference / thesis chapters carrying formal citation style (APA, Chicago, IEEE, MLA), numbered equations, figure & table cross-references, footnotes/endnotes, bibliography, or multi-column journal layout. Trigger on: 'research paper', 'journal paper'…

iOfficeAI/OfficeCLI · 141 tokens