Home / All Skills / Docs & Knowledge / docx-creator
Docs & Knowledge · daymade/claude-code-skills

docx-creator

Produce Word (.docx) and export existing Word/WPS manuscripts to PDF (Word 转 PDF / 试读版 / 排版修复), preserving revisions, tables and images. Especially for Chinese documents, drive minimax-skills:minimax-docx OpenXML correctly. Use whenever the deliverable is a .docx file: 生成 Word 文档 / 做一份 docx / 写合同 docx / 起草协议 / 正式文书 / 公文 / offer / 劳动合同 / 把 markdown 转成 Word / Word 排版 / 中文排版 / 签字栏 / 盖章版 / 甲方乙方, or any plain "give me a Word file" request. This skill adds the layer minimax-docx does not ship: a verified markdown-to-docx OpenXML generator, alignment rules for info and signature blocks, list numbering, CJK font dual-slot setup, and a mandatory LibreOffice-to-PDF-to-PNG visual verification chain (qlmanage thumbnails are banned — they hide exactly the bugs that matter). Engine belongs to minimax-docx; correct usage and field-tested workarounds belong here. For Markdown → PDF use daymade-docs:pdf-creator.

L4 High-Privilege · Graded auth & full auditV1 Commit-PinnedExecute CommandNetwork AccessWrite FileDual-pass Audit
Author daymadeGitHub daymade/claude-code-skills ↗Stars 1385License MIT(仓库根 LICENSE;Copyright (c) 2025 daymade;GitHub API spdx MIT)Commit d5c4678cb5
Control levels describe skill capabilities and suggested control measures; they do not represent quality or safety certifications, nor do they dictate usability. Usage decisions rest entirely with users and administrators. Different agent hosts apply varying constraints; do not assume hosts provide automatic protection. Third-party skill copyrights belong to their original authors. Use at your own risk.

1How It Works & Mechanism

Layered design: The engine is entirely outsourced to minimax-skills:minimax-docx (a third-party marketplace plugin); this skill contains zero engine code, providing only "battle-tested usage knowledge + a self-developed generator".

daymade-docs/docx-creator/SKILL.md
Thin incremental layer over **`minimax-skills:minimax-docx`**. Not a document engine.
SKILL.md directly instructs reading the engine source from the host marketplace installation path (~/.claude/plugins/marketplaces/minimax-skills/skills/minimax-docx/); this repository does not include the engine, and its CLI behavior cannot be audited inside this pinned source.

Chinese formal document generation is implemented via an included C# generator: Program.cs (~260 lines of OpenXML + Markdig) parses Markdown into an AST and assembles docx according to ECMA-376.

daymade-docs/docx-creator/scripts/Program.cs
var mdText = File.ReadAllText(args[0]); var pipeline = new MarkdownPipelineBuilder().UsePipeTables().Build(); var docAst = Markdown.Parse(mdText, pipeline);
Usage: `dotnet run -- <in.md> <out.docx>`; csproj declares DocumentFormat.OpenXml 3.2.0 + Markdig 1.3.2 (net10.0), requiring NuGet restore on the first run.

Machine-verifiable alignment rules: Paragraphs containing LineBreakInline (Party A/Party B info blocks, signature blocks) are forced to left-align, while standard body text is justified—determined via the inline tree rather than human visual inspection.

daymade-docs/docx-creator/SKILL.md
The rule is machine-checkable, so do not eyeball it: if the markdown paragraph's inline tree contains a `LineBreakInline`, left-align that paragraph; otherwise justify it.
ISSUE-004 background: Justified alignment stretches every line of multi-line info blocks (except the last) with massive inter-character spacing—the most common insidious layout bug in Chinese official documents.

List numbering correctness relies on OpenXML semantics: Each independent list receives its own NumId + LevelOverride(StartOverrideNumberingValue=1); reusing the same NumId causes clause 3's list to continue numbering from 4.

daymade-docs/docx-creator/SKILL.md
Each independent markdown list must get its **own** `NumId` plus a `LevelOverride` carrying `StartOverrideNumberingValue = 1`. Reuse one `NumId` across clauses and clause 3's list silently continues from 4.
ISSUE-005/006 are SDK pitfalls (incorrect class names, wrong element ordering); ISSUE-016 adds established Word semantics where numId=0 disables numbering.

CJK fonts must use dual slots (Ascii/HighAnsi/EastAsia in RunFonts), Chinese bold text switches to SimHei/HeiTi (SimSun lacks true bold; synthetic bold blurs characters); font sizes use OpenXML half-points.

daymade-docs/docx-creator/SKILL.md
A run must set `RunFonts { Ascii, HighAnsi, EastAsia }`. Setting only the Latin slots leaves Chinese characters to Word's fallback
Program.cs comments state similarly: 'Chinese bold switches to HeiTi: SimSun has no true bold weight, renderers can only synthesize it via algorithm'—encoding Word typesetting mechanisms into code.

Mandatory visual verification chain: Generation → XSD validation (minimax CLI) → LibreOffice headless conversion to PDF → pdftoppm to PNG → page-by-page Read; qlmanage thumbnails are explicitly prohibited (ISSUE-008).

daymade-docs/docx-creator/SKILL.md
**Banned: `qlmanage` thumbnails as visual proof.** macOS Quick Look renders with a different engine than Word and will happily show a clean-looking page for a document whose info blocks are stretched apart.
The verification protocol lists every failure mode (info blocks not stretched / lists restarting from 1 / table borders / complete signature blocks / no orphaned page breaks), and requires opening genuine Word to check 'Compatibility Mode' if Word is installed (ISSUE-012: LibreOffice shows all clear while genuine Word breaks layout).

Document routing table directs Word/WPS manuscripts → PDF and Markdown → PDF to word-to-pdf.md and pdf-creator respectively, explicitly prohibiting round-tripping authoritative Word manuscripts through Markdown.

daymade-docs/docx-creator/SKILL.md
| Existing Word/WPS → repaired layout / selected excerpt → PDF | Keep the Word source; follow `references/word-to-pdf.md` and `references/verification_protocol.md` |
The description opening also declares routing for Word manuscripts; the routing table in SKILL.md is more granular (including trade-offs for minimax CLI create / Pipelines B and C).

2Core Capabilities

01markdown → Chinese contract-grade docx generation (self-developed OpenXML generator handling Party A/B info blocks, signature blocks, clauses, and tables)
02Independent lists automatically restart=1 while preserving sequential numbering where intended (NumId/LevelOverride semantics)
03Chinese typesetting rules including CJK dual-slot fonts, bold switching to HeiTi, and first-line indentation (420 twips @ 10.5pt)
04A4 page setup + PAGE field numbering in footers + 6-border tables + tblGrid (strict ECMA-376 element ordering)
05XSD schema validation via minimax-docx CLI (DOTNET_ROLL_FORWARD=Major, ISSUE-003)
06End-to-end LibreOffice → PDF → PNG visual verification (including failure mode checklist and review in genuine Word)
07Existing Word/WPS manuscript → PDF layout fixing / excerpt delivery workflow (word-to-pdf.md, preserving Word sources without Markdown round-trips)

3External Dependencies

KindDependency / Endpoint
clidotnet SDK / dotnet run
packageDocumentFormat.OpenXml 3.2.0 + Markdig 1.3.2(NuGet)
climinimax-docx 引擎 CLI(第三方市场插件 minimax-skills,XSD 校验)
cliLibreOffice soffice --headless(验证转 PDF)
clipoppler pdftoppm(PDF→PNG)
cliMicrosoft Word.app(可选,macOS 兼容模式复核)

4Recommended Governance & Evidence

Suggested Controls for Safe Operation
For Agent Runtime
Graded/per-use authorization, sandbox recommended
For Administrators
Approval workflow, rollback support, full audit
Evidence & Triggers (File Paths & Excerpts)
  • scripts/: Executes local script or command: dotnet run (locally compiles and executes bundled Program.cs)
  • 网络端点: Declares external network access: Initial dotnet run restores DocumentFormat.OpenXml/Markdig via NuGet (SKILL/README explicitly state ~20s)
  • 本地工作目录: File read/write and artifact output: Generates/overwrites user-specified out.docx (SKILL warns to check ~$ lock files first); copies generator to adjacent _docxgen/; writes verification artifacts to /tmp/docx
Audit Notes: No credential reading, no external data exfiltration; predominantly a local toolchain. Flagged as Yellow because: 1) The workflow strictly depends on a third-party marketplace plugin (minimax-skills), whose CLI behavior cannot be audited within this pinned source (supply-chain surface); 2) First-time dotnet run requires network access for NuGet package restoration; 3) Overwrites/generates deliverable files. All behaviors fall within expected operational bounds without arbitrary deletion or destructive wiping.

5Second-Pass Verification

  • [ok] 零引擎代码、能力在 minimax-docx — SKILL.md 自述 'This skill contains zero engine code';本仓 grep minimax-docx 仅命中路径引用,引擎目录不在仓库内——外置关系属实。
  • [unlocatable] minimax-docx validate CLI 行为 — CLI 位于宿主 ~/.claude/plugins/marketplaces/minimax-skills/…,不在本 pin 源码内,其 XSD 校验具体行为无法在此核验;SKILL 自身亦承认依赖其安装。
  • [ok] 自研生成器 Program.cs — File.ReadAllText+Markdown.Parse+OpenXML 组装流程与 csproj 依赖(OpenXml 3.2.0/Markdig 1.3.2/net10.0)属实;对齐/NumId/字体双槽注释在源码中可定位。
  • [ok] qlmanage 禁令与 ISSUE-008 叙事 — SKILL.md Banned 段与 known_issues.md ISSUE-008 记录一致;verification_protocol.md 亦重申。
  • [ok] ISSUE-012 真 Word 兼容模式案例 — known_issues.md 含根因(元素顺序/缺 tblGrid 等)与 'LibreOffice 全绿、真 Word 兼容模式' 的复现记录;verification_protocol Step 3a 强制 Word 复核。
  • [ok] NuGet 首次还原需网络 — SKILL.md quick start 注明 '(first run restores DocumentFormat.OpenXml + Markdig, ~20s)';scripts/README 依赖表 'NuGet reachable' 行一致。
  • [ok] 无凭证/无外发代码 — Program.cs/README/引用文件 token 扫描:无 env 密钥、无 requests/urllib、无 curl;网络仅 NuGet 还原。
  • [ok] 元数据 — GitHub API:MIT / 1385 stars / pushed 2026-09-09T12:33:29Z;本地 HEAD==pin d5c4678。

6Verdict & Scenarios

  • Systematically codifies Word mechanisms for Chinese formal documents (info block alignment, bold SimSun switching to HeiTi, dual-slot fonts, NumId restarts) and links each to concrete ISSUE records.
  • Verification chain is designed around progressive renderer fidelity: qlmanage → LibreOffice → genuine Word; ISSUE-012 proves low-fidelity verification misses critical defects.
  • ECMA-376 element ordering discipline is built directly into construction points, fundamentally preventing elusive defects like Word 'Compatibility Mode'.
  • Honest separation of responsibilities: Avoids reinventing the engine, treats minimax-docx as an SDK, and focuses solely on missing generator logic and field-tested operational knowledge.
  • Best for: Suitable for teams and individuals requiring production-grade Chinese contracts, official documents, or offer docx files (Party A/B blocks, clause numbering, signature blocks, stamped versions); requires host environment with minimax-docx, .NET SDK, and LibreOffice/poppler installed, along with willingness to execute the genuine page-by-page visual Read verification chain.
    Not for: Not suitable for offline environments or systems lacking the .NET SDK; not suitable when only plain-text Word is needed (use minimax CLI create instead); not suitable for Markdown → PDF (use pdf-creator); not suitable for converting authoritative Word manuscripts into Markdown and regenerating (round-tripping is explicitly forbidden by SKILL).
    Install Agent-Ready
    ① Verified Mirror 2026-09-09
    Option A · Direct DownloadDownload docx-creator.tar.gz
    sha256: 31fc8fead4571a90…
    Option B · Copy Guide for Agent
    install.json
    Agents automatically download and verify mirrors from this JSON guide.
    ② Upstream GitHub
    GitHub Repo ↗
    Pinned to commit d5c4678cb5.