gongwen-zero-prompt-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 "gongwen-zero-prompt-format" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-545bcf0d676db89f54745f15c6dce87404d56af0c63e83d047b4ecb90c6c8719. Verify the upstream source and version against https://skillhub.cn/skills/user_516d7c35/gongwen-zero-prompt-format 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
Convert plain text into a .docx file formatted to the GB/T 9704 national standard for official government documents. Triggered when the user says phrases like “format document,” “official document format,” “format government document to national standard,” or “make this text into a red-headed document/official document,” or when pasting notices/decisions/reports/requests/letters/minutes that need a compliant .docx. The key selling point: users do not need to provide any prompt—feeding the text to the script yields a standards-compliant official document.
Introduction source: third_party · user_516d7c35 · 1.0.0 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Audience
- python format_gongwen.py --stdin [output.docx]
- Inputs and outputs
- python format_gongwen.py <input.txt|input.docx> [output.docx]
- Testing
- Not tested
Browse files
Frontmatter
name: gongwen-zero-prompt-format
slug: gongwen-zero-prompt-format
displayName: 公文零输入一键排版
description: "将普通文本一键排版为符合《党政机关公文格式》GB/T 9704 国家标准的 .docx 文件。当用户说'排版公文''公文格式''按国家标准排版党政机关公文''把这段文字排成红头文件/公文',或粘贴通知/决定/报告/请示/函/纪要等公文文本需要生成规范 docx 时触发。核心卖点:用户无需提供任何 prompt,把文本喂给脚本即可得到规范公文。"
version: 1.0.0
author: gongwen-format
license: MIT
agent_created: true
requires:
python: ">=3.8"
packages:
- python-docx>=0.8.11
metadata:
hermes:
emoji: "📄"
tags: [公文, 党政机关, GB/T 9704, 排版, docx, 红头文件, 通知, 决定, 报告, 请示, 函, 纪要, 零输入]公文自动排版 (GB/T 9704)
Overview
将任意来源(WPS、记事本、网页、现有 docx)的公文文字,一键排版为符合《党政机关公文格式》GB/T 9704 国家标准的 .docx。核心是一个确定性脚本 scripts/format_gongwen.py:用户无需提供任何 prompt,把文本喂给脚本即可得到规范公文。
排版严格遵循国标:A4 用纸、上 37/下 35/左 28/右 26 mm 页边距、版心 156×225mm;正文 3 号仿宋、行距固定 28 磅、首行缩进 2 字;标题 2 号小标宋居中;层次序号 一、黑体 / (一)楷体 / 1.(1)仿宋;发文字号六角括号〔〕;成文日期右空 4 字;页码 4 号宋体带一字线。
零默认工作流 (Zero-Prompt Workflow)
绝大多数情况下,直接调用脚本即可,无需逐条向用户提问。 默认操作流程:
- 拿到文本:用户提供纯文本、.txt、.docx,或直接在对话里粘贴公文内容。
- 写入临时文件:若用户直接粘贴文字,写入一个临时
.txt(如公文草稿.txt)。 - 运行脚本(一步到位):
python "<skill>/scripts/format_gongwen.py" 公文草稿.txt 公文_排版.docx - 核对识别摘要:脚本会在 stderr 打印识别出的标题/主送机关/日期/正文段落数。把摘要转述给用户确认;若有误(如标题没识别、主送机关错位),见下方"纠错"。
- 交付 .docx:把生成的
公文_排版.docx路径告诉用户,提示在 WPS/Word 中打开复核。
不要逐项追问页边距、字号——这些国标已固定,脚本已内置。仅在脚本识别出错或用户主动给出元数据时才介入。
运行脚本
scripts/format_gongwen.py 是确定性排版引擎,依赖 python-docx(若环境缺失先 pip install python-docx,见 requirements.txt)。
用法
# 输入 .txt 或 .docx
python format_gongwen.py <input.txt|input.docx> [output.docx]
# 从标准输入读取(适合用户直接粘贴文字)
python format_gongwen.py --stdin [output.docx]
# 用 JSON 元数据补充/覆盖自动识别结果(份号/密级/发文字号/签发人等)
python format_gongwen.py 草稿.txt 公文.docx --meta meta.json
--meta 的 JSON 字段(均可选,未提供则从正文中自动识别或省略):
| 字段 | 含义 | 示例 |
|---|---|---|
fen_hao |
份号(6 位数字) | "000123" |
secret |
密级·保密期限 | "绝密★10年" |
urgency |
紧急程度 | "特急" |
from_org_mark |
版头发文机关标志 | "XX省人民政府文件" |
fa_wen_hao |
发文字号 | "国办发〔2025〕1号" |
signer |
签发人姓名 | "张三" |
title |
标题 | "关于…的通知" |
main_to |
主送机关 | "各省、自治区、直辖市人民政府:" |
from_org |
发文机关署名 | "国务院办公厅" |
date_str |
成文日期 | "2025年1月1日" |
attachments |
附件名列表 | ["附件一.docx","附件二.xlsx"] |
chaosong |
抄送机关 | "各民主党派中央" |
yifa_org |
印发机关 | "国务院办公厅" |
yifa_date |
印发日期 | "2025年1月2日" |
脚本自动识别能力
输入纯文本时,脚本按以下启发式识别结构(见脚本内 classify_meta()):
- 发文机关标志:标题之前最后一个非空行(如"XX文件")。
- 标题:第一个以"通知/决定/报告/请示/函/纪要…"结尾或含"关于"的短行。
- 主送机关:标题后第一个以全角冒号结尾、或含机关特征字(政府/局/委/办/院/部…)的短行。
- 正文层次序号:正则匹配
一、(一)1.(1),自动分配黑体/楷体/仿宋。 - 成文日期:自底向上匹配
\d{4}年\d{1,2}月\d{1,2}日;其上一非空行作为发文机关署名。
已实现的国标排版要点
脚本 scripts/format_gongwen.py 已写入以下规则(详见 references/gbt9704_spec.md):
- 页面:A4 (210×297mm);上 37 / 下 35 / 左 28 / 右 26 mm;版心 156×225mm。
- 正文:3 号(16pt) 仿宋_GB2312;行距固定值 28 磅;首行缩进 2 字符;两端对齐。
- 标题:2 号(22pt) 方正小标宋;居中。
- 层次序号字体:
一、→黑体;(一)→楷体;1./(1)→仿宋(均 3 号)。 - 主送机关:3 号仿宋,顶格,末尾全角冒号。
- 发文机关标志:红色小标宋,居中,下加红色分隔线(版头红线)。
- 发文字号:3 号仿宋居中;签发人标签仿宋、姓名楷体。
- 发文机关署名 / 成文日期:署名右空 2 字(不盖章情形),成文日期右空 4 字。
- 页码:4 号半角宋体阿拉伯数字,左右各放一字线(
— 1 —),居中页脚。 - 版记:抄送/印发机关与印发日期,4 号仿宋,3 条分隔线(首末粗线、中间细线)。
字体可用性说明
脚本默认使用国标指定的中文字体名:仿宋_GB2312、楷体_GB2312、方正小标宋简体、黑体、宋体。这些字体名写入 docx 的 eastAsia 属性;若用户系统未安装 仿宋_GB2312/方正小标宋简体,WPS/Word 会自动回退到近义字体(仿宋、宋体)。排版规则(字号、行距、缩进、页边距)不受字体缺失影响。 若用户需要严格字面一致,建议安装方正小标宋简体与仿宋_GB2312。
纠错与进阶处理
当脚本识别摘要有误时,按以下方式修正,不要手改 docx(下次重排会丢失):
- 标题/主送机关/署名识别错位:用
--meta显式给出正确字段。python format_gongwen.py 草稿.txt 公文.docx --meta meta.jsonmeta.json里只写要覆盖的字段即可。 - 需要份号/密级/紧急程度/发文字号/签发人/抄送/印发:纯文本里通常没有,一律走
--meta。 - 信函格式 / 命令格式 / 纪要格式:脚本默认是普通文件格式;若用户明确要这三种特定格式,先读
references/gbt9704_spec.md第 9 节,再据此调整或提示用户当前脚本输出为普通格式。 - 印章/电子签:脚本不插入印章图片(需用户提供印章图片且属敏感操作)。在 docx 中署名与日期已按盖章位置排好,用户在 WPS 中盖电子章即可。
安装
pip install -r requirements.txt
参考资料
references/gbt9704_spec.md:GB/T 9704 全套排版规范速查(用纸、字体、版头/主体/版记各要素、页码、特定格式、印制装订、常见错误核对清单)。遇到识别外的疑难或需核对细节时阅读此文件。
版本历史
- v1.0.0 (2026-07-06)
- 规范化 SKILL.md 元数据(slug/displayName/version/author/license/agent_created/requires)
- 拆分
requirements.txt声明依赖 - 移除
agents/openai.yaml(非 SkillHub 必需项) - 整理目录结构为标准 SKILL/scripts/references 布局
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 高价值/高频刚需。直接解决用户明确的核心任务痛点:将普通文本一键排版为符合《党政机关公文格式》GB/T 9704 国家标准的 .docx 文件。
- 用户无需提供任何 prompt,把文本喂给脚本即可得到规范公文。
Highlights
- 触发词精准完整,覆盖多种变体,边界清晰。
Highlights
- Phase/步骤清晰,有出口条件,含端到端示例,frontmatter完整,单文件≤500行。
Highlights
- 工具来源明确,参数正确,覆盖主要异常,不可逆操作有确认机制。
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.
-
Install or fetch external dependencies
Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.
Mentioned in main document · lines 45, 124
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
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.