← Back to Skills Marketplace
wisink

gongwen-writer

by Wisink · GitHub ↗ · v1.4.0 · MIT-0
cross-platform ✓ Security Clean
155
Downloads
0
Stars
0
Active Installs
2
Versions
Install in OpenClaw
/install gongwen-writer
Description
政府公文格式文档生成器。支持所有常见文档格式输入(.md .txt .docx .pdf .html .rtf),输出符合国家标准的.docx公文格式。使用场景:产业调研报告、政策分析报告、工作报告等需要严格按照政府公文格式排版的文档。
README (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字体
  • 页码自动生成(奇数页右下、偶数页左下,格式 -数字-)
  • 落款自动右对齐排版
Usage Guidance
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.
Capability Analysis
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.
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install gongwen-writer
  3. After installation, invoke the skill by name or use /gongwen-writer
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.4.0
修复奇偶页页码:将evenAndOddHeaders同时写入sectPr和settings.xml(文档级),解决之前只在sectPr中添加不生效的问题
v1.3.0
修复5个格式问题:页码改用complex field、添加evenAndOddHeaders标签、删除多余空行、标题自动识别与去句号、标题不缩进。新增lessons-learned.md踩坑记录。
Metadata
Slug gongwen-writer
Version 1.4.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 2
Frequently Asked Questions

What is gongwen-writer?

政府公文格式文档生成器。支持所有常见文档格式输入(.md .txt .docx .pdf .html .rtf),输出符合国家标准的.docx公文格式。使用场景:产业调研报告、政策分析报告、工作报告等需要严格按照政府公文格式排版的文档。 It is an AI Agent Skill for Claude Code / OpenClaw, with 155 downloads so far.

How do I install gongwen-writer?

Run "/install gongwen-writer" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is gongwen-writer free?

Yes, gongwen-writer is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does gongwen-writer support?

gongwen-writer is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created gongwen-writer?

It is built and maintained by Wisink (@wisink); the current version is v1.4.0.

💬 Comments