document-format-normalizer

Document format normalizer: standardizes Word document body formatting (Chinese Songti, English Times New Roman, small size equivalent to xiaosi, single line spacing, first-line indent two characters) while preserving non-body elements such as cover, titles, table of contents, headers and footers; used when users request 'normalize format' or to unify .docx body font/size/paragraphs.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "document-format-normalizer" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-90a07d04f17701e4bad63425defd0691b860251832f91e60ab7e31d7648e030c. Verify the upstream source and version against https://skillhub.cn/skills/user_5aaeb723/wzy0001 before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Document format normalizer: standardizes Word document body formatting (Chinese Songti, English Times New Roman, small size equivalent to xiaosi, single line spacing, first-line indent two characters) while preserving non-body elements such as cover, titles, table of contents, headers and footers; used when users request 'normalize format' or to unify .docx body font/size/paragraphs.

0 Downloads

Introduction source: third_party · user_5aaeb723 · 1.0.0 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Software, accounts and paid services
Translation pending; see source documentation.
Limits and differences
Translation pending; see source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: document-format-normalizer
description: 规整/规范 Word 文档正文格式的技能。当用户说"规整格式""规范格式",或要求统一一个 .docx 文件的正文字体、字号、段落格式时使用。将正文设为中文宋体、英文 Times New Roman、小四号、单倍行距、首行缩进两个汉字,并自动保护封面、标题、目录、页眉页脚等非正文内容不被改动。
agent_created: true

文档格式规范器(Document Format Normalizer)

概述

统一 Word(.docx)文档正文的排版,同时保护封面、标题、目录、页眉页脚等非正文内容。默认规则:

  • 中文字符 → 宋体
  • 英文/数字 → Times New Roman
  • 字号 → 小四(12pt)
  • 行距 → 单倍
  • 首行缩进 → 两个汉字

何时使用

当用户表达以下意图时触发:

  • "规整格式""规范格式""统一格式"
  • "把这个文档的正文字体/字号/段落整理一下"
  • 提供一个 .docx 文件并要求按上述规范排版正文

正文 / 非正文的判定规则

脚本用启发式规则识别正文,只改正文,不动其他。满足以下任一条件的段落会被保护(跳过):

  1. 段落样式名包含:heading / 标题 / title / subtitle / 副标题 / toc / 目录 / caption / 题注 / header / footer / 页眉 / 页脚 / quote
  2. 段落居中对齐(通常是封面/标题)
  3. 段落字号 ≥ 15pt(约三号,通常是标题)
  4. 文本匹配 --protect-regex 指定的正则(用于保护"只有视觉、没用标题样式"的标题)
  5. 空段落

其余有文字的段落视为正文并重排。表格单元格内的段落也会按同样规则处理。

处理"没用标题样式的标题"

有些文档全篇都是 Normal 样式,标题仅靠人眼区分(例如"知识内容1: xxx""第一章 xxx""1.1 xxx")。 此时样式/居中/字号规则都无法识别,需用 --protect-regex 按文字规律保护。例如:

"$PY" "$SCRIPT" "文件.docx" --protect-regex "^(知识内容|知识点|第.{1,3}章|\d+(\.\d+)*[\s、.])"

先用 --dry-run 观察被保护清单是否符合预期,再正式执行。

使用方法

1. 确认环境(首次使用)

脚本依赖 python-docx。若未安装,用隔离环境安装一次:

# 创建隔离 venv(若已存在可跳过)
"C:/Users/WangZhenyu/.workbuddy/binaries/python/versions/3.13.12/python.exe" -m venv "C:/Users/WangZhenyu/.workbuddy/binaries/python/envs/default"
# 安装依赖
"C:/Users/WangZhenyu/.workbuddy/binaries/python/envs/default/Scripts/pip.exe" install python-docx

2. 运行(推荐先 dry-run 预览)

PY="C:/Users/WangZhenyu/.workbuddy/binaries/python/envs/default/Scripts/python.exe"
SCRIPT="C:/Users/WangZhenyu/.workbuddy/skills/document-format-normalizer/scripts/format_docx.py"

# 预览:只报告会改哪些、保护哪些,不写文件
"$PY" "$SCRIPT" "输入文件.docx" --dry-run

# 正式执行:默认生成 <文件名>_formatted.docx,绝不覆盖原文件
"$PY" "$SCRIPT" "输入文件.docx"

3. 常用参数

  • -o, --output:指定输出路径
  • --size:正文字号 pt,默认 12(小四)
  • --latin:英文字体,默认 Times New Roman
  • --cjk:中文字体,默认 宋体
  • --include-centered:连居中段落也一起改(默认跳过以保护封面/标题)
  • --big-title-pt:大于等于该字号视为标题跳过,默认 15
  • --protect-regex:文本匹配该正则的段落按标题保护(应对无标题样式的文档)
  • --dry-run:只预览不落盘

工作流建议

  1. 先跑 --dry-run,把"重排段落数"和"被保护段落"清单给用户确认,重点核对被保护的是否确为封面/标题。
  2. 若发现有正文被误判保护(例如某段正文恰好居中),加 --include-centered 或调高 --big-title-pt 后重跑。
  3. 正式执行后,用 present_files 展示生成的 _formatted.docx 给用户。
  4. 原文件始终保留,输出为新文件,安全可回退。

注意事项

  • 仅支持 .docx。若是旧版 .doc,先另存/转换为 .docx。
  • 字体名"宋体""Times New Roman"必须准确,否则 Word 会回退到默认字体。
  • 首行缩进用 firstLineChars=200(两字符),与字号无关,换字号也能保持两字缩进。

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value82/100

Highlights

  • 解决文档格式统一这一明确痛点,受众广泛
  • 智能识别正文/非正文,避免误改封面标题等关键内容
  • 支持正则保护规则,适应无样式标题的特殊场景
Trigger Precision85/100

Highlights

  • 触发词覆盖主流表达方式,边界清晰
  • 明确要求 .docx 文件,减少误触发
Structure and Standards90/100

Areas to improve

  • description写错位置 Reported severity: Minor

    顶层 frontmatter 中 description 为空,实际描述内容在 skill_body 内部

    Recommendation: 将 description 内容移至顶层 frontmatter

Execution Reliability88/100

Areas to improve

  • 使用绝对路径 Reported severity: Minor

    文档中使用了具体的绝对路径(C:/Users/WangZhenyu/...)

    Recommendation: 建议改为相对路径或使用变量,提高可移植性

Highlights

  • dry-run 预览机制有效防止误操作
  • 输出文件不覆盖原文件,保障数据安全
  • 依赖管理清晰,提供完整的安装指引
Evidence Verifiability (mean of the first four)86/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Translation pending; see source documentation.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.