hzhua/nexau-cookbook/docx-report

Claude Code and agent skill by hzhua/nexau-cookbook

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

将结构化 JSON 数据渲染为标准 Word 文档(.docx)。支持公文(通知/报告/函件/请示/批复/纪要/决定等) 和通用文档格式。当需要生成 Word 文档、输出公文、创建报告时使用此技能。

Install

npx vskill@latest install hzhua/nexau-cookbook/docx-report

SKILL.md

docx-report — Word 文档生成技能

将结构化 JSON 数据渲染为标准 .docx 文件。支持公文和通用文档。

加载本技能后,{skill_path} 指 LoadSkill("docx-report") 返回的技能文件夹路径。

首次使用

确保脚本有执行权限:

bash
chmod +x {skill_path}/scripts/build

第一次 render 会自动检测并编译 .NET 渲染引擎(约 2-3 秒),输出 ✅ 引擎编译完成 后开始渲染。后续调用直接使用缓存,无需重复编译。

💡 也可以用 {skill_path}/scripts/build warmup 提前编译,但不是必须的。

生成文档

bash
{skill_path}/scripts/build render <type> <input.json> <output.docx>

示例:

bash
{skill_path}/scripts/build render notice /tmp/data.json /tmp/output.docx

脚本会自动:

  1. 校验 JSON(检查 required 字段 + section 结构),格式不对立即报错
  2. 调用渲染引擎生成 .docx
  3. 输出 ✅ 生成完成:/tmp/output.docx (XXXX bytes)

⚠️ 关键规则

1. 只用 build render,禁止 dotnet run
bash
# ✅ 正确
{skill_path}/scripts/build render notice data.json output.docx
# ❌ 错误 → CS8802 编译冲突(多个 top-level statements 文件)
cd {skill_path}/templates && dotnet run --project GovDoc.csproj ...

build render 内部自动隔离编译(只编译 GovDocEngine.cs),避免 CS8802。

2. JSON 的 section 结构必须用 heading + level + paragraphs
json
{
"heading": "一、总体要求",
"level": 1,
"paragraphs": ["第一段正文……", "第二段正文……"],
"children": [
{ "heading": "(一)目标", "level": 2, "paragraphs": ["……"] }
]
}
❌ 错误字段名✅ 正确字段名说明
titleheadingsection 标题
contentparagraphs正文段落,且必须是字符串数组
缺少 levellevel: 1/2/3必填:1=黑体 2=楷体 3=仿宋加粗
paragraphs: "文字"paragraphs: ["文字"]必须是数组,不是字符串
3. 输出文件名用英文
bash
# ✅ /tmp/output_notice.docx
# ❌ /tmp/关于XX的通知.docx(中文在 Linux shell 下可能乱码)

可用模板类型

查看完整清单:

bash
{skill_path}/scripts/build templates

常用类型及其 required 字段:

type适用公文required 字段
notice通知/通报/公告/意见type, gov_org, doc_num, title, send_to, date, sections
report报告/公报/议案type, title, org, date, sections
letter函件type, gov_org, doc_num, title, send_to, date, sections
resolution请示/批复type, subtype, gov_org, doc_num, title, send_to, date, sections
minutes会议纪要type, gov_org, doc_num, title, meeting_info, agenda_items, date
decision决定/命令type, gov_org, doc_num, title, date
generic通用文档type, title, sections

⚠️ 不同模板的 required 字段不同。按 notice 构造的 JSON 不能用 generic 模板渲染(字段不匹配)。

其他命令

bash
{skill_path}/scripts/build templates # 查看模板清单
{skill_path}/scripts/build check-index # 校验模板索引完整性
{skill_path}/scripts/build batch <type> <input_dir> <output_dir> # 批量生成
{skill_path}/scripts/build diff <type> <old.json> <new.json> <output.docx> # 版本对比

常见错误速查

错误现象原因解决方法
首次 render 多花几秒 + 输出编译日志正常:引擎首次编译无需处理,编译完自动渲染
首次 render exit code 1编译失败(环境问题)加 `2>&1 \tail -50` 看详细错误,再重试一次
CS8802: Only one compilation unit can have top-level statements直接用了 dotnet run改用 build render
❌ 未知模板类型 'xxx'type 拼写错误或不存在执行 build templates 查看可用类型
❌ JSON 校验失败 + 详细错误列表JSON 字段名/结构不匹配按错误提示逐条修正
Word 文件 < 3KBJSON 数据结构对了但内容为空检查 paragraphs 数组是否有内容
Permission denied (exit 126)脚本缺少执行权限chmod +x {skill_path}/scripts/build
中文文件名乱码Linux shell 编码输出文件名用英文

Schema 参考文件

详细 schema 定义在技能文件夹的 schemas/ 目录下:

  • schemas/base.json — 公共定义(section、policy_ref、table 等结构在这里)
  • schemas/govdoc/<type>.json — 各公文类型的字段定义
  • schemas/general/generic.json — 通用文档

⚠️ 各类型 schema 中的 sections 字段通过 $ref 引用 base.json#/definitions/section。 构造 JSON 时以上面「section 结构」为准。

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/hzhua/nexau-cookbook/docx-report/badge)](https://verified-skill.com/skills/hzhua/nexau-cookbook/docx-report)

Something wrong with this skill or its page? Tell us.