Install
$ agentstack add skill-ssssliug-claude-skill-docx-cn-claude-skill-docx-cn ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ● Filesystem access Used
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
Word 文档生成(Node · 中文 · 研究向)
面向 Node-only 环境(无 Python / LibreOffice / pandoc,在 Windows + Node v24 上验证过;macOS / Linux 同理)。.docx 用 docx(npm 包名 docx,即 docx-js)。只做创建——转 PDF / 缩略图 / schema 校验等 QA 本机跑不了(要视觉预览需另装 LibreOffice)。
官方 ~/.claude/skills/docx(默认停用,文件仍在)有更全的踩坑表与 Python 脚本(校验 / 缩略图 / 模板编辑 / tracked changes / comments)。遇到复杂或排错场景,可手动 cat ~/.claude/skills/docx/SKILL.md 当字典查——它不自动加载,但内容在。配套 PPT 技能见 pptx-cn。
运行(两种方式任选)
方式 A · 本仓库装依赖(推荐,跨平台):仓库根 package.json 已列好依赖,npm install 后直接跑:
npm install
node templates/results_docx.js out.docx # 输出路径可中文
方式 B · 共享依赖 + NODEPATH(Windows / Git Bash 特有技巧):把所有 skill 的 nodemodules 集中放一处(如 ~/.claude/skills-deps/node_modules,含 docx),脚本里直接 require()、不必每个仓库各装一份。node 是原生 Windows 程序、不认 MSYS 的 ~ / /tmp 路径,必须 cygpath + NODE_PATH:
NODE_PATH=$(cygpath -w ~/.claude/skills-deps/node_modules) node 脚本.js
输出用完整 Windows 路径 C:/.../名.docx,中文路径 OK。
Word (docx-js)
const {Document,Packer,Paragraph,TextRun,HeadingLevel,Table,TableRow,TableCell,WidthType,ShadingType,AlignmentType,PageOrientation,PositionalTab,PositionalTabAlignment,PositionalTabLeader} = require('docx');
- 页面默认 A4;US Letter:
page:{size:{width:12240,height:15840}}(DXA,1440=1″);横屏传纵向尺寸 +orientation:PageOrientation.LANDSCAPE。 - 中文:每个
TextRun都带font:'Microsoft YaHei',否则默认 Calibri 掉中文;省事可在styles.default.document.run.font设一次默认字体、单处再覆盖。 - 标题用
HeadingLevel.HEADING_1/2(目录依赖它;自定义样式需设outlineLevel)。 - 表格:表级
columnWidths+ 每格width(DXA) 都要设(PERCENTAGE在 Google Docs 会坏);列宽之和等于表宽。底纹用ShadingType.CLEAR,别用SOLID(渲染成黑)。 - 列表用
numbering配LevelFormat.BULLET,别手敲•。 ImageRun必须带type:("png"/"jpg"…)。- 别用
\n,用多个Paragraph;PageBreak必须包在Paragraph里。 - 同行右对齐 + 点引导符:用
PositionalTab(alignment:PositionalTabAlignment.RIGHT,leader:PositionalTabLeader.DOT),别手敲.或空格补。 - 输出:
Packer.toBuffer(doc).then(b => fs.writeFileSync('out.docx', b))。
结果表(每列最佳值标红)
研究汇报关键是每列最佳值加粗标红。别手敲——见 templates/results_docx.js:先 num.forEach(k => best[k] = Math.max(...rows.map(r => r[k]))) 找每列 max,再在生成单元格时 isBest = Math.abs(r[k]-best[k]) < 1e-6 决定 bold + color。表头底纹用 navy 1F3A5F 配白字,自己方法那行用浅底 F4F6F7 高亮。
模板:templates/results_docx.js(标题 + 段落 + 结果表,最佳值标红)。
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: ssssliug
- Source: ssssliug/claude-skill-docx-cn
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.