duyunzhoudyz/dyz-gongwen-skills / skills/gongwen-format
gongwen-format
Verified按 GB/T 9704-2012 把公文正文排成 Word,有红头、信函、纪要、命令(令)、白头、材料、简报七种版式,支持联合行文版头、附件另面、预印红头纸套打;检查、修复 docx 的页边距、字体、行距、页码;把核稿意见写成 Word 批注;无 Python 时给手动设置清单。用户说“排版”“套红头”“转成 Word”“按国标调格式”“格式乱了帮我改”“页码怎么设”时使用。只管格式不改内容:起草转对应起草 skill,压缩改写转 gongwen-polish,去 AI 味转 gongwen-humanize,去免责对冲转 gongwen-direct,核稿转 gongwen-review。
assets/gbt9704_params.json
View on GitHub{
"version": "0.1.0",
"source": "references/_shared/rules/gbt9704.md(GB/T 9704-2012 要点,括号内为条款号)",
"note": "每个数值都在 basis 中注明条款号;标“实践值”“推算”的不是标准原文。修改数值前先核对 gbt9704.md,二者必须一致。",
"page": {
"paper": {"value": "A4", "basis": "5.1"},
"width_mm": {"value": 210, "basis": "5.1"},
"height_mm": {"value": 297, "basis": "5.1"},
"margin_top_mm": {"value": 37, "basis": "5.2.1(天头 37 mm±1 mm)"},
"margin_left_mm": {"value": 28, "basis": "5.2.1(订口 28 mm±1 mm)"},
"margin_bottom_mm": {"value": 35, "basis": "推算:297-37-225(gbt9704.md 参数总表)"},
"margin_right_mm": {"value": 26, "basis": "推算:210-28-156(gbt9704.md 参数总表)"},
"margin_tolerance_mm": {"value": 1, "basis": "5.2.1(±1 mm)"},
"body_width_mm": {"value": 156, "basis": "5.2.1(版心 156 mm×225 mm)"},
"body_height_mm": {"value": 225, "basis": "5.2.1"},
"header_distance_mm": {"value": 15, "basis": "实践值:公文不用页眉,取 Word 默认值"},
"footer_distance_mm": {"value": 20, "basis": "实践值:取信函格式下双线距下页边 20 mm(10.1),页码位置另由 page_number.space_after_pt 调整"},
"page_number_space_after_pt": {"value": 13, "basis": "推算:使页码段落下沿距纸张下边缘约 24.6 mm,一字线距版心下边缘约 7 mm(7.5);参照 imhuhe/gongwen-kit 实测页脚距边界 1392 twips"}
},
"grid": {
"lines_per_page": {"value": 22, "basis": "5.2.3"},
"chars_per_line": {"value": 28, "basis": "5.2.3"},
"line_spacing_pt": {"value": 28.9, "basis": "实践值:Word 固定值 28.9 磅(gbt9704.md 第九部分)"},
"line_spacing_tolerance_pt": {"value": 0.6, "basis": "推算:225 mm 版心内 22 行,行距在 28.4~29.5 磅之间仍为 22 行"},
"doc_grid_type": {"value": "linesAndChars", "basis": "实践值:文档网格“指定行和字符网格”(gbt9704.md 第九部分)"},
"doc_grid_line_pitch_twips": {"value": 579, "basis": "推算:225 mm≈637.8 磅÷22≈29.0 磅,取 579 twips(28.95 磅)"},
"doc_grid_char_space": {"value": -842, "basis": "推算:版心宽 8845 twips÷28≈15.79 磅,比三号 16 磅小 0.206 磅,×4096≈-842"}
},
"sizes_pt": {
"初号": {"value": 42, "basis": "Word 字号对照"},
"小初": {"value": 36, "basis": "Word 字号对照"},
"一号": {"value": 26, "basis": "Word 字号对照"},
"小一": {"value": 24, "basis": "Word 字号对照"},
"二号": {"value": 22, "basis": "Word 字号对照(gbt9704.md 第九部分)"},
"小二": {"value": 18, "basis": "Word 字号对照"},
"三号": {"value": 16, "basis": "Word 字号对照(gbt9704.md 第九部分)"},
"四号": {"value": 14, "basis": "Word 字号对照(gbt9704.md 第九部分)"},
"小四": {"value": 12, "basis": "Word 字号对照"}
},
"colors": {
"red": {"value": "FF0000", "basis": "7.2.4、7.2.7 规定为红色;色值为实践值"},
"black": {"value": "000000", "basis": "5.2.4"}
},
"fonts": {
"standard": {
"仿宋": "仿宋_GB2312",
"楷体": "楷体_GB2312",
"黑体": "黑体",
"小标宋": "方正小标宋简体",
"宋体": "宋体"
},
"policy": "字体严格模式:文档中一律写入 standard 中的字体名;本机缺少任一标准字体时,只指出缺哪些字体并引导用户自行下载安装(见 install_guide),不降级、不替代、不改用任何其他字体(含仿宋、楷体、华文中宋、宋体加粗)。本工具不提供、不打包任何字体文件。",
"install_guide": {
"statement": "本工具不提供、不打包任何字体文件,只检测并引导。字体须由用户自行获取并安装,务必从单位提供或字体厂商官方等可靠来源获取,不要使用来路不明的安装包。",
"fonts": {
"仿宋": {
"font": "仿宋_GB2312",
"usage": "正文、主送机关、三四级标题、署名、成文日期、发文字号、附注、版记、表格",
"source": "早期中文版 Windows(如 Windows XP)附带的字体,现行 Windows 不再预装。",
"obtain": "先向单位信息中心或办公室索取;也可在互联网搜索字体名“仿宋_GB2312”下载,务必从可靠来源下载。",
"note": "安装后在字体列表中核对名称完全是“仿宋_GB2312”(英文名 FangSong_GB2312),而不是“仿宋”(现行 Windows 自带的“仿宋”是另一款字体,不能代替)。该字体只含 GB 2312 字符集,人名、地名中的生僻字可能缺字,打印前核对。"
},
"楷体": {
"font": "楷体_GB2312",
"usage": "二级标题、签发人姓名",
"source": "早期中文版 Windows(如 Windows XP)附带的字体,现行 Windows 不再预装。",
"obtain": "先向单位信息中心或办公室索取;也可在互联网搜索字体名“楷体_GB2312”下载,务必从可靠来源下载。",
"note": "安装后在字体列表中核对名称完全是“楷体_GB2312”(英文名 KaiTi_GB2312),而不是“楷体”(现行 Windows 自带的“楷体”是另一款字体,不能代替)。该字体只含 GB 2312 字符集,人名、地名中的生僻字可能缺字,打印前核对。"
},
"黑体": {
"font": "黑体",
"usage": "一级标题、密级、紧急程度、附件标识、表题",
"source": "简体中文版 Windows 预装字体(SimHei,文件 simhei.ttf)。",
"obtain": "Windows 一般已有;macOS、Linux 默认没有,需自行获取并安装:先向单位信息中心或办公室索取,或从可靠来源下载。",
"note": "安装后字体列表中的名称应为“黑体”(英文名 SimHei)。macOS 自带的“黑体-简”(Heiti SC)是另一款字体,不能代替。"
},
"小标宋": {
"font": "方正小标宋简体",
"usage": "标题、发文机关标志、纪要标志、简报名称",
"source": "北京北大方正电子有限公司(方正字库)的商业字体。",
"obtain": "到方正字库官网 https://www.foundertype.com 搜索“方正小标宋简体”获取。个人非商业使用可免费下载,单位使用需商业授权;很多机关已统一采购,可先问单位信息中心或办公室。",
"note": "安装后字体列表中的名称应为“方正小标宋简体”(英文名 FZXiaoBiaoSong-B05S)。“方正小标宋_GBK”是另一款字体,不能代替。"
},
"宋体": {
"font": "宋体",
"usage": "页码",
"source": "简体中文版 Windows 预装字体(SimSun,文件 simsun.ttc)。",
"obtain": "Windows 一般已有;macOS、Linux 默认没有,需自行获取并安装:先向单位信息中心或办公室索取,或从可靠来源下载。",
"note": "安装后字体列表中的名称应为“宋体”(英文名 SimSun)。macOS 自带的“宋体-简”(Songti SC)是另一款字体,不能代替。"
}
},
"install_methods": {
"Windows": "右键字体文件,选“为所有用户安装”;或双击字体文件,点“安装”。",
"macOS": "双击字体文件,在“字体册”窗口点“安装字体”。",
"Linux": "把字体文件复制到 ~/.local/share/fonts/,再运行 fc-cache -f。",
"安装后": "重启 Word/WPS,在字体列表中核对名称与标准字体名完全一致;也可运行 python scripts/gw_fonts.py 复查。"
}
},
"basis": {
"standard": "gbt9704.md 第九部分字体名称表(7.2.4、7.3.1、7.3.3、7.5)",
"policy": "实践值:字体严格模式,缺字体时不降级、不替代(gbt9704.md 第九部分)",
"install_guide": "实践值:各字体的来源与获取途径、通用安装方法,不含任何字体文件(gbt9704.md 第九部分)"
}
},
"elements": {
"copy_no": {
"font": "仿宋", "size": "三号", "align": "left",
"basis": {"font": "5.2.2", "size": "7.2.1", "align": "7.2.1(顶格)"}
},
"secret": {
"font": "黑体", "size": "三号", "align": "left",
"basis": {"font": "7.2.2", "size": "7.2.2", "align": "7.2.2(顶格)"}
},
"urgency": {
"font": "黑体", "size": "三号", "align": "left",
"basis": {"font": "7.2.3", "size": "7.2.3", "align": "7.2.3(顶格)"}
},
"issuer": {
"font": "小标宋", "color": "red", "align": "center", "top_from_body_mm": 35,
"size_max_pt": 36, "size_min_pt": 22, "fill_ratio": 0.9, "line_ratio": 1.2,
"basis": {"font": "7.2.4(推荐小标宋体)", "color": "7.2.4", "align": "7.2.4(居中)",
"top_from_body_mm": "7.2.4", "size_max_pt": "实践值:小初", "size_min_pt": "实践值",
"fill_ratio": "实践值:标志宽度不超过版心宽的 90%", "line_ratio": "实践值"}
},
"docno": {
"font": "仿宋", "size": "三号", "align": "center", "blank_lines_before": 2, "left_chars_upward": 1,
"basis": {"font": "5.2.2", "size": "5.2.2", "align": "7.2.5(居中)", "blank_lines_before": "7.2.5(标志下空二行)",
"left_chars_upward": "7.2.5(上行文居左空一字)"}
},
"signer": {
"label_font": "仿宋", "name_font": "楷体", "size": "三号", "right_chars": 1,
"basis": {"label_font": "7.2.6", "name_font": "7.2.6", "size": "7.2.6", "right_chars": "7.2.6(居右空一字)"}
},
"header_rule": {
"color": "red", "width_pt": 1.5, "gap_mm": 4,
"basis": {"color": "7.2.7", "width_pt": "实践值:约 0.5 mm", "gap_mm": "7.2.7(发文字号之下 4 mm)"}
},
"title": {
"font": "小标宋", "size": "二号", "align": "center", "blank_lines_after_rule": 2, "blank_lines_after": 1,
"basis": {"font": "7.3.1", "size": "7.3.1", "align": "7.3.1", "blank_lines_after_rule": "7.3.1(红色分隔线下空二行)",
"blank_lines_after": "7.3.2(标题下空一行编主送机关)"}
},
"subtitle": {
"font": "楷体", "size": "三号", "align": "center",
"basis": {"font": "实践值", "size": "实践值", "align": "实践值"}
},
"recipient": {
"font": "仿宋", "size": "三号", "align": "left",
"basis": {"font": "5.2.2", "size": "5.2.2", "align": "7.3.2(居左顶格)"}
},
"body": {
"font": "仿宋", "size": "三号", "align": "justify", "first_line_chars": 2,
"basis": {"font": "7.3.3", "size": "7.3.3", "align": "实践值:两端对齐", "first_line_chars": "7.3.3(段首左空二字)"}
},
"h1": {
"font": "黑体", "size": "三号", "first_line_chars": 2, "outline_level": 0,
"basis": {"font": "7.3.3", "size": "5.2.2", "first_line_chars": "7.3.3", "outline_level": "实践值:便于导航窗格"}
},
"h2": {
"font": "楷体", "size": "三号", "first_line_chars": 2, "outline_level": 1,
"basis": {"font": "7.3.3", "size": "5.2.2", "first_line_chars": "7.3.3", "outline_level": "实践值"}
},
"h3": {
"font": "仿宋", "size": "三号", "first_line_chars": 2, "outline_level": 2, "bold": false,
"basis": {"font": "7.3.3", "size": "5.2.2", "first_line_chars": "7.3.3", "outline_level": "实践值",
"bold": "实践值:部分单位要求三级标题加粗,按本单位规定(gbt9704.md 第八部分)"}
},
"h4": {
"font": "仿宋", "size": "三号", "first_line_chars": 2, "outline_level": 3,
"basis": {"font": "7.3.3", "size": "5.2.2", "first_line_chars": "7.3.3", "outline_level": "实践值"}
},
"attendance": {
"label_font": "黑体", "font": "仿宋", "size": "三号", "left_chars": 2,
"basis": {"label_font": "10.3", "font": "10.3", "size": "10.3", "left_chars": "10.3(左空二字)"}
},
"attachment": {
"font": "仿宋", "size": "三号", "left_chars": 2, "blank_lines_before": 1,
"basis": {"font": "5.2.2", "size": "5.2.2", "left_chars": "7.3.4(左空二字)", "blank_lines_before": "7.3.4(正文下空一行)"}
},
"signature_noseal": {
"font": "仿宋", "size": "三号", "blank_lines_before": 1, "sign_right_chars": 2, "date_shift_chars": 2,
"basis": {"font": "5.2.2", "size": "5.2.2", "blank_lines_before": "7.3.5.2(下空一行)",
"sign_right_chars": "7.3.5.2(右空二字)", "date_shift_chars": "7.3.5.2(首字右移二字)"}
},
"signature_seal": {
"font": "仿宋", "size": "三号", "blank_lines_before": 2, "date_right_chars": 4,
"basis": {"font": "5.2.2", "size": "5.2.2",
"blank_lines_before": "实践值:留出印章位置,印章顶端距正文一行之内(7.3.5.1)",
"date_right_chars": "7.3.5.1(成文日期右空四字)"}
},
"note": {
"font": "仿宋", "size": "三号", "first_line_chars": 2,
"basis": {"font": "5.2.2", "size": "5.2.2", "first_line_chars": "7.3.6(居左空二字)"}
},
"banji": {
"font": "仿宋", "size": "四号", "side_chars": 1, "thick_line_pt": 1.0, "thin_line_pt": 0.75,
"basis": {"font": "7.4.2、7.4.3", "size": "7.4.2、7.4.3", "side_chars": "7.4.2、7.4.3(左右各空一字)",
"thick_line_pt": "7.4.1(推荐 0.35 mm,Word 线宽按 1/8 磅取整为 1 磅)",
"thin_line_pt": "7.4.1(推荐 0.25 mm,取整为 0.75 磅)"}
},
"page_number": {
"font": "宋体", "size": "四号", "dash": "—", "side_chars": 1,
"basis": {"font": "7.5", "size": "7.5", "dash": "7.5(一字线,U+2014)", "side_chars": "7.5(单页居右空一字,双页居左空一字)"}
},
"letter": {
"issuer_top_mm": 30, "rule_length_mm": 170, "rule_gap_mm": 4, "bottom_rule_from_page_mm": 20,
"thick_pt": 2.25, "thin_pt": 0.75, "double_gap_pt": 1.5, "blank_lines_before_title": 2,
"basis": {"issuer_top_mm": "10.1(上边缘距上页边 30 mm)", "rule_length_mm": "10.1(线长均 170 mm,居中排布)",
"rule_gap_mm": "10.1(标志下 4 mm)", "bottom_rule_from_page_mm": "10.1(距下页边 20 mm)",
"thick_pt": "实践值", "thin_pt": "实践值", "double_gap_pt": "实践值",
"blank_lines_before_title": "10.1(与其上最后一个要素相距二行)"}
},
"table": {
"font": "仿宋", "size": "四号", "header_bold": true, "border_pt": 0.5, "caption_font": "黑体", "caption_size": "三号",
"basis": {"font": "实践值:表格文字用仿宋或宋体(国标未规定,按本单位规定)", "size": "实践值:小四至四号,默认四号",
"header_bold": "实践值:表头加粗", "border_pt": "实践值:全框线 0.5 磅",
"caption_font": "实践值:表题黑体居中", "caption_size": "实践值:表题三号"}
},
"minutes": {
"top_from_body_mm": 35, "blank_lines_before_number": 1,
"basis": {"top_from_body_mm": "10.3(上边缘距版心上边缘 35 mm)",
"blank_lines_before_number": "实践值:纪要期号排在标志下一行,标准未规定"}
},
"brief": {
"name_font": "小标宋", "name_color": "red", "name_size_max_pt": 36, "name_size_min_pt": 22,
"name_fill_ratio": 0.9, "name_line_ratio": 1.2,
"issue_font": "仿宋", "issue_size": "三号", "issue_before_pt": 6,
"editor_font": "仿宋", "editor_size": "三号", "editor_before_pt": 4,
"rule_color": "red", "rule_width_pt": 1.5, "rule_gap_mm": 2, "blank_lines_after_rule": 1,
"basis": {"name_font": "实践值:简报无国家标准格式,按机关常见做法,各单位以往期样式为准",
"name_color": "实践值:红色居中", "name_size_max_pt": "实践值:小初", "name_size_min_pt": "实践值",
"name_fill_ratio": "实践值:名称宽度不超过版心宽的 90%", "name_line_ratio": "实践值",
"issue_font": "实践值:期号行居中,三号仿宋", "issue_size": "实践值", "issue_before_pt": "实践值",
"editor_font": "实践值:编印单位居左、日期居右同一行,三号仿宋", "editor_size": "实践值",
"editor_before_pt": "实践值",
"rule_color": "实践值:报头下红色分隔线", "rule_width_pt": "实践值:约 0.5 mm",
"rule_gap_mm": "实践值", "blank_lines_after_rule": "实践值:分隔线下空一行排第一篇标题"}
},
"order": {
"top_from_body_mm": 20, "blank_lines_before_number": 2, "blank_lines_after_number": 2,
"number_font": "仿宋", "number_size": "三号",
"sign_blank_lines_before": 2, "sign_right_chars": 4, "post_gap_chars": 2, "name_slot_chars": 3,
"date_blank_lines": 1, "date_right_chars": 4,
"basis": {"top_from_body_mm": "10.2(标志上边缘距版心上边缘 20 mm)",
"blank_lines_before_number": "10.2(标志下空二行编令号)",
"blank_lines_after_number": "10.2(令号下空二行编正文)",
"number_font": "5.2.2(令号用三号仿宋,标准未单列)", "number_size": "5.2.2",
"sign_blank_lines_before": "7.3.5.3(正文下空二行加盖签名章)",
"sign_right_chars": "7.3.5.3(签名章右空四字)",
"post_gap_chars": "7.3.5.3(签名章左空二字标签发人职务)",
"name_slot_chars": "实践值:签名章占位宽按三个字估算,姓名为排印占位,不代替签名章",
"date_blank_lines": "7.3.5.3(签名章下空一行编成文日期)",
"date_right_chars": "7.3.5.3(成文日期右空四字)"}
},
"attach_page": {
"label_font": "黑体", "label_size": "三号", "title_blank_lines_before": 1, "blank_lines_after_title": 1,
"basis": {"label_font": "7.3.7(“附件”及顺序号用 3 号黑体)", "label_size": "7.3.7",
"title_blank_lines_before": "7.3.7(标识在第一行顶格,标题在第三行,中间空一行)",
"blank_lines_after_title": "实践值:标题下空一行排正文,同 7.3.2 的做法,标准未单列"}
},
"joint": {
"name_size_max_pt": 36, "multi_name_size_max_pt": 28, "name_size_min_pt": 18, "name_slack": 1.06, "fill_ratio": 0.92, "wen_gap_ratio": 0.5, "line_ratio": 1.2,
"seal_diameter_mm": 42, "seal_cols_max": 3, "date_right_chars": 4,
"basis": {"name_size_max_pt": "实践值:小初", "multi_name_size_max_pt": "实践值:三个及以上机关时名称行多,取小二",
"name_size_min_pt": "实践值", "name_slack": "实践值:名称列宽比名称字数宽 6%,避免不同软件的字宽误差使名称回行",
"fill_ratio": "实践值:名称加“文件”的宽度不超过版心宽的 92%",
"wen_gap_ratio": "实践值:“文件”与机关名称之间空半个字",
"line_ratio": "实践值:行高取字号的 1.2 倍",
"seal_diameter_mm": "实践值:党政机关印章直径一般为 4.2 cm(7.3.5.1 只规定印章互不相交或相切)",
"seal_cols_max": "推算:版心 156 mm 除以印章直径 42 mm,并排最多 3 个且互不相交",
"date_right_chars": "7.3.5.1(成文日期一般右空四字)"}
},
"overprint": {
"issuer_default_size_pt": 36, "min_docno_top_mm": 44,
"basis": {"issuer_default_size_pt": "实践值:未给发文机关标志文字时,按小初字号估算标志行高留白",
"min_docno_top_mm": "推算:标志上边缘距版心上边缘 35 mm(7.2.4)加最小标志行高 22 磅×1.2,约 44 mm"}
}
},
"seal_default": {
"红头": true, "白头": true, "信函": true, "纪要": false, "材料": false, "简报": false, "命令": false,
"basis": "7.3.5(有发文机关署名的公文加盖印章);命令(令)用签名章(7.3.5.3),纪要、材料、简报不盖章为实践值"
}
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |