Skill Hub · 诺亚 AI 能力中心 静态参考版

让每一个技能成为可信资产 —— 诺亚 Agent 生态的技能资产中心:统一注册、检测把关、按需复用。本站为 skill-hub.noahgroup.com 于 2026-08-21 的全量数据镜像。

镜像采集 2026-08-2166 个已发布技能18 个分类 · 3 条分发渠道含技能包 SKILL.md 全文
← 返回目录

docx

SKILL_665724895 · vv1.0 · 通用工具 · Owner:— · 发布于 2026-08-11
调用 378 下载 0 点赞 0 浏览 0
简介
专业Word处理工具,支持Markdown转Docx、内容编辑、批量替换与格式校验。
触发词
Word文档处理,创建Docx,编辑Word,提取内容,校验
分发渠道
ARK Engine
功能测试
✅ 通过 · 业务评审:✅ 通过
技能包文件
docx/.DS_Store、docx/LICENSE.txt、docx/SKILL.md、docx/scripts/__init__.py、docx/scripts/__pycache__/comment.cpython-311.pyc、docx/scripts/__pycache__/create_docx.cpython-311.pyc、docx/scripts/__pycache__/markdown_to_spec.cpython-311.pyc、docx/scripts/accept_changes.py …共86个文件
使用示例:帮我把这段Markdown转成排版精美的Word报告并替换占位信息。

SKILL.md 全文

Frontmatter

namedocx
descriptionCreate, read, edit, and verify professional Word .docx documents, including reports, memos, letters, templates, tables, images, headers, footers, comments, and tracked changes. Use for any request whose input or output is a Word document. Default to python-docx with content stored separately from code; use deterministic OOXML helpers only for features that python-docx cannot express. Never place long user prose inside JavaScript source or expose full expanded OOXML to the model.

DOCX creation, editing, and analysis

Core rule

Treat prose as data, not source code. Markdown is the default authoring format. This prevents the failure loop where quotes break generated code and the agent repeatedly rewrites the whole builder.

Path contract

Default creation workflow

1. Write document content to ./tmp/content.md. 2. Optionally write small page/design settings to ./tmp/config.json. 3. Run $SKILLS_ROOT/docx/scripts/create_docx.py; it parses Markdown into an internal Python structure and generates DOCX. 4. Validate the DOCX ZIP integrity and XML schema.
python3 "$SKILLS_ROOT/docx/scripts/create_docx.py" ./tmp/content.md ./output/output.docx
unzip -t ./output/output.docx
python3 "$SKILLS_ROOT/docx/scripts/office/validate.py" ./output/output.docx
Markdown example:
# 项目报告

一、摘要

这里是正文,“中文引号”和 "ASCII quotes" 均可直接书写。
  • 事项一
  • 事项二
:::callout 结论 建议进入下一阶段。 ::: | 项目 | 状态 | |---|---| | 设计 | 完成 |
Markdown supports headings, paragraphs, bullet/numbered lists, block quotes, :::callout, tables, images, and <!-- pagebreak -->. Optional config.json may contain document, subtitle, and accent, then run:
python3 "$SKILLS_ROOT/docx/scripts/create_docx.py" ./tmp/content.md ./output/output.docx --config ./tmp/config.json
JSON block input remains supported for compatibility, but do not use it for long prose. For layouts beyond the JSON schema, create a short workspace Python builder that imports or adapts helpers from $SKILLS_ROOT/docx/scripts/create_docx.py. Keep all prose in the data file.

Data error circuit breaker

If Markdown/config parsing fails: 1. Report the parser's exact file, line, and column. 2. Modify only the content/config file, never the working DOCX generator. 3. Retry the same error class no more than twice. 4. If it still fails, simplify the affected Markdown construct; keep prose unchanged. Never rewrite an entire JS/Python builder to fix one quotation mark.

Design rules

Editing existing documents

Use python-docx for paragraph, run, table, image, header, footer, and style edits. Apply the smallest local change and save to a new output file. For two or more mechanical text or placeholder replacements, create one manifest and run the bundled batch script. It matches logical paragraph text across split runs, checks every expected match count, and writes no output when any mapping is ambiguous. Run one compact inventory first. If it reports content controls, fields, hyperlinks, tracked changes, text boxes, or data bindings on the target, stop using the ordinary text path and switch to a bounded OOXML helper.
python3 "$SKILLS_ROOT/docx/scripts/inspect_docx.py" ./input/input.docx --output ./tmp/docx-inventory.json
{
  "edits": [
    {"find": "客户姓名:XXX", "replace": "客户姓名:张伟"},
    {"find": "报告日期:____", "replace": "报告日期:2026-07-16"},
    {"find": "旧页脚", "replace": "新页脚", "scope": "footers", "expect": 1}
  ]
}
python3 "$SKILLS_ROOT/docx/scripts/apply_text_manifest.py" ./input/input.docx --manifest ./tmp/text-edits.json --output ./output/output.docx --dry-run
python3 "$SKILLS_ROOT/docx/scripts/apply_text_manifest.py" ./input/input.docx --manifest ./tmp/text-edits.json --output ./output/output.docx
Default scope to body, mode to substring, and expect to 1. Fix a count or safety mismatch in the manifest and rerun the whole batch; do not fall back to one edit per placeholder. The script preserves unaffected run formatting for substring edits and fails closed on hyperlinks, fields, content controls, and tracked changes. Whole-paragraph edits with mixed formatting also fail unless allow_format_collapse: true is explicitly justified. Use a deterministic OOXML helper for refused targets. Do not use unpack → model reads document.xml → text replacement → repack as the default workflow. $SKILLS_ROOT/docx/scripts/office/unpack.py is only for diagnostics and advanced features. When python-docx cannot express tracked changes, comments, fields, relationships, or content controls: Available advanced helpers include:

Reading documents

Prefer python-docx or pandoc for text and structure extraction. Do not unpack merely to read prose.
pandoc --track-changes=all ./input/input.docx -o ./tmp/extracted.md

Format validation policy

No visual/LibreOffice rendering step is used. Validate structurally instead:

Final checks