党政机关公文生成 logo

党政机关公文生成

Community
NanjingHJLP
党政机关公文生成

根据 GB/T 9704-2012《党政机关公文格式》国家标准,将用户输入的文本或上传的 txt、pdf 文件转换为规范格式的公文 PDF。使用场景:(1) 用户输入公文内容文本,(2) 用户上传 txt 或 pdf 文件需要转换格式,(3) 需要生成符合党政机关公文标准的正式文件

Overview

PublisherNanjingHJLP
Repositoryhjlp-skills
Skill name党政机关公文生成
Stars
26
Forks
4
Bundled files
8
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 8 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by NanjingHJLP on GitHub. Read the source before you install it.

Installation

Install the 党政机关公文生成 AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/NanjingHJLP/hjlp-skills/tree/main/skills/party-government-document-generator
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/NanjingHJLP/hjlp-skills.git /tmp/hjlp-skills
mkdir -p .claude/skills
cp -r /tmp/hjlp-skills/skills/party-government-document-generator .claude/skills/nanjinghjlp-13
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable 党政机关公文生成 in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads 党政机关公文生成 on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so 党政机关公文生成 is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

党政机关公文生成 Skill

本 Skill 严格依据 GB/T 9704-2012《党政机关公文格式》国家标准,将用户提供的文本内容转换为规范格式的公文 PDF 文件。

核心功能

  1. 文本输入:接受用户直接输入的公文内容
  2. 文件读取:读取用户上传的 txt 或 pdf 文件内容
  3. 格式转换:按 GB/T 9704-2012 标准自动排版生成规范公文 PDF

GB/T 9704-2012 标准要点

用纸和版面尺寸

参数数值说明
纸张规格A4 (210mm×297mm)国家标准规定
上白边37mm±1mm天头
下白边35mm±1mm地脚
左白边28mm±1mm订口
右白边26mm±1mm翻口
版心尺寸156mm×225mm不含页码
正文行距28-30磅固定值
每页行数22行标准规定
每行字数28字标准规定

公文格式要素划分

公文格式各要素划分为版头、主体、版记三部分:

  • 版头:公文首页红色分隔线以上的部分

    • 份号(左上角,6位阿拉伯数字)
    • 密级和保密期限(左上角)
    • 紧急程度(左上角)
    • 发文机关标志(红色小标宋,居中)
    • 发文字号(发文机关标志下空二行,居中)
    • 签发人(上行文需要,居右空一字)
    • 红色分隔线(发文字号下4mm处)
  • 主体:红色分隔线(不含)以下至版记以上的部分

    • 标题(红色分隔线下空二行,二号小标宋居中)
    • 主送机关(标题下空一行,顶格)
    • 正文(每个自然段左空二字,回行顶格)
    • 附件说明(正文下空一行,左空二字)
    • 发文机关署名、成文日期和印章(右空四字)
    • 附注(如有,居左空二字加圆括号)
  • 版记:末页首条分隔线以下的部分

    • 首条分隔线(粗线)
    • 抄送机关(四号仿宋,左右各空一字)
    • 中间分隔线(细线)
    • 印发机关和印发日期(左右各空一字对齐)
    • 末条分隔线(粗线,与版心下边缘重合)

字体字号规范

要素字体字号位置/说明
发文机关标志小标宋体自定红色,居中,上边缘距版心上边缘35mm
发文字号仿宋三号发文机关标志下空二行,居中
签发人楷体三号居右空一字,"签发人"三字用仿宋
公文标题小标宋体二号红色分隔线下空二行,居中
主送机关仿宋三号标题下空一行,顶格
正文仿宋三号首行缩进2字符
一级标题黑体三号"一、""二、"格式
二级标题楷体三号"(一)""(二)"格式
三级标题仿宋加粗三号"1.""2."格式
发文机关署名仿宋三号成文日期之上居中
成文日期仿宋三号阿拉伯数字,右空四字
抄送机关仿宋四号版记区域
印发机关/日期仿宋四号版记区域,左右各空一字

工作流程

Step 1:接收输入

  • 用户直接输入文本内容,或
  • 用户上传 txt/pdf 文件

Step 2:读取内容

使用 read_file.exe 工具读取文件内容:

bash
read_file.exe <文件路径>

该工具支持:

  • txt 文件:直接读取文本
  • pdf 文件:提取文字和表格内容
  • 输出为JSON格式供后续处理

Step 3:解析公文要素

自动识别公文各组成部分:

  • 标题:通常为第一行非空内容
  • 主送机关:如"各省、自治区、直辖市人民政府:"
  • 正文:主体内容
  • 发文机关:末尾包含"局""委""办""部"等的行
  • 成文日期:格式如"2024年1月25日"

Step 4:生成 PDF

使用 generate_document.exe 工具生成符合国标的 PDF:

bash
generate_document.exe --input <输入文件> --output <输出路径> --type <公文类型> --sender <发文机关> --title <标题>

支持的公文类型

15种法定公文类型:

  1. 决议
  2. 决定
  3. 命令(令)
  4. 公报
  5. 公告
  6. 通告
  7. 意见
  8. 通知
  9. 通报
  10. 报告
  11. 请示
  12. 批复
  13. 议案
  14. 函
  15. 纪要

使用示例

示例 1:直接输入文本生成通知

用户输入:

请生成一份通知,内容是关于 2024 年春节放假安排:
- 放假时间:2 月 9 日至 2 月 17 日
- 2 月 4 日、2 月 18 日上班
- 各部门做好值班安排
发文机关:国务院办公厅
发文字号:国办发〔2024〕1号
成文日期:2024 年 1 月 25 日
抄送:党中央各部门,全国人大常委会办公厅

生成命令:

bash
generate_document.exe ^
  --title "关于2024年春节放假安排的通知" ^
  --sender "国务院办公厅" ^
  --doc-number "国办发〔2024〕1号" ^
  --date "2024年1月25日" ^
  --recipient "各省、自治区、直辖市人民政府,国务院各部委、各直属机构" ^
  --copy-to "党中央各部门,全国人大常委会办公厅,全国政协办公厅" ^
  --content "正文内容..." ^
  --output "春节放假通知.pdf"

示例 2:使用 JSON 输入文件

创建 input.json:

json
{
  "title": "关于2024年春节放假安排的通知",
  "doc_type": "通知",
  "sender": "国务院办公厅",
  "doc_number": "国办发〔2024〕1号",
  "date": "2024年1月25日",
  "recipient": "各省、自治区、直辖市人民政府,国务院各部委、各直属机构",
  "content": "根据国务院办公厅关于2024年部分节假日安排的通知精神,现将春节放假有关事项通知如下:\n\n一、放假时间\n2024年2月9日至2月17日放假调休,共9天。\n\n二、调休安排\n2月4日(星期日)、2月18日(星期日)上班。\n\n三、工作要求\n各地区、各部门要妥善安排好值班和安全、保卫等工作。",
  "copy_to": "党中央各部门,全国人大常委会办公厅"
}

执行命令:

bash
generate_document.exe --input input.json --output 春节放假通知.pdf

示例 3:上传文件转换格式

用户上传 draft.txt,读取后重新排版生成 PDF:

bash
read_file.exe draft.txt > content.json
generate_document.exe --input content.json --output 正式公文.pdf

工具说明

read_file.exe

读取输入文件内容,支持 txt 和 pdf 格式,输出为 JSON 格式供后续处理。

功能:

  • 自动检测文件编码
  • 提取 PDF 中的文字和表格
  • 输出结构化 JSON 数据

generate_document.exe

根据 GB/T 9704-2012 标准生成公文 PDF。

参数说明:

参数说明示例
--input输入文件路径(txt 或 json)--input input.json
--output输出 PDF 文件路径--output 通知.pdf
--type公文类型--type 通知
--title公文标题--title "关于XXX的通知"
--sender发文机关全称--sender "国务院办公厅"
--date成文日期--date "2024年1月25日"
--recipient主送机关--recipient "各省人民政府"
--copy-to抄送机关--copy-to "党中央各部门"
--doc-number发文字号--doc-number "国办发〔2024〕1号"
--issuer签发人(上行文)--issuer "XXX"
--attachment附件说明--attachment "1.XXX文件"
--security-level密级--security-level "秘密"
--urgency紧急程度--urgency "特急"
--content直接输入内容--content "正文..."

格式要求详解

版头要求

  1. 发文机关标志

    • 使用红色小标宋体字(代码中用黑体替代)
    • 居中排布
    • 格式:发文机关全称/简称 + "文件"
    • 上边缘至版心上边缘约35mm
  2. 发文字号

    • 发文机关标志下空二行位置
    • 居中排布
    • 格式:发文机关代字 + 年份(六角括号)+ 顺序号
    • 示例:国办发〔2024〕1号
  3. 红色分隔线

    • 发文字号下4mm处
    • 与版心等宽
    • 粗线(约0.35mm)

主体要求

  1. 标题

    • 红色分隔线下空二行
    • 二号小标宋体,居中
    • 回行时词意完整,排列对称
  2. 主送机关

    • 标题下空一行
    • 顶格编排
    • 最后一个机关名称后标全角冒号
  3. 正文

    • 每个自然段左空二字(首行缩进2字符)
    • 回行顶格
    • 结构层次序数:
      • 第一层:"一、""二、"(黑体)
      • 第二层:"(一)""(二)"(楷体)
      • 第三层:"1.""2."(仿宋)
      • 第四层:"(1)""(2)"(仿宋)
  4. 附件说明

    • 正文下空一行
    • 左空二字
    • 格式:附件:1.XXXXX
  5. 发文机关署名和成文日期

    • 正文下空二行
    • 成文日期右空四字
    • 发文机关署名在日期之上居中
    • 日期用阿拉伯数字:2024年1月25日(不编虚位)

版记要求

  1. 分隔线

    • 首条和末条用粗线(0.35mm)
    • 中间用细线(0.25mm)
    • 与版心等宽
  2. 抄送机关

    • 四号仿宋体
    • 左右各空一字
    • 格式:抄送:XXX,XXX。
  3. 印发机关和印发日期

    • 四号仿宋体
    • 印发机关左空一字
    • 印发日期右空一字
    • 日期后加"印发"二字

注意事项

  1. 字体要求

    • 系统需安装:仿宋、楷体、黑体、小标宋体
    • Windows 系统通常自带这些字体
    • 如缺少小标宋体,代码会用黑体替代
  2. 系统要求

    • Windows 操作系统
    • 系统需安装仿宋、楷体、黑体等中文字体
    • read_file.exe 和 generate_document.exe 需在系统 PATH 中或指定完整路径
  3. 页面设置

    • 严格使用 A4 纸张
    • 页边距必须准确,确保版心尺寸正确
  4. 特殊情况处理

    • 主送机关过多时,可移至版记
    • 附件应另面编排
    • 上行文需标注签发人
  5. 日期格式

    • 必须使用阿拉伯数字
    • 不编虚位(1不编为01)
    • 年份标全称

相关文件

  • references/gbt-9704-2012.md - 公文格式标准详细说明
  • assets/document_template.json - 公文模板字段定义
  • read_file.exe - 文件读取工具
  • generate_document.exe - PDF 生成工具

参考标准

  • GB/T 9704-2012《党政机关公文格式》
  • GB/T 15834《标点符号用法》
  • GB/T 15835《出版物上数字用法》

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the 党政机关公文生成 AI skill do?

根据 GB/T 9704-2012《党政机关公文格式》国家标准,将用户输入的文本或上传的 txt、pdf 文件转换为规范格式的公文 PDF。使用场景:(1) 用户输入公文内容文本,(2) 用户上传 txt 或 pdf 文件需要转换格式,(3) 需要生成符合党政机关公文标准的正式文件

Why use 党政机关公文生成 on TypingMind?

Because you install it once and use it with any model. 党政机关公文生成 is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install 党政机关公文生成 in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/NanjingHJLP/hjlp-skills/tree/main/skills/party-government-document-generator. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use 党政机关公文生成?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with 党政机关公文生成?

As many as you like. As long as a model supports skills, you can use 党政机关公文生成 with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the 党政机关公文生成 AI skill free?

It is published on GitHub by NanjingHJLP. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇