DOCX Formatter

将文本或 Markdown 内容排版为专业的中文 Word (.docx) 文档,支持 OMML 数学公式、表格框图、标准排版、引用上标和轻量完整性验证。当用户要求 Word 排版、把 Markdown 或纯文本转成 Word 文档、生成带公式的 Word 文档、用数学方程格式化文档、在 Word 中创建流程图样式图表、将参考文献引用渲染为上标、或格式化文档为 Word 时调用。

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add CP-here/docx-formatter-skill --skill docx-formatter
Manual install
git clone --depth 1 https://github.com/CP-here/docx-formatter-skill.git /tmp/docx-formatter-skill
mkdir -p ~/.claude/skills
cp -r /tmp/docx-formatter-skill/. ~/.claude/skills/docx-formatter

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# 中文 DOCX 排版工具

本工具用于将文本或 Markdown 内容排版为专业的中文 Word (.docx) 文档。最常见的用法是把 AI 生成的 Markdown 正文(报告、说明、方案、论文、讲义等)按学术与工程规范排版为 .docx,同时借助库函数补充 Markdown 无法表达的构件:数学公式、表格框图、引用上标、封面与目录。核心功能:

1. **Markdown 排版**(把 Markdown 或纯文本正文按中文文档规范排版为 .docx)
2. **标准排版**(黑体标题/宋体正文、标准页边距、行距)
3. **OMML 数学公式**(原生 Word 公式:行内公式和块级公式,直接生成 OMML XML,无中间库依赖)
4. **表格框图**(使用 Word 表格 + Unicode 箭头绘制流程图,不使用 emoji 或图片)
5. **引用上标**(正文中的 \[1] 等引用标记自动渲染为上标)
6. **轻量验证**(纯 stdlib 的 ZIP/XML 完整性检查,生成后默认执行)

本文档只收录编写调用脚本所必需的函数、规则与陷阱;排版数值、文件结构、各构件的完整示例与可选功能细节见仓库根目录 README.md 的「功能矩阵」「核心模块」「排版标准」「文件结构」「安装」「可选模块」各章。

## 如何开始

本工具为**函数库**,不含可执行入口:`docx_layout_kit.py` 无 `main()` 函数,直接运行不产生任何输出。Agent 生成文档的方式是**编写调用脚本**,导入库函数后按文档结构依次调用。

**Agent 生成文档前,先阅读 `scripts/_build_readme_docx.py`。** 该文件是本工具的标准骨架,从 `setup_document()` 到 `doc.save()` 的完整调用顺序(封面 → 目录 → 标题 → 正文 → 图表 → 参考文献 → 保存)均在其中示范;它同时用于生成项目根目录的 README.docx,因而始终与库保持同步。

**参考文件:**

| 文件 | 用途 |
| -- | -- |
| `scripts/_build_readme_docx.py` | 标准骨架范例:import 段示范应导入的函数,正文示范各函数的调用顺序,文件头附使用说明 |
| `SKILL.md`(本文档) | 各函数的完整参数说明、排版数值、规则与陷阱 |
| `scripts/docx_layout_kit.py` | 函数库本体与 `PRESETS` 预设值,用于确认实现细节 |

**标准流程:**

1. 阅读 `scripts/_build_readme_docx.py`,理解 import 段与正文的调用顺序
2. 复制 `scripts/docx_layout_kit.py` 到工作目录;文档含公式时,再复制 `scripts/omml_math_kit.py` 与 `scripts/formula_templates.py`

   - **不要复制** **`scripts/optional/`**(可选功能专用)
3. 新建调用脚本,按范例顺序写入实际内容
4. 运行脚本生成文档,经 `scripts/docx_validator.py` 验证后交付

**顺序规则**(范例文件头有同样提示):

1. `set_preset()` 须在 `setup_document()` 之前调用
Read the full skill on GitHub

Details

Skill name
docx-formatter
License
MIT
Repo updated
23 October 2026

FAQ

What does the DOCX Formatter skill do?

将文本或 Markdown 内容排版为专业的中文 Word (.docx) 文档,支持 OMML 数学公式、表格框图、标准排版、引用上标和轻量完整性验证。当用户要求 Word 排版、把 Markdown 或纯文本转成 Word 文档、生成带公式的 Word 文档、用数学方程格式化文档、在 Word 中创建流程图样式图表、将参考文献引用渲染为上标、或格式化文档为 Word 时调用。

How do I install the DOCX Formatter skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add CP-here/docx-formatter-skill --skill docx-formatter. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is DOCX Formatter popular?

It lives in CP-here/docx-formatter-skill, which has 5 GitHub stars and 0 forks.

Related skills

Figure Extractor

5

Sunrich-HT/figure-extractor

Extract complete, publication-quality figures and images from documents — local PDFs, PDF URLs, arXiv links, and HTML article pages. Use whenever the user wants to pull figures / charts / diagrams / images out of a paper or web article, says "extract the figures from this PDF / arXiv paper / webpage", needs clean figure PNGs for slides, decks, or reuse, or finds that naive embedded-image extraction returns broken fragments. This is a command-line tool (Python + PyMuPDF) that must be run in a shell; if your runtime has no shell, see the degraded-mode fallback. Keywords: extract figures from pdf

Documents & Office Files

Diorama Journey

5

nocoo/diorama-journey

Create narrated story videos through connected miniature 3D worlds, with one recurring character, object or signal carrying the story across chapters. Use for isometric diorama explainers, process journeys, project stories or narrated retrospectives that need 3D animation, chapter clips and matching presentation slides. Includes a Remotion and Three.js starter, voice generation, PPTX/PDF/ODP exports and production archives.

Documents & Office Files

Generating PPTX From Template

5

anikch/ppt-from-template-skill

Generates fully populated PowerPoint presentations that inherit the exact colors, fonts, layouts, and branding from a user-supplied .pptx template. Use when the user uploads or references a .pptx template file and asks to create or generate a presentation on a given topic. Triggers on: use my template, create slides from my pptx, generate a deck using my template, fill in my template, make a presentation from the attached file, build slides using my brand template, or when the user shares a .pptx file and wants a polished output matching their brand. Also use when multiple .pptx files are uplo

Documents & Office Files

Deck Kit

5

kiselas/every-slide-is-code

Presentation decks as code — pitch decks, product launches, idea pitches, board and quarterly reviews, tech talks. One self-contained HTML file with animated charts, diagrams, builds and cinematic transitions (camera moves, morph, zoom, iris, tear, dissolve), a presenter view, and static PDF/PPTX exports. Use whenever someone wants to present an idea, product, plan or result as slides, or asks for a deck, keynote, pitch or presentation that should look designed rather than templated.

Documents & Office Files

Kindlepub

5

jessl2juice/kindlepub

End-to-end Amazon KDP self-publishing pipeline for a finished book manuscript. Builds the reflowable Kindle EPUB (epubcheck-clean), generates cover art with Gemini Nano Banana and assembles the cover in KDP Cover Creator (which auto-sizes the spine — no custom print PDF), drafts all KDP metadata, and walks the user through the KDP Details/Content/Pricing/Publish flow for Kindle ebook, paperback, and hardcover. Use this whenever the user wants to publish, self-publish, or upload a book to Amazon, KDP, or Kindle Direct Publishing; make a Kindle ebook; set up a paperback or hardcover; build a boo

Documents & Office Files

Courseware Cn Annotator

5

youngman2007/courseware-cn-annotator

当用户说“做成学习包”(例如“把这份课件做成学习包”)时,使用本技能。把课件、讲义或课堂 PPT 的 PDF 一次性做成中文学习包:逐页中文翻译、面向零基础读者的三问式逐页注释(这页在说什么、为什么、怎么用)、可直接编辑的 Markdown 源稿、离线单文件 HTML 电子书(分组目录、全文搜索、注释与原图开关、深色主题、键盘翻页、深链)、A4 打印 PDF、使用说明,以及一到两篇学科速查附录。用户提供课件 PDF 并提到翻译、逐页讲解、注释版、电子书、可打印讲义、复习资料、速查表等任一需求时,也使用本技能,即使没有明确说“技能”。默认一次产出全套,用户明确只要其中某几项时才裁剪。

Documents & Office Files

Browse the most popular Claude skills, all documents & office files skills, or write your own with the skills generator.