gw-format
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 "gw-format" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-996ba3960079eb419656b5fbf18295dd05cf85c6416506ba859fcf92872fa38c. Verify the upstream source and version against https://skillhub.cn/skills/user_bfd3822a/ztdgroup-gwpb 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
Automated official-document formatting skill. Applies Zhejiang Talent Development Group’s standard official-document format to Word documents, performing page setup (A4, margins), red-header unit name, document number, title and multi-level heading formats (level 1/2 blackface/kaiti, level 3/4 fangsong), body text (FangSong_GB2312 size 3), attachment notation, sign-off, cc, and issuance formatting elements. Trigger: when the user asks about official-document formatting, format adjustment, applying official standards, red-header files, or needs to create or reformat docx documents.
Introduction source: third_party · user_bfd3822a · 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
Frontmatter
name: gw-format
description: "公文自动排版技能。按照浙江省人才发展集团公文常规格式标准,自动对 Word 文档进行排版,包括页面设置(A4纸、页边距)、红头单位名称、文号、标题、各级标题(一/二级黑体楷体、三/四级仿宋)、正文(仿宋_GB2312三号)、附件标注、落款、抄送、印发行等全部格式要素。当用户提到公文排版、公文格式、格式调整、按公文标准排版、红头文件或需要对 Word 文档应用公文格式规范时,触发此技能。适用于 docx 文档的创建和重新排版两种场景。"公文自动排版
概述
本技能按照浙江省人才发展集团公文常规格式标准,自动对 Word 文档进行排版。支持两种工作模式:
- 从结构化 JSON 创建新公文 — 根据用户提供的内容结构,生成格式完整的 .docx
- 重新排版已有文档 — 读取已有 .docx,自动检测段落类型并应用公文格式
触发条件
以下场景触发本技能:
- 用户提到"公文排版"、"公文格式"、"按公文标准排版"
- 用户要求将 Word 文档调整为公文格式
- 用户需要生成红头文件
- 用户提供了公文内容,需要格式化输出
前置条件
- Python 3.x(使用 WorkBuddy 管理的 Python 环境)
- python-docx 库(脚本运行时自动安装,无需手动配置)
工作流程
步骤一:确定工作模式
根据用户需求选择模式:
| 模式 | 适用场景 | 命令 |
|---|---|---|
| JSON 创建 | 用户提供内容文本,需要从零生成公文 | python format_document.py --json structure.json -o output.docx |
| 重新排版 | 用户已有 .docx 草稿,需要调整格式 | python format_document.py --reformat input.docx -o output.docx |
| 生成模板 | 用户需要参考 JSON 结构模板 | python format_document.py --template -o template.json |
步骤二:执行排版
模式 A — 从 JSON 创建
-
如需参考模板,先生成 JSON 模板:
cd skill_dir/scripts python format_document.py --template -o template.json -
根据用户内容编写 JSON 结构文件(详见下方 JSON 结构说明)
-
执行排版命令:
cd skill_dir/scripts python format_document.py --json structure.json -o /path/to/output.docx
模式 B — 重新排版已有文档
-
直接执行排版命令:
cd skill_dir/scripts python format_document.py --reformat input.docx -o output.docx -
如需精确指定标题段落(避免误判),使用
--title参数:python format_document.py --reformat input.docx --title "关于XX的通知" -o output.docx -
脚本会自动检测以下段落类型:
一、开头 → 一级标题(黑体三号)(一)开头 → 二级标题(楷体三号)1.开头 → 三级标题(仿宋加粗三号)(1)开头 → 四级标题(仿宋三号)〔202X〕文号格式 → 文号(居中仿宋三号)附件:开头 → 附件标注抄送:开头 → 抄送行(四号)- 含"印发"+"办公室" → 印发行(四号)
- 纯日期 → 落款日期
- 其他 → 正文(仿宋三号,首行缩进2字符)
步骤三:验证与交付
- 排版完成后,使用
present_files工具将生成的 .docx 文件呈现给用户 - 如用户需要修改,可调整 JSON 结构或修改文档后重新排版
JSON 结构说明
{
"org_name": "浙江省人才发展集团",
"doc_number": "浙人发〔202X〕X号",
"title": "关于进一步规范公文格式的通知",
"body": [
{"type": "h1", "text": "一、一级标题内容"},
{"type": "body", "text": "正文内容..."},
{"type": "h2", "text": "(一)二级标题内容"},
{"type": "h3", "text": "1.三级标题内容"},
{"type": "h4", "text": "(1)四级标题内容"}
],
"attachments": ["1.《附件名称》", "2.《附件名称2》"],
"signature": "浙江省人才发展集团",
"date": "2024年X月X日",
"cc": "抄送:XXXXXXXXXX",
"print_line": "浙江省人才发展集团综合办公室 202X年X月X日印发"
}
body 段落类型
| type 值 | 含义 | 字体 | 字号 | 对齐 | 缩进 |
|---|---|---|---|---|---|
h1 |
一级标题 | 黑体 | 三号(16pt) | 两端 | 首行2字符 |
h2 |
二级标题 | 楷体 | 三号(16pt) | 两端 | 首行2字符 |
h3 |
三级标题 | 仿宋加粗 | 三号(16pt) | 两端 | 首行2字符 |
h4 |
四级标题 | 仿宋 | 三号(16pt) | 两端 | 首行2字符 |
body |
正文 | 仿宋_GB2312 | 三号(16pt) | 两端 | 首行2字符 |
body 数组中的元素也可以是纯字符串,脚本会自动检测类型。
格式规范
详细的格式规范参见 references/format_spec.md,包含:
- 页面设置:A4 纸,上3.8cm/下3.5cm/左2.8cm/右2.7cm
- 红头单位名称:分散对齐,65pt 加粗
- 文号:居中,仿宋_GB2312/Times New Roman,三号
- 标题:居中,方正小标宋简体,二号(22pt)
- 正文:仿宋_GB2312,三号(16pt),固定行距30pt,首行缩进2字符
- 各级标题格式(黑体/楷体/仿宋加粗/仿宋)
- 落款:右对齐,仿宋,三号
- 抄送/印发:四号(14pt)
- 公文结构顺序
运行环境
使用 WorkBuddy 管理的 Python 环境运行脚本:
# 设置 Python 路径
PYTHON="WorkBuddy_Python_路径"
# 示例:生成模板
$PYTHON format_document.py --template -o template.json
# 示例:从 JSON 创建
$PYTHON format_document.py --json structure.json -o 公文.docx
# 示例:重新排版
$PYTHON format_document.py --reformat 草稿.docx -o 公文.docx
注意事项
- 脚本依赖
python-docx库,首次运行时自动安装(通过 pip),无需手动配置 - 重新排版模式会清空原文档的字体、段落格式并重新应用,但保留文本内容
- 分散对齐(红头单位名称)通过 XML 直接设置
w:jc为distribute - 中文字体设置通过 XML 的
w:rFonts的w:eastAsia属性实现 - 固定行距通过
WD_LINE_SPACING.EXACTLY+Pt()实现 - 如原文档包含表格、图片等非段落内容,重新排版可能无法完整处理
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Areas to improve
-
受众相对特定 Reported severity: Minor
功能针对浙江省人才发展集团的公文格式标准,受众范围相对有限,非广泛通用工具。
Recommendation: 可考虑扩展支持更多通用公文格式标准,以提升普适性。
Highlights
- 提供公文自动排版功能,解决用户文档格式化的实际需求
- 支持两种工作模式:从 JSON 创建新公文和重新排版已有文档
- 功能明确,有具体应用场景和详细的使用说明
Highlights
- 触发关键词明确且覆盖合理(公文排版、公文格式、格式调整、按公文标准排版、红头文件等)
- 边界清晰,不易与其他 Skill 重叠
Areas to improve
-
文档过长 Reported severity: Minor
文档内容较为详尽,部分细节可进一步精简,以提升阅读效率。
Recommendation: 可考虑将部分详细说明移至独立的参考文档,保持主文档简洁。
Highlights
- 文档结构完整,包含概述、触发条件、前置条件、工作流程、JSON 结构说明、格式规范、运行环境和注意事项
- 有清晰的 Phase 划分和命令示例,frontmatter 完整
Areas to improve
-
部分异常处理未覆盖 Reported severity: Minor
未明确说明如何处理 python-docx 安装失败的情况,也未提及对输入文件格式错误的处理。
Recommendation: 建议补充对依赖库安装失败和输入文件格式错误的处理说明,以提升执行可靠性。
Highlights
- 脚本依赖 python-docx 库,说明首次运行会自动安装,参数使用合理
- 覆盖了主要异常(如标题误判可通过 --title 参数指定)
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.
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.
User discussion
No verified reviews yet.