docx
GitHub用于创建、编辑、检查和最终确定 Microsoft Word .docx 文档。支持基于源文件或模板生成报告,进行保留格式的精确实时编辑,以及审查评论和修订,确保交付符合要求的 DOCX 文件。
Trigger Scenarios
Install
npx skills add OpenBMB/PilotDeck --skill docx -g -y
SKILL.md
Frontmatter
{
"name": "docx",
"description": "Create, edit, inspect, review, and finalize Microsoft Word .docx documents. Use for new Word documents, source- or template-based reports, precise edits that should preserve an existing file, visual or structural review, comments and tracked changes, and final DOCX delivery. Use only for .docx files, not legacy .doc, macro-enabled .docm, or live Microsoft Word control."
}
DOCX documents
Use three stages as a reasoning framework, not a fixed tool pipeline:
- Understand the request and source materials.
- Build or edit the document using the approach best suited to the task.
- Review the actual result before delivery.
The user's explicit requirements are the primary acceptance criteria. Adapt the depth of inspection, implementation, and review to the task rather than following a universal checklist.
Understand
Determine the audience, purpose, authoritative sources, required content, expected form, and what must remain unchanged. Distinguish factual sources from templates and visual references.
- Preserve source files unless replacement is explicitly requested.
- Do not invent unsupported facts, citations, dates, names, figures, or conclusions.
- When editing, preserve content, structure, and formatting the user did not ask to change.
- Inspect only the material relevant to the requested outcome. For complex sources, use direct Python,
python-docx, ZIP/XML inspection, or the optionalinspectcommand as useful.
Resolve the optional CLI once when its evidence or delivery commands help:
SKILL_ROOT={{SKILL_ROOT_SHELL}}
DOCX="$SKILL_ROOT/scripts/docx.sh"
WORKSPACE="${PILOTDECK_WORK_DIR:?PILOTDECK_WORK_DIR is required}/docx"
mkdir -p "$WORKSPACE/tmp" "$WORKSPACE/review"
bash "$DOCX" inspect --input "$INPUT_DOCX" --summary
bash "$DOCX" inspect --input "$INPUT_DOCX" --search "target phrase"
Build
Write and run task-specific Python directly. Use the complete python-docx API, lxml, direct OOXML editing, or another suitable library according to the document and requested change. Choose the script structure and implementation route that make the current task simplest and most reliable.
Keep task scripts, candidates, extracted media, reports, renders, and debugging output under PILOTDECK_WORK_DIR. Put only the requested final deliverable in the project workspace.
Prefer localized edits to reconstruction when modifying an existing document. Inspect package-sensitive features before round-tripping charts, diagrams, embedded objects, content controls, custom XML, signatures, protection, or uncommon fields. Choose a preservation strategy based on the actual document and report limitations honestly.
Follow supplied templates and explicit visual requirements. Without either, use restrained neutral presentation: readable typography, semantic headings, useful spacing, simple tables, dark text, and white pages. Do not add decorative covers, oversized titles, branding colors, heading fills, headers, footers, a TOC, or page numbers merely to appear professional.
For Word-specific behavior such as fields, revisions, comments, pagination, and renderer differences, read word-specifics.md only when relevant.
Review
Judge the document against the user's requested outcome, not whether a tool ran successfully. Choose evidence according to consequence and uncertainty:
- reread or extract final content;
- reconcile facts and figures with authoritative sources;
- compare a targeted edit with its source;
- inspect fields, comments, revisions, relationships, or package structure;
- render pages and visually inspect the pages material to the request.
The optional CLI provides facts and images, never a content-quality verdict:
bash "$DOCX" validate --input "$WORKSPACE/tmp/candidate.docx"
bash "$DOCX" render \
--input "$WORKSPACE/tmp/candidate.docx" \
--out-dir "$WORKSPACE/review/latest"
Open relevant full-size page images before making visual claims. After changing the candidate, prior images no longer describe the current document; render the new candidate if visual evidence still matters. LibreOffice rendering can reveal layout defects but may paginate or substitute fonts differently from Microsoft Word.
For a simple task, direct inspection may be enough. When correctness depends on data or sources, write a small task-specific checking script directly when it materially improves confidence.
Deliver
Publish the reviewed internal candidate through the delivery command:
bash "$DOCX" deliver \
--input "$WORKSPACE/tmp/candidate.docx" \
--out "$FINAL_DOCX"
For an edit, add --source "$INPUT_DOCX". Replace that exact source only when explicitly requested, using --source "$INPUT_DOCX" --out "$INPUT_DOCX" --replace-source; a recovery copy remains internal.
deliver checks package validity, protects the source, and publishes the final file. It does not decide whether the prose, facts, design, or requested outcome are good enough; that judgment belongs to the model's review.
Use advanced mechanical commands such as compare, annotate, finalize, and sanitize only when they directly serve the request. See optional-tools.md when one is needed.
Version History
-
2626c07
Current 2026-08-27 15:18
移除 Pillow 依赖,精简描述并澄清文档创建流程,删除过时引用,整合文档处理指南,新增可选工具说明以增强可用性。
-
98a0edf
2026-08-19 17:29
重构了工作流为理解、执行、审查三阶段;规范了 CLI 调用路径至 SKILL_ROOT;引入 scaffold/build 流程管理 Python builder;强调保护源文件及限制直接运行 python 脚本。
-
d0c4eee
2026-08-05 14:18
新增formal-report架构及图片处理规范;强化页眉页脚策略与交付流程;引入prepare命令以冻结接受清单并优化工作流隔离。
- a3d1f7c 2026-07-23 06:12


