← 返回 Skills 市场
wisink

gongwen-writer

作者 Wisink · GitHub ↗ · v1.4.0 · MIT-0
cross-platform ✓ 安全检测通过
155
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install gongwen-writer
功能描述
政府公文格式文档生成器。支持所有常见文档格式输入(.md .txt .docx .pdf .html .rtf),输出符合国家标准的.docx公文格式。使用场景:产业调研报告、政策分析报告、工作报告等需要严格按照政府公文格式排版的文档。
使用说明 (SKILL.md)

公文写作技能

将多种格式文档转换为符合政府公文格式的.docx文档。

使用场景

  • 产业调研报告
  • 政策分析报告
  • 工作汇报
  • 培训材料

支持的输入格式

格式 扩展名 说明
Markdown .md 原生支持,#为大标题,##为一级标题,###为二级标题
纯文本 .txt 按行解析,通过文本模式自动判断标题层级
Word文档 .docx 通过段落样式和字号判断标题层级
PDF文档 .pdf 使用pdfminer.six提取文本,按段落分割
网页 .html .htm 使用BeautifulSoup解析,h1→标题,h2→一级标题,h3→二级标题
富文本 .rtf 使用striprtf提取文本后按段落分割

使用方法

# Markdown → .docx
python3 SKILL_DIR/scripts/convert.py \x3Cinput.md> \x3Coutput.docx>

# 纯文本 → .docx
python3 SKILL_DIR/scripts/convert.py \x3Cinput.txt> \x3Coutput.docx>

# .docx → .docx(重新格式化)
python3 SKILL_DIR/scripts/convert.py \x3Cinput.docx> \x3Coutput.docx>

# PDF → .docx
python3 SKILL_DIR/scripts/convert.py \x3Cinput.pdf> \x3Coutput.docx>

# HTML → .docx
python3 SKILL_DIR/scripts/convert.py \x3Cinput.html> \x3Coutput.docx>

# RTF → .docx
python3 SKILL_DIR/scripts/convert.py \x3Cinput.rtf> \x3Coutput.docx>

SKILL_DIR 为本技能目录的绝对路径。

格式规范

详见 references/format-rules.md

Markdown转换前预处理

Markdown文件需满足:

  1. 使用 ## 作为一级标题(对应一、二、三、)
  2. 使用 ### 作为二级标题(自动转换为(一)(二))
  3. 无加粗标记(脚本会自动去除)
  4. 无markdown链接标记(脚本会自动去除)
  5. 首行以 # 开头的为报告大标题(居中显示)
  6. 任何段落或标题的开头都不能出现"-"字符(脚本会自动去除,但请尽量避免)

脚本功能

  • 自动去除加粗标记 **...**__...__
  • 自动去除markdown链接 [text](url)
  • 自动将二级标题序号转换为中文数字((一)(二)...)
  • 每个一级标题下的二级标题独立编号
  • 段落自动首行缩进、两端对齐
  • 英文数字自动使用Times New Roman字体
  • 页码自动生成(奇数页右下、偶数页左下,格式 -数字-)
  • 落款自动右对齐排版
安全使用建议
This skill appears to do what it says: convert local documents into a government-style .docx using python-docx and some XML patching. Before installing/using: (1) review and install required Python packages (python-docx, pdfminer.six, beautifulsoup4, striprtf or equivalents) in a controlled environment; (2) inspect the remainder of scripts/convert.py (the provided file was partially truncated in the review) to confirm there are no network calls, subprocess.exec/os.system calls, or attempts to read unrelated filesystem locations; (3) run conversions on non-sensitive test documents first to verify formatting and that content isn't unintentionally modified (the script performs aggressive punctuation/format cleanup and will remove bold/links and certain characters); (4) keep originals backed up; and (5) run in an isolated environment (virtualenv or container) if you have security concerns. If you want, I can scan the remainder of convert.py (the truncated portion) for unexpected behavior or network access.
功能分析
Type: OpenClaw Skill Name: gongwen-writer Version: 1.4.0 The 'gongwen-writer' skill is a specialized document converter designed to produce Chinese government-standard .docx files from various input formats (Markdown, PDF, HTML, etc.). The core logic in `scripts/convert.py` uses standard libraries like `python-docx`, `pdfminer.six`, and `BeautifulSoup4` to parse text and apply strict formatting rules. A low-level ZIP manipulation in the `_patch_settings_even_odd` function is used to enable specific Word features (odd/even page footers) not supported by the high-level API, which is clearly documented as a technical workaround in `lessons-learned.md`. No malicious intent, data exfiltration, or suspicious execution patterns were detected.
能力评估
Purpose & Capability
Name/description (government doc .docx formatting) matches the included SKILL.md and the conversion script. The code paths and reference docs describe expected Word/OOXML manipulations (python-docx, XML patching for even/odd footers) that are appropriate for the stated goal. No unrelated credentials, binaries, or config paths are requested.
Instruction Scope
Runtime instructions only tell the agent to run the provided convert.py on local input files (md, txt, docx, pdf, html, rtf) and produce a .docx. The SKILL.md asks the agent to refer to SKILL_DIR for the script — no instructions direct reading of unrelated host files, environment variables, or transmitting data to external endpoints.
Install Mechanism
There is no install spec (instruction-only skill with one included script). The script relies on common Python libraries (docx, pdfminer.six, BeautifulSoup, striprtf) but does not pull arbitrary remote code during install. This is a low-risk installation surface; the package dependencies should be installed from normal package indexes by the operator if needed.
Credentials
The skill declares no required environment variables, credentials, or config paths. The behavior described (local file parsing and Word XML manipulation) does not require additional secrets, so requested privileges are proportionate.
Persistence & Privilege
always is false and the skill is user-invocable; it does not request persistent system presence or to modify other skills. The script writes only the output .docx and (by description) patches internal docx XML — these are expected for the functionality and do not imply elevated platform privileges.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install gongwen-writer
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /gongwen-writer 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.4.0
修复奇偶页页码:将evenAndOddHeaders同时写入sectPr和settings.xml(文档级),解决之前只在sectPr中添加不生效的问题
v1.3.0
修复5个格式问题:页码改用complex field、添加evenAndOddHeaders标签、删除多余空行、标题自动识别与去句号、标题不缩进。新增lessons-learned.md踩坑记录。
元数据
Slug gongwen-writer
版本 1.4.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

gongwen-writer 是什么?

政府公文格式文档生成器。支持所有常见文档格式输入(.md .txt .docx .pdf .html .rtf),输出符合国家标准的.docx公文格式。使用场景:产业调研报告、政策分析报告、工作报告等需要严格按照政府公文格式排版的文档。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 155 次。

如何安装 gongwen-writer?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install gongwen-writer」即可一键安装,无需额外配置。

gongwen-writer 是免费的吗?

是的,gongwen-writer 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

gongwen-writer 支持哪些平台?

gongwen-writer 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 gongwen-writer?

由 Wisink(@wisink)开发并维护,当前版本 v1.4.0。

💬 留言讨论