Claude Code skill:Word 文档翻译流水线。Pandoc 负责格式,AI 负责内容,术语表负责一致性。
English | 中文
- Pandoc 2.0+
- Claude Code
复制下面这句话,在 Claude Code 中粘贴即可:
帮我把 https://github.com/ocean1798/doc-translate 克隆到 .claude/skills/doc-translate
git clone https://github.com/ocean1798/doc-translate.git ~/.claude/skills/doc-translateWindows 用户替换路径为 %USERPROFILE%\.claude\skills\doc-translate。
在 Claude Code 中直接触发:
文档翻译 <文件路径.docx>
或者用触发词:文档翻译、Word翻译、docx翻译、技术文档翻译、document translation
把一份中文 Word 技术文档变成格式完整、术语一致的英文 Word 文档。
.docx → [Pandoc] → .md → [AI 分块翻译] → .md → [Pandoc] → .docx
7 步流水线:
- Pandoc 转换 — Word 转 Markdown,同时提取图片
- 结构分析 — 统计章节、表格、图片数量,判断行业领域
- 术语表准备 — AI 生成动态术语草稿 → 询问你的静态术语表 → 合并确认。合并后的术语表全程锁定
- 分块方案 — 按 H2 章节切块,你确认后再开始翻译
- 逐块翻译 — AI 逐块执行,每块翻译后新术语追加到术语表,下一块可见
- 术语一致性检查 — grep 全文中英对照,确保一个中文术语只对应一个英文翻译
- Pandoc 导出 — Markdown 转回 Word,图片路径不变,表格结构不变
- 双层术语表:你的静态术语表是权威基线,AI 动态提取作补充。同名冲突以静态表为准。
- 按章节分块:在 H2 边界切分,不在任意行数切。每块继承前面所有块累积的术语表。
- 5 项自动验证:翻译后检查标题层级、表格行数、图片引用、全角符号残留、内容完整性。
- 禁止脚本:翻译由大模型直接读取 Markdown 执行,不用 Python/Shell 脚本代劳。
doc-translate/
├── SKILL.md # 技能主文件
├── references/
│ ├── anti-patterns.md # 10 类 AI 翻译退化模式 + 自检流程
│ ├── conventions.md # 技术文档翻译约定
│ └── pandoc-guide.md # Pandoc 命令参考 + 故障排除
└── glossaries/
└── _template.json # 术语表模板(无领域数据)
MIT
A Claude Code skill that translates Word documents (.docx) through a structured pipeline — Pandoc handles the format, AI handles the content, and a dual-layer glossary enforces terminology consistency.
AI install (recommended): Copy this into Claude Code:
Clone https://github.com/ocean1798/doc-translate into .claude/skills/doc-translate
Manual:
git clone https://github.com/ocean1798/doc-translate.git ~/.claude/skills/doc-translate.docx → [Pandoc] → .md → [AI chunked translation] → .md → [Pandoc] → .docx
7 steps: Pandoc conversion → structure analysis → glossary prep (AI draft + your static glossary, merged and locked) → chapter chunking → chunk-by-chunk AI translation with rolling glossary → terminology grep check → Pandoc export back to .docx.
- Dual-layer glossary: your static glossary is authoritative; AI dynamic extraction fills the gaps. Conflicts resolve to static.
- Chapter-aware chunking: splits at H2 boundaries. Each chunk sees all previous chunks' glossary.
- 5 auto-checks: heading hierarchy, table row count, image references, CJK punctuation, content completeness.
- No scripts: translation is LLM reading Markdown directly. No Python/Shell automation.
MIT