by KaguraNanaga
公文格式处理Skill: Professional Word document formatting toolkit for Chinese official documents
Unlocks once the catalog security scan passes (runs nightly).
The deep catalog scan for this skill is still queued. Run an instant dependency check now instead.
# Add to your Claude Code skills
git clone https://github.com/KaguraNanaga/document-format-skillsGuides for using documentation skills like document-format-skills.
Use these scripts to clean and format Chinese Word documents from the command line. Prefer scripts/process.py for normal work because it mirrors the desktop app's core pipeline without the GUI.
Run one smart pass when the user wants the document cleaned end to end:
uv run --with python-docx python scripts/process.py smart input.docx output.docx --preset official
Run diagnostics only:
uv run --with python-docx python scripts/process.py analyze input.docx
uv run --with python-docx python scripts/process.py analyze input.docx --json
Run only punctuation/spacing cleanup:
uv run --with python-docx python scripts/process.py punctuation input.docx output.docx --space-mode keep_en_boundary
Run only formatting:
uv run --with python-docx python scripts/process.py format input.docx output.docx --preset official
On Windows, .doc and .wps input/output are supported through WPS or Microsoft Word COM automation:
uv run --with python-docx --with pywin32 python scripts/process.py smart input.wps output.wps
| Script | Use |
|---|---|
scripts/process.py |
One-shot CLI for smart, analyze, punctuation, and format; handles .doc/.wps conversion on Windows. |
scripts/formatter.py |
Apply formatting presets, custom JSON settings, page numbers, table cleanup, revision marks, macOS font fallback. |
scripts/punctuation.py |
Fix punctuation while preserving run formatting; supports spacing strategies. |
scripts/from_text.py |
Create a DOCX from .txt or Markdown, then optionally run smart formatting. |
scripts/analyzer.py |
Lower-level diagnostic script. |
scripts/converter.py |
Windows-only .doc/.wps conversion helpers. |
Built-in presets:
official: GB/T 9704-2012 style official document formatting.academic: academic paper formatting.legal: legal document formatting.custom: read the active desktop custom preset when available.Useful flags:
--custom-settings path.json
--revision
--deep-clean
--smart-table-align
--no-page-number
--page-number-style dash|plain|page_text|page_total
--page-number-position outside|left|center|right
--page-number-offset-mm 7
--no-bold-serial
--custom-settings accepts desktop schema v2 config files, exported preset files shaped as {"preset": {...}}, or plain preset/override JSON. For non-custom presets, the JSON is merged over the selected preset.
Punctuation cleanup protects URLs, email addresses, Windows paths, time values like 9:30, and standards like ISO 9001:2015. It fixes brackets, colons, semicolons, question/exclamation marks, Chinese comma/period contexts, ellipses, dashes, and paired quotes.
Spacing modes:
remove_all: delete half-width and full-width spaces.keep_en_boundary: remove Chinese-to-Chinese spaces but keep exactly one space between Chinese and English/digits.keep_all: leave spaces unchanged.Generate and format a document from text:
uv run --with python-docx python scripts/from_text.py input.md output.docx --title "工作方案"
Markdown mode detects headings, bold spans, ordered/unordered lists, quotes, and fenced code blocks. # becomes the main title, ## becomes 一、, ### becomes (一), and deeper headings become numbered lower-level headings.
Use --no-process to only create the raw DOCX.
.docx processing needs only python-docx..doc/.wps conversion needs Windows plus WPS Office or Microsoft Word and pywin32.--smart-table-align for numeric/right and short-text/center alignment.看不懂英文也没关系,请点击上面的链接查看中文版说明。
💡 想要无需联网、一键运行修复格式的桌面应用版本?
现已推出 Document Format GUI 公文格式助手 —— 无需联网、一键修复公文格式的桌面应用,小白也能轻松上手!
🌐 不想安装,也不需要 Agent?
直接打开 公文格式处理工具网页版,选择
.docx文档即可开始处理。无需登录,文档只在当前浏览器中处理,不会上传到服务器。
A Word document formatting toolkit for Chinese official documents for the government, CCP (China Communist Party), and the state-owned enterprises. Diagnose formatting issues, fix punctuation, and apply standardized styles with one command. Available for Claude Code, Codex, and OpenCode.
公文格式助手是一个面向中文公文排版的 Skill 工具包,用于诊断 Word 文档格式问题、修复中英文标点和空格混用、统一公文/论文/法律文书格式、处理页码和表格,并支持从纯文本或 Markdown 生成规范 DOCX。
.doc / .wps conversion on Windows when WPS Office or Microsoft Word is installed.python-docxpywin32 only for .doc/.wps conversion on WindowsUse uv for ad-hoc runs:
uv run --with python-docx python scripts/process.py --help
For Windows .doc/.wps conversion:
uv run --with python-docx --with pywin32 python scripts/process.py --help
Smart cleanup:
uv run --with python-docx python scripts/process.py smart input.docx output.docx --preset official
Analyze only:
uv run --with python-docx python scripts/process.py analyze input.docx
uv run --with python-docx python scripts/process.py analyze input.docx --json
Punctuation and spacing only:
uv run --with python-docx python scripts/process.py punctuation input.docx output.docx --space-mode keep_en_boundary
Formatting only:
uv run --with python-docx python scripts/process.py format input.docx output.docx --preset official
Create a formatted DOCX from Markdown or text:
uv run --with python-docx python scripts/from_text.py input.md output.docx --title "Work Plan"
--preset official|academic|legal|custom
--custom-settings path.json
--revision
--deep-clean
--smart-table-align
--no-page-number
--page-number-style dash|plain|page_text|page_total
--page-number-position outside|left|center|right
--space-mode remove_all|keep_en_boundary|keep_all
--custom-settings accepts desktop schema v2 config files, exported preset files like {"preset": {...}}, or plain preset/override JSON.
| Script | Purpose |
|---|---|
scripts/process.py |
Main CLI pipeline: smart, analyze, punctuation, format. |
scripts/formatter.py |
Formatting engine and preset handling. |
scripts/punctuation.py |
Punctuation and spacing fixer. |
scripts/from_text.py |
Text/Markdown to DOCX generator. |
scripts/analyzer.py |
Diagnostic helpers. |
scripts/converter.py |
Windows .doc/.wps conversion helpers. |
.docx is the most reliable format..doc/.wps requires Windows plus WPS Office or Microsoft Word.MIT
document-format-skills is an open-source documentation skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by KaguraNanaga. 公文格式处理Skill: Professional Word document formatting toolkit for Chinese official documents. It has 242 GitHub stars.
document-format-skills's catalog security scan is still queued. You can run an instant dependency and prompt-injection check now with the "Scan for vulnerabilities" button above.
Clone the repository with "git clone https://github.com/KaguraNanaga/document-format-skills" and add it to your Claude Code skills directory (see the Installation section above). document-format-skills ships a SKILL.md manifest, so compatible agents can discover and load it automatically.
document-format-skills is primarily written in Python. It is open-source under KaguraNanaga on GitHub, so you can review or fork the full source.
Yes. AgentsLLM lists many other Documentation skills you can browse and compare side by side. Open the Documentation category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh document-format-skills against similar tools.
No comments yet. Be the first to share your thoughts!
Top skills in this category by stars