docx2md

docx2md is a skill for Claude Code, Codex from gonzalopezgil/docx2md-cli. It costs 87 tokens per session (874 once invoked), scanned A, original, MIT.

A converter that turns Word documents (.docx) into Markdown while retaining document structure. Markdown is plain-text formatting commonly used for technical documents and websites.

In plain words
What is it for?
Use it to convert Word files, extract embedded images, keep or remove frontmatter, skip cover material, pipe input and output, and produce conversion statistics.
Why use it?
It reduces the loss of tables, footnotes, lists, images, references, and document metadata during conversion.

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/gonzalopezgil/docx2md-cli/skill
Any agent
npx skills add gonzalopezgil/docx2md-cli --skill skill
Clone the repo
git clone --depth 1 https://github.com/gonzalopezgil/docx2md-cli

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for docx2md

README.md
[![agentmods](https://agentmods.dev/badge/skills/gonzalopezgil/docx2md-cli/skill.svg)](https://agentmods.dev/skills/gonzalopezgil/docx2md-cli/skill)
Your own site
<a href="https://agentmods.dev/skills/gonzalopezgil/docx2md-cli/skill"><img src="https://agentmods.dev/badge/skills/gonzalopezgil/docx2md-cli/skill.svg" alt="Measured on agentmods" height="20"></a>
Per session 87 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 874 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.00087 $0.00874
Opus 5 $0.00044 $0.00437
Sonnet 5 $0.00017 $0.00175
Haiku 4.5 $0.00009 $0.00087

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

Security

Grade A, and why

docx2md 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.

skill/SKILL.md · 98 lines

How it starts

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

docx2md-cli

High-fidelity Word (.docx) to Markdown converter. Built for documents where structure matters — normative texts, policies, technical specs, government docs.

Install

pip install docx2md-cli

For custom YAML frontmatter loading:

pip install "docx2md-cli[frontmatter]"

CLI Usage

# Basic conversion
docx2md input.docx

# Full-featured
docx2md input.docx -o output.md --extract-images images/ --skip-before-heading

# Agent-friendly (machine-readable)
docx2md input.docx --json-stats -q -o output.md

# Stdin/stdout piping
cat input.docx | docx2md - -o -

Flags

Flag Description
-o PATH Output path. Use - for stdout.
--extract-images DIR Extract embedded images and link them in Markdown.
--skip-before-heading Skip content before the first Word heading (cover pages, TOC).
--frontmatter FILE Prepend custom YAML frontmatter from a file.
--no-frontmatter Disable all frontmatter (auto and custom).
-q, --quiet Suppress stats output.
--json-stats Emit stats as JSON to stderr.

Python API

from docx2md_cli import convert

result = convert(
    "input.docx",            # str path, bytes, or BinaryIO
    output_path="output.md", # optional
    images_dir="images",     # optional
    skip_before_heading=True,
    no_frontmatter=False,
    print_stats=False,
)

# result is list-like (backward compatible) with extras
lines = result.lines          # list of Markdown lines
stats = result.stats          # dict with counts
json_str = result.as_json()   # JSON string of stats

Stats dict keys

lines, bytes, headings, table_rows, figures, bold, footnotes, refs, tables_inserted, tables_total, underlined, ordered_list_items, nested_items

What It Preserves (that others don't)

  • Field-code references: [N] citation refs from Word's field code state machine
  • Bibliography SDT: Extracts bibliography content controls as [^rN] definitions
  • Vertical merge (vMerge): Grouped table rendering for merged cells
  • Split table detection: Merges 1-row header + data table pairs
  • Inline footnotes: At their original Word position, not end-of-document
  • Numbered vs bullet lists: Reads numbering.xml directly, preserves nesting
  • Image extraction: Embedded images with caption-derived filenames
  • Multi-language captions: ES, EN, FR, DE, PT, IT

Read the full file on GitHub · 98 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 · 98 lines · 87 tokens per session scan A ad8aade58e98

Subscribe to this mod's changes

docx2md is a skill published in the GitHub repository gonzalopezgil/docx2md-cli (5 stars, last pushed 5mo ago), licensed MIT. It adds 87 tokens to every session and 874 once invoked, about $0.0004 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-31.

Related

Other skills, from other repositories

all2md

Convert, read, generate, search, and compare documents with the all2md CLI and Python library. Use whenever a task involves reading or extracting text/tables from a document (PDF, Word, PowerPoint, Excel, HTML, email, EPUB, Jupyter, images, or 100+ source-code and text file types); converting between formats…

thomas-villani/all2md · 181 tokens

docx-template-translator

Adaptive conversion of LaTeX, PDF, or Markdown sources into a complete Word .docx that follows a user-supplied .docx template. Use when pandoc --reference-doc alone is not enough — for thesis, dissertation, report, or institutional Word formatting that needs cover pages, declarations, TOC, heading numbering, captions…

zouchenzhen/docx-template-translator-skill · 87 tokens

pdf-to-editable-word

Convert PDF to Word or PDF to DOCX while preserving the original page layout and keeping text editable, searchable, and selectable. Use for PDF-to-Word conversion, editable DOCX creation, fixed-layout documents, table-heavy PDFs, vertical text, resumable long-document conversion, or output validation. Works as a…

longligooo/pdf-to-editable-word-skill · 102 tokens

doc-converter

Universal document format converter - DOCX, PDF, Markdown, HTML, TXT.

chainlesschain/chainlesschain · 19 tokens

pdf-to-editable-word

Convert PDF to Word or PDF to DOCX while preserving the original page layout and keeping text editable, searchable, and selectable. Use for PDF-to-Word conversion, editable DOCX creation, fixed-layout documents, table-heavy PDFs, vertical text, resumable long-document conversion, or output validation. Works as a…

longligooo/pdf-to-editable-word-skill · 102 tokens

kordoc

Use this skill whenever the user wants to read, create, fill, edit, compare, validate, or preview Korean Hangul/official documents — .hwp (HWP 3.x/5.x), .hwpx, .hml (HWPML) — or convert Korean-office PDF/DOCX/XLS/XLSX to Markdown. Triggers include any mention of 'hwp', 'hwpx', 'hml', '한글 문서', '아래한글', '한컴', '공문서'…

chrisryugj/kordoc · 253 tokens