Agent skill

Gongwen Optimizer

by linhut in linhut/document-ai-assistant

中文公文(党政机关公文 GB/T 9704-2012)格式检查、自动修复、模板生成、版头版记页码注入与 AI 风格优化工具。

MITAuto-check passedDocuments & Office

Install Gongwen Optimizer

skills CLI
$ npx skills add linhut/document-ai-assistant --skill gongwen-optimizer -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install linhut/document-ai-assistant gongwen-optimizer --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/linhut/document-ai-assistant.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skill .claude/skills/gongwen-optimizer && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
gongwen-optimizer
GitHub stars
115
Token cost
~507 tokens
SKILL.md length
120 words
Files
3 (incl. scripts)
Skills in repo
1
Repo updated
First seen
Licence
MIT

At a glance

中文公文(党政机关公文 GB/T 9704-2012)格式检查、自动修复、模板生成、版头版记页码注入与 AI 风格优化工具。

  • Works in 4 steps: 生成/修改文档必须通过… → 中文字体必须走… → 标准字体:标题=方正小标宋简体、正文=仿宋_GB2312、西文=Times… → …
  • Tasks that involve Word documents
  • SKILL.md covers 能力范围, 快速开始(命令行), 规则体系(证据链) and 重要约定, plus 2 more sections
  • Runs PowerShell and Shell scripts from its folder; calls python, bash and pip

What it does

Gongwen Optimizer is an agent skill from linhut/document-ai-assistant. 中文公文(党政机关公文 GB/T 9704-2012)格式检查、自动修复、模板生成、版头版记页码注入与 AI 风格优化工具。

Its SKILL.md is about 510 tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files, including scripts (for example `scripts/install.sh`).

It sits in Documents & Office, covering Word documents. It works with Microsoft Word. The repository describes itself as: AI 公文智能优化助手 — 基于 GB/T 9704 标准的公文格式智能检测与优化桌面应用,可本地离线部署. The licence is MIT.

When your agent uses it

  • Tasks that involve Word documents

Example prompts

  • “/gongwen-optimizer”

Requirements

  • Python 3
  • A Bash shell
  • PowerShell

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. 生成/修改文档必须通过 backend/core/document/modifier.py(单一变更点),勿直接改模型。
  2. 中文字体必须走 backend/core/document/font_utils.py 的 set_run_font()(同时设置 ascii/hAnsi/eastAsia/cs 四属性)。
  3. 标准字体:标题=方正小标宋简体、正文=仿宋_GB2312、西文=Times New Roman;目标机缺字体时生成器会警告。
  4. 检查结果中的 standard_ref 为 GB/T 9704-2012 条款号,供审计与人工复核。

What it can do on your machine

Read from SKILL.md and the folder at commit a55f1b5. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 2 files in scripts/ (PowerShell and Shell), which the agent can run.

    Shell commands in SKILL.md call:

    • python
    • bash
    • pip

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use pip, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Gongwen Optimizer loads about 507 tokens when it runs. Until then it costs about 20 tokens; SKILL.md has 120 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~20
When it runs · the whole SKILL.md, loaded when a task matches
~507

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from linhut/document-ai-assistant at commit a55f1b5, republished under its MIT licence (© linhut). 120 words, ~507 tokens.

Download SKILL.mdSave it as .claude/skills/gongwen-optimizer/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
gongwen-optimizer
description
中文公文(党政机关公文 GB/T 9704-2012)格式检查、自动修复、模板生成、版头版记页码注入与 AI 风格优化工具。

gongwen-optimizer(公文优化 Skill)

本项目为「AI 公文智能优化助手」的 Agent 可调用发行版。它把文档处理引擎打包成 可供 Claude Code / Codex / OpenCode / Kimi / Trae / ZCode 等 Agent 直接调用的 Skill: 克隆仓库即用,不依赖桌面端与数据库。

能力范围

能力说明调用方式
格式检查按 GB/T 9704-2012 规则检查字体/字号/缩进/行距/页边距/页码等,输出问题清单(含标准条款 standard_ref)check
自动修复一键修复格式问题并生成优化后的 .docxoptimize
要素语义校验文号、成文日期、发文机关署名等语义级检查(CHK-S 系列)随 check 输出
特殊版式信函双线、命令格式、红头预印套打预留、联合行文规则/模板层支持
模板生成22 种法定文种模板(.dotx/.docx)生成仓库 templates/ 提供
AI 风格优化22 文种去 AI 味润色提示词库(backend/ai/style_library.py)配合 AI 调用

快速开始(命令行)

要求:Python 3.12+,安装依赖 pip install -r backend/requirements.txt。

bash
# 从仓库根目录执行
python backend/wfp_cli.py check 输入.docx --doc-type notice
python backend/wfp_cli.py format 输入.docx --doc-type notice -o 输出.docx
python backend/wfp_cli.py optimize 输入.docx --doc-type notice -o 优化.docx --apply-fixes

常用参数:

  • --doc-type:notice/report/request/meeting/decision/letter 等 22 种文种
  • --apply-fixes:同时应用修复规则(默认关闭,仅检查)
  • --selected-rules:只应用指定规则 ID(逗号分隔)

规则体系(证据链)

  • 规则文件:rules/official/*.yaml(公共基础层 _common.yaml + 各文种层,三级优先级官方 < 自定义 < 用户)
  • 每条检查规则关联 GB/T 9704-2012 条款(standard_ref),证据矩阵见 docs/gbt9704-audit-matrix.md
  • 语义校验规则见 backend/core/rules/semantic.py

重要约定

  1. 生成/修改文档必须通过 backend/core/document/modifier.py(单一变更点),勿直接改模型。
  2. 中文字体必须走 backend/core/document/font_utils.py 的 set_run_font()(同时设置 ascii/hAnsi/eastAsia/cs 四属性)。
  3. 标准字体:标题=方正小标宋简体、正文=仿宋_GB2312、西文=Times New Roman;目标机缺字体时生成器会警告。
  4. 检查结果中的 standard_ref 为 GB/T 9704-2012 条款号,供审计与人工复核。

安装到各 Agent 平台

bash
bash skill/scripts/install.sh --all          # macOS / Linux(符号链接,源目录只维护一份)
powershell -File skill/scripts/install.ps1 -All   # Windows(复制,避免符号链接权限问题)

支持的平台目录(随版本可能变化,可用环境变量 SKILL_DIRS 覆盖): Claude Code、Codex、OpenCode、Trae Code、Kimi Code、ZCode、TraeWork、WorkBuddy、Cursor。

许可

MIT。字体文件(方正小标宋简等)按其各自授权使用。

© linhut, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (scripts) in skill of linhut/document-ai-assistant.

  • SKILL.md
  • scripts/install.ps1
  • scripts/install.sh

Open the folder on GitHubat commit a55f1b5

Compare with similar skills

Gongwen Optimizer next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Gongwen Optimizer compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Gongwen Optimizer this skilllinhut/document-ai-assistant115—~507Automated safety check: PassMIT
MarkitdownImCa0/just-laws78114 repos~3.2kAutomated safety check: NotesMIT
DOCXrvdbreemen/OTGW-firmware20733 repos~4.3kAutomated safety check: PassProprietary
Word Document Reader and WriterHKUDS/DeepTutor41k—~2.5kAutomated safety check: PassApache-2.0
Gzh Designisjiamu/gzh-design-skill4k—~2.2kAutomated safety check: PassAGPL-3.0
GenOffice Document CLIgenspark-ai/genoffice9.2k—~19kAutomated safety check: PassApache-2.0

Similar skills

  • Markitdown

    ImCa0/just-laws

    Convert files and office documents to Markdown. An agent skill from ImCa0/just-laws.

    781 GitHub starsUsed in 14 repos~3.2k tokens
    Documents & OfficeAuto-check: notes
  • DOCX

    rvdbreemen/OTGW-firmware

    A skill your agent uses whenever the user wants to create, read, edit, or manipulate Word documents (.docx files).

    207 GitHub starsUsed in 33 repos~4.3k tokens
    Documents & OfficeAuto-check passed
  • Reads, creates and edits Word .docx files with python-docx, and drops to raw OOXML for tracked changes, comments and byte-exact edits.

    41k GitHub stars~2.5k tokensUpdated 2 days ago
    Documents & OfficeAuto-check passed
  • Gzh Design

    isjiamu/gzh-design-skill

    微信公众号文章排版引擎,将 Markdown 转换为可直接粘贴到公众号编辑器的 HTML。主题风格从 references/theme-index.md 注册的自定义主题库中选取,自动章节编号、关键词下划线标记、引言卡片、目录导航、代码块、图片/GIF、作者签名。支持 Markdown / Word(.docx) / PDF / 纯文本输入(非 Markdown…

    4k GitHub stars~2.2k tokensUpdated yesterday
    Documents & OfficeAuto-check passed
  • GenOffice Document CLI

    genspark-ai/genoffice

    Creates, converts, reads and edits real pptx, xlsx, docx and PDF files locally through the genoffice command line.

    9.2k GitHub stars~19k tokensUpdated yesterday
    Documents & OfficeAuto-check passed
  • BiSheng DOCX Builder

    dataelement/bisheng

    Builds or edits Word .docx documents inside BiSheng's code executor with python-docx, handling Chinese fonts, tables of contents, page numbers and official-document layout.

    12k GitHub stars~2.7k tokensUpdated today
    Documents & OfficeAuto-check passed

Works with

Questions about Gongwen Optimizer

What does Gongwen Optimizer do?

中文公文(党政机关公文 GB/T 9704-2012)格式检查、自动修复、模板生成、版头版记页码注入与 AI 风格优化工具。. Gongwen Optimizer is an agent skill from linhut/document-ai-assistant.

When should I use Gongwen Optimizer?

Gongwen Optimizer fits situations like: tasks that involve Word documents.

How do I install Gongwen Optimizer in Claude Code?

Run `npx skills add linhut/document-ai-assistant --skill gongwen-optimizer -a claude-code`. Or copy the skill folder (skill in linhut/document-ai-assistant) into .claude/skills/gongwen-optimizer in your project. Claude Code loads it when a task matches its description.

How do I install Gongwen Optimizer in Codex?

Run `npx skills add linhut/document-ai-assistant --skill gongwen-optimizer -a codex`. Or copy the skill folder (skill in linhut/document-ai-assistant) into .agents/skills/gongwen-optimizer in your project. Codex loads it when a task matches its description.

Can I use Gongwen Optimizer in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add linhut/document-ai-assistant --skill gongwen-optimizer -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/gongwen-optimizer, .gemini/skills/gongwen-optimizer, .github/skills/gongwen-optimizer and .opencode/skills/gongwen-optimizer in your project.

What does Gongwen Optimizer need to run?

Going by SKILL.md and its folder, Gongwen Optimizer needs PowerShell and a shell for the scripts in its folder and the command-line tools its instructions call (python, bash and pip). Our summary lists: Python 3; A Bash shell; PowerShell.

Does Gongwen Optimizer access the network?

SKILL.md contains no URLs. Its commands use pip, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Gongwen Optimizer safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Gongwen Optimizer use?

Gongwen Optimizer is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Gongwen Optimizer use?

About 507 tokens (SKILL.md is roughly 2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Gongwen Optimizer?

Skills that share tags, products or a category with Gongwen Optimizer: Markitdown (ImCa0/just-laws, 781 stars), DOCX (rvdbreemen/OTGW-firmware, 207 stars), Word Document Reader and Writer (HKUDS/DeepTutor, 41k stars) and Gzh Design (isjiamu/gzh-design-skill, 4k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Gongwen Optimizer?

linhut (a GitHub user) maintains it in linhut/document-ai-assistant, which has 115 GitHub stars. The repository was last updated on September 26, 2026.

Source: linhut/document-ai-assistant on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.