国央企word文档

v1.6.0

此技能用于创建符合中国政府及央企规范的Word文档(.docx)。当用户要求创建公文、国央企文档、规范文书、正式报告等需要特定中国公文格式的文档时使用此技能。

1· 17·0 current·0 all-time
by刘洪亮Leo@a-lhliang

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for a-lhliang/gov-doc-writing.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "国央企word文档" (a-lhliang/gov-doc-writing) from ClawHub.
Skill page: https://clawhub.ai/a-lhliang/gov-doc-writing
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Canonical install target

openclaw skills install a-lhliang/gov-doc-writing

ClawHub CLI

Package manager switcher

npx clawhub@latest install gov-doc-writing
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
medium confidence
Purpose & Capability
The name/description (produce China gov/central-enterprise Word docs) align with the included JavaScript library and the declared dependency on the 'docx' package. The package.json and package-lock show only docx and its normal transitive dependencies — appropriate for .docx generation.
Instruction Scope
SKILL.md instructs the agent/user to require and call functions from the included scripts/create_gov_doc.js and to write output files locally. Examples are limited to document construction and file output. Note: example require paths use a home-directory style ('~/.workbuddy/...') which is illustrative and may not resolve in all Node environments; otherwise the instructions do not ask the agent to read unrelated system files, network endpoints, or secrets.
Install Mechanism
This is instruction-only (no platform install spec). The bundle includes package.json and package-lock that declare the 'docx' npm dependency. Running the script requires a Node environment and installing dependencies (npm install). There is no external download/install URL or arbitrary installer code in the manifest — low installation risk but the runtime dependency must be installed before use.
Credentials
The skill requests no environment variables, no credentials, and no config paths. The code shown operates on supplied content and filesystem writes only; there are no references to cloud keys, tokens, or unrelated service credentials.
Persistence & Privilege
The skill is not marked always:true and does not request elevated or persistent platform privileges. Its behavior is limited to creating and writing .docx files in the run context; nothing in the manifest indicates it modifies other skills or global agent settings.
Assessment
This skill appears coherent for generating Chinese government-style .docx documents: it uses the 'docx' library and local file writes only, and it does not ask for credentials or network access. Before running: (1) inspect the full scripts/create_gov_doc.js file yourself (the prompt view was truncated) to confirm there are no hidden network calls or exec/eval usage; (2) run it in a sandbox or isolated environment the first time; (3) ensure Node and the 'docx' dependency are installed (npm install) before executing; (4) be aware the script assumes certain Chinese fonts (e.g., 方正仿宋) which may not be present on your system — missing fonts affect appearance but not security; (5) the examples show a tilde-based require path (~/...) that may not expand in Node require calls — adjust the require path to the actual script location when using the code.

Like a lobster shell, security has layers — review code before you run it.

latestvk976vrr7m7h3jfs3mzmaaves9185kj1e
17downloads
1stars
1versions
Updated 6h ago
v1.6.0
MIT-0

国央企Work文档创建技能

本技能用于创建符合中国政府及央企规范的Word文档(.docx),使用Microsoft Word最新格式。

文档格式规范

页面设置

属性
纸张A4
上边距3.7厘米
下边距3.5厘米
左边距2.8厘米
右边距2.6厘米
页码居中显示,宋体四号

字体规范

样式中文字体西文字体字号
首页大标题方正小标宋简体 (FZXiaoBiaoSong-B05S)Times New Roman小二号 (18pt)
正文方正仿宋简体 (FZFangSong-Z02S)Times New Roman小三号 (15pt)
一级标题黑体Times New Roman小三号 (15pt)
二级标题楷体Times New Roman小三号 (15pt)
三级标题方正仿宋简体 (FZFangSong-Z02S)Times New Roman小三号 (15pt) 加粗
页码宋体-四号 (14pt)
表格方正仿宋简体 (FZFangSong-Z02S)Times New Roman小五号 (9pt)

行间距

样式行间距
首页大标题固定28磅
正文固定28磅
一级标题固定28磅
二级标题固定28磅
三级标题固定28磅
图片单倍行距
表格单倍行距

段落格式

样式序号格式首行缩进大纲级别
正文有缩进2字符-
一级的标题一、二、三、2字符1级
二级的标题(一)(二)(三)2字符2级
三级的标题1.2.3.2字符3级

样式名称

创建文档时,必须使用以下样式名称:

  • 首页大标题 - 首页大标题
  • 正文有缩进 - 正文段落
  • 一级的标题 - 一级标题
  • 二级的标题 - 二级标题
  • 三级的标题 - 三级标题
  • 图片样式 - 图片
  • 表格样式 - 表格
  • 页码样式 - 页脚页码

使用方法

方式一:使用JavaScript脚本创建文档

const {
  createDocument,
  createTitleParagraph,
  createBodyParagraph,
  createLevel1Heading,
  createLevel2Heading,
  createLevel3Heading,
  createTable,
  createImageParagraph,
  CHINESE_FONTS,
  FONT_SIZES,
  CONTENT_WIDTH,
  Packer,
  BorderStyle,
  WidthType,
  ShadingType,
  VerticalAlign,
  Paragraph,
  TextRun,
  Table,
  TableRow,
  TableCell,
  Footer,
  ImageRun,
} = require('~/.workbuddy/skills/gov-doc-writing/scripts/create_gov_doc.js');

// 创建文档
const doc = createDocument({
  title: '文档标题',
  sections: [
    // 首页大标题
    createTitleParagraph('这是文档标题'),

    // 一级标题
    createLevel1Heading('第一章', 0),  // 输出: 一、第一章
    createLevel1Heading('第二章', 1),  // 输出: 二、第二章

    // 二级标题
    createLevel2Heading('第一节', 0),  // 输出: (一)第一节
    createLevel2Heading('第二节', 1),  // 输出: (二)第二节

    // 三级标题
    createLevel3Heading('第一点', 0),  // 输出: 1.第一点
    createLevel3Heading('第二点', 1),  // 输出: 2.第二点

    // 正文
    createBodyParagraph('这是正文内容,首行自动缩进2字符。'),

    // 表格
    createTable(
      [
        { children: ['表头1', '表头2', '表头3'] },
        { children: ['内容1', '内容2', '内容3'] },
      ],
      { columnWidths: [2000, 2000, 2000] }
    ),
  ]
});

// 生成文件
Packer.toBuffer(doc).then(buffer => {
  fs.writeFileSync('output.docx', buffer);
});

方式二:使用CLI命令

node scripts/create_gov_doc.js output.docx '{
  "title": "文档标题",
  "body": [
    {"type": "heading1", "text": "第一章", "number": 0},
    {"type": "paragraph", "text": "正文内容"},
    {"type": "table", "rows": [...], "columnWidths": [2000, 2000, 2000]}
  ]
}'

表格规范

  • 表格宽度自动适应窗口(百分比100%),无需手动计算列宽
  • 列宽比例通过 columnWidths 参数控制(DXA 相对值,实际宽度自动缩放)
  • 表头:灰色底 (#D9D9D9)、加粗、居中
  • 内容:白色底、居中、小五号 (9pt) 字体
  • 边框:单线黑色
// 表格示例
const border = { style: BorderStyle.SINGLE, size: 1, color: "000000" };
const borders = { top: border, bottom: border, left: border, right: border };

// 表头行
new TableRow({
  tableHeader: true,
  children: [
    new TableCell({
      borders,
      shading: { fill: "D9D9D9", type: ShadingType.CLEAR },
      children: [new Paragraph({ children: [new TextRun({ text: "表头", bold: true })] })]
    })
  ]
});

图片规范

  • 行间距:单倍行距
  • 对齐:居中
  • 样式名称:图片样式

文档属性

  • 删除文档作者(dc:creatorlastModifiedBy 留空或不写入)
  • 在创建文档时不要设置 creator 属性,或设置为空字符串

完整示例

const fs = require('fs');
const {
  Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
  Footer, BorderStyle, WidthType, ShadingType, VerticalAlign,
  PageNumber, ImageRun, AlignmentType, HeadingLevel, LevelFormat,
  createTitleParagraph, createBodyParagraph, createLevel1Heading,
  createLevel2Heading, createLevel3Heading, createTable,
  createImageParagraph, createDocument, CHINESE_FONTS, FONT_SIZES,
  CONTENT_WIDTH, PAGE_MARGINS, LINE_SPACING_EXACT_28
} = require('~/.workbuddy/skills/gov-doc-writing/scripts/create_gov_doc.js');

// 内容构建
const sections = [
  createTitleParagraph('关于XXX工作的报告'),

  createLevel1Heading('一、基本情况', 0),
  createBodyParagraph('这里是正文内容,详细描述基本情况。'),
  createBodyParagraph('继续描述相关内容和细节。'),

  createLevel1Heading('二、主要做法', 1),
  createLevel2Heading('(一)加强组织领导', 0),
  createBodyParagraph('具体做法描述...'),
  createLevel2Heading('(二)完善制度建设', 1),
  createBodyParagraph('制度建设内容...'),

  createLevel1Heading('三、存在问题', 2),
  createBodyParagraph('当前存在以下问题:'),
  createLevel3Heading('问题一', 0),
  createBodyParagraph('问题一的具体描述。'),
  createLevel3Heading('问题二', 1),
  createBodyParagraph('问题二的具体描述。'),

  createLevel1Heading('四、下一步计划', 3),
  createBodyParagraph('针对以上问题,计划采取以下措施...'),
];

// 创建文档(不设置作者)
const doc = createDocument({
  title: '关于XXX工作的报告',
  sections
});

// 生成并保存
Packer.toBuffer(doc).then(buffer => {
  fs.writeFileSync('report.docx', buffer);
  console.log('文档已生成: report.docx');
});

注意事项

  1. 字号转换:Word中的"号"转换为半磅值(如小三号=30,小二号=36,四号=28,小五号=18)
  2. 行间距固定28磅:line值设置为560(28 × 20),lineRule设置为"exact"
  3. 首行缩进:使用 indent: { firstLine: charWidth * 2 },字符宽度约等于字号的一半
  4. 页码:仅在页脚居中显示,使用宋体四号
  5. 不要封面:文档从首页大标题开始,不创建封面页
  6. 文档作者:不设置或留空
  7. 双引号自动规范化:所有文本内容中的 ASCII 双引号 " 会自动替换为配对的中文双引号 ""\u201c/\u201d),无需手动转换

相关文件

  • scripts/create_gov_doc.js - 核心创建函数库

Comments

Loading comments...