md2word: Skill for Claude Code

.claude/skills/md2word/SKILL.md

md2word is a skill for Claude Code, Codex from cp-yu/md2word. It costs 115 tokens per session (2,233 once invoked), scanned A, original, MIT.

A document-conversion skill that turns Markdown into Word-compatible MHT and DOCX files, including documents with images, tables, diagrams, and mathematical formulas.

In plain words
What is it for?
Use it for technical reports, academic papers, patent disclosures, and other Markdown-to-Word export tasks.
Why use it?
It helps preserve document structure and formatting when technical Markdown must be delivered as an editable Word file.

Skill for Claude CodeCodex

Written for Claude Code and Codex: installed under .claude/, but also agents/openai.yaml present.

This is cp-yu/md2word's own configuration. It tells Claude Code and Codex how to work on md2word itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything md2word configures →

Part of the md2word plugin — 1 skill shipped together

Reuse

Borrowing it

Nothing to install: this file belongs to cp-yu/md2word. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/cp-yu/md2word/main/.claude/skills/md2word/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/cp-yu/md2word

Made for: Claude Code, Codex.

Or install md2word, the plugin that ships this one along with the rest of its 1 skill.

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 md2word

README.md
[![agentmods](https://agentmods.dev/badge/skills/cp-yu/md2word/md2word.svg)](https://agentmods.dev/skills/cp-yu/md2word/md2word)
Your own site
<a href="https://agentmods.dev/skills/cp-yu/md2word/md2word"><img src="https://agentmods.dev/badge/skills/cp-yu/md2word/md2word.svg" alt="Measured on agentmods" height="20"></a>
Per session 115 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,233 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00115 $0.02233
Opus 5 $0.00057 $0.01117
Sonnet 5 $0.00023 $0.00447
Haiku 4.5 $0.00012 $0.00223

Measured 6d ago against content hash 1f35ddbe03ec, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

md2word 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 6d ago.

The scan reads SKILL.md. This mod also ships 10 executable files (scripts/generate_template_mht.py, scripts/md2word.cmd, scripts/md2word.ps1, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

.claude/skills/md2word/SKILL.md · 187 lines

How it starts

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

md2word

目标:

Markdown -> MHT -> DOCX -> WordMath DOCX

这个 skill 默认面向 Windows 直接运行。内置模板只是 fallback,不要把它理解成“只能导出专利交底书”。

入口判断

  • 用户已经给了 .mht 模板
  • 用户已经给了 .docx 模板,希望复用现有 Word 样式
  • 用户没有模板文件,只有一段“模板长什么样”的文字描述
  • 用户要求论文格式、标题字号、行距、封面结构等版式约束
  • Markdown 里有 $...$$$...$$、Mermaid 代码块,且最终必须落到 Word

环境要求

  • 在 Windows 中运行
  • PowerShell 可用
  • Windows 桌面版 Microsoft Word 已安装,且 COM 可用
  • Python 3 可通过 py -3pythonpython3 调起
  • 代码块语法高亮默认依赖 Python pygments;未安装时自动回退为可编辑纯文本代码块
  • 如果 Markdown 含 Mermaid:
    • 优先复用本机已有 mmdc
    • 否则允许 npx -p @mermaid-js/mermaid-cli mmdc
    • 首次 npx 兜底可能需要联网下载

输入约定

  • 行内公式保持 $...$
  • 行间公式保持 $$...$$
  • 本地图片使用标准 Markdown 语法:![说明](relative/path.png)
  • 标准 Markdown 表格会被渲染成 Word 表格
  • Markdown 头字段支持两种写法:
    • **标题:** 示例文档
    • 标题: 示例文档
  • 如果字段区后紧跟空行或 # 标题,正文也会被正确识别,不要求一定写 ---
  • 标题优先从 标题 / 题目 / 主题 取值;没有时再回退到 发明名称 / 项目名称
  • 正文 Markdown 标题会映射为 Word 正文标题层级,可在导航窗格中看到
  • 默认只有正文章节标题进入导航;封面或文档主标题不进入导航
  • 已显式写出的标题编号会保留;只有无编号标题才会做最小自动补号

工作流

  1. 按模板来源三选一分流:
    • .mht:直接使用
    • .docx:先归一化导出为 .mht
    • 模板规格/文字描述:先生成可复用 .mht
  2. render_mht.py 把 Markdown 填进模板。
  3. 调 Windows Word 打开 MHT,另存成 .docx
  4. 在 Word 内把 LaTeX 文本转换成 Office Math,输出 .wordmath.docx

模板与样式

  • 如果用户给模板文件,优先复用模板,不要重造
  • 如果用户只给一句模板描述,先写成 template-spec.md 再传给 --template-spec
  • 模板规格参考:resources/template-spec.md
  • 当前内置样式预设:
    • default
    • academic-paper
  • 静态模板、模板规格和样式预设统一放在 resources/
  • 用户明确给出论文标题字号、标题层级、正文行距时,优先:
    • 在模板规格里写 style-preset: academic-paper
    • 调用时再显式传 --style-preset academic-paper

正文插入策略

  • 如果模板里有 {{CONTENT}}<!--MD_CONTENT-->,优先按占位符替换
  • 如果模板里有 {{METADATA_TABLE}},会把 Markdown 头字段渲染成信息表
  • 如果模板里已有表格标签,例如 项目名称电话版本,会按行标签尝试填值
  • 如果没有显式占位符,会推断 WordSection,优先替换最后一个正文 section
  • 推断过程可通过 --template-report 输出报告

命令

使用内置默认模板:

<skill-dir>\scripts\md2word.cmd `
  --input disclosure.md

使用模板规格生成模板:

<skill-dir>\scripts\md2word.cmd `
  --input example.md `
  --template-spec template-spec.md `
  --template-out generated-template.mht `
  --template-report template-report.md

Read the full file on GitHub · 187 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. 6d ago First seen · 187 lines · 115 tokens per session scan A 1f35ddbe03ec

Subscribe to this mod's changes

md2word is a skill published in the GitHub repository cp-yu/md2word (14 stars, last pushed 2mo ago), licensed MIT. It adds 115 tokens to every session and 2,233 once invoked, about $0.0006 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-09-01.