officecli-word-form
它能做什么
这个技能指导智能体制作人们可以填写的 Word 表单。适合人事团队、合同撰写人,以及任何需要表单、问卷或模板的人。
适用场景
- ✓当你需要员工入职或人事登记表,让人们在 Word 中填写时。
- ✓当你想要一份带有待填字段的合同或工作说明书模板时。
- ✓当你需要一份 Word 表单,且只允许编辑其中的字段时。
技能链接
https://github.com/iOfficeAI/OfficeCLI/blob/main/skills/officecli-word-form/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“能做一份可填写的 Word 入职表单吗?包含姓名、入职日期和一个是或否的复选框,其余内容全部锁定。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会在文档中添加内容控件、复选框和邮件合并字段,然后开启保护,使只有字段可以被编辑。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
OfficeCLI Word-Form Skill
This skill is INDEPENDENT, not a scene layer on docx. A form's payload — <w:sdt> controls, <w:ffData> legacy fields, <w:fldChar> mail-merge, documentProtection — is a distinct element class from docx's paragraph/heading/style primitives. Its QA is different too: docx's Delivery Gate cares about visual layout and live PAGE fields, this skill's cares about data plumbing (protection enforced / alias+tag / items injected / name ≤ 20 / no underscore anti-pattern). Reverse handoff: if the user's document has no fillable fields (report, letter, memo, thesis, proposal), route to officecli-docx or a docx scene skill — don't use this one.
BEFORE YOU START (CRITICAL)
If officecli is not installed:
macOS / Linux
if ! command -v officecli >/dev/null 2>&1; then
curl -fsSL https://d.officecli.ai/install.sh | bash
fi
Windows (PowerShell)
if (-not (Get-Command officecli -ErrorAction SilentlyContinue)) {
irm https://d.officecli.ai/install.ps1 | iex
}
Verify: officecli --version
If officecli is still not found after first install, open a new terminal and run the verify command again.
If the install command above fails (e.g. blocked by security policy, no network access, or insufficient permissions), install manually — download the binary for your platform from https://github.com/iOfficeAI/OfficeCLI/releases — then re-run the verify command.
Help-First Rule
This skill teaches what a real form needs, not every CLI flag. When a prop / alias / enum is uncertain, consult help BEFORE guessing: officecli help docx [element] [--json] (e.g. sdt, formfield, field). Help is pinned to the installed CLI version and is authoritative — when this skill and help disagree, help wins (the prop set on sdt in particular has grown over time; trust help docx sdt, not a hardcoded list).
Mental Model & Inheritance
A Word form is a .docx plus four OpenXML payload layers plain-docx skills do not touch: <w:sdt> content controls (types: text / richtext / dropdown / combobox / date / picture / group), <w:ffData> legacy FormField (still the only way to get a real checkbox — SDT type=checkbox is not implemented), <w:fldChar> complex fields (MERGEFIELD, REF, PAGEREF, SEQ, IF — template-time, not user-fill), and documentProtection (the lock that makes non-field text read-only in Word — and, on the CLI, protection=forms locks non-field content edits (those need --force or raw-set) but still allows form-field (SDT) edits, which is the point of forms protection).
No inheritance from docx v2. docx's Delivery Gate (cover-fill %, live-PAGE check) does NOT apply — form QA is view forms + query sdt alias+tag + protectionEnforced.
Reverse handoff to docx. Route back to officecli-docx for reports / letters / memos / thesis / pitch decks / any document with no editable fields. Use this skill when the document's purpose is data capture or template merge.
Shell & Execution Discipline
One command at a time. Read output before the next. OfficeCLI is incremental — every add / set / remove immediately mutates the file. All recipes below use FILE=form.docx as a shell variable.
Three shell-escape layers:
- Quote every path with
[N]— zsh/bash glob-expand brackets.officecli get "$FILE" /body/sdt[1]fails withno matches found. Correct:officecli get "$FILE" '/body/sdt[1]'. - Single-quote any prop containing
$—"Total: $50,000"becomes"Total: ,000"after$50variable expansion. Correct:'Total: $50,000'. --after find:<text>uses outer single quotes, never inner double quotes —--after find:"Client Signature:"makes the quotes part of the search string; match fails. Correct:--after 'find:Client Signature:'.
WARNING: UNSUPPORTED (exit 2) is a silently-wrong element. The CLI created the element without the rejected prop (exit 2 = ran with caveats; only when every prop is refused does --json report success: false). Any UNSUPPORTED in your build log means a prop name the current CLI does not accept on that element — stop, check help docx <element> for the right prop name (most SDT props such as items/format/lock ARE accepted now; maxlength is not), fix the command, and re-run. Do not ship on top.
protection=forms is the LAST structural command. Once it is set, protection=forms locks non-field content (tho
常见问题
什么是内容控件?
它们是 Word 中可填写的方框,例如文本字段和下拉列表,供人们填写。
表单能锁定文档的其余部分吗?
可以。技能涵盖文档保护,使只有可填写的字段可以更改。
什么时候不应使用这个技能?
技能说明,对于没有可填字段的报告或信件,应使用常规的 Word 技能。
详情
作者的原始描述
Use this skill to create fillable Word forms (.docx) with real Content Controls (SDT) + legacy FormField checkboxes + MERGEFIELD mail-merge placeholders + document protection. Trigger on: 'fillable form', 'form fields', 'content controls', 'SDT', 'word form', 'fill in', 'only editable fields', 'protect document', 'onboarding form', 'HR intake', 'survey template', 'contract / SOW template', 'mail-merge template', 'compliance checklist', 'medical intake questionnaire'. Output is a single .docx where specific fields are editable and the rest is locked. This skill is INDEPENDENT, not a scene layer
repo: iOfficeAI/OfficeCLI
热度
- GitHub 星标
- 33k
- 排名
- #9136
- 许可证
- Apache-2.0
- 更新时间
- 2026/10/30
评论
- …
同一仓库的更多技能
officecli
33k帮你的智能体用 officecli 工具创建、读取、检查和编辑 Word、Excel、PowerPoint 文件,无需安装 Office。
morph-ppt-3d
33k帮你的智能体制作带有 3D GLB 模型、并在幻灯片之间使用流畅 Morph 切换效果的 PowerPoint 演示文稿。
morph-ppt
33k帮你的智能体制作带有 Morph 流畅切换效果的 PowerPoint 文件,让形状在幻灯片之间移动、放大或旋转。
officecli-academic-paper
33k帮你的智能体把研究论文、学位论文或书稿排版成 Word 文件,包含引用、公式和期刊式版式。