Professional Word document formatting toolkit for Chinese documents
SaferSkills independently audited document-format-skills (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
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 officialRun 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 --jsonRun only punctuation/spacing cleanup:
uv run --with python-docx python scripts/process.py punctuation input.docx output.docx --space-mode keep_en_boundaryRun only formatting:
uv run --with python-docx python scripts/process.py format input.docx output.docx --preset officialOn 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.~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.