open-knowledge-write-skill
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWriting an OpenKnowledge skill
编写OpenKnowledge Skill
You are helping the user author an Agent Skill — a file (plus
optional and ) that teaches an AI agent how to do a
recurring task. In OpenKnowledge a skill is a first-class, versioned,
installable artifact: you author it with the / skill verbs, then
it into the user's editors.
SKILL.mdreferences/scripts/writeeditinstallSkills earn their keep by being recognized at the right moment and followed
faithfully. Most of the craft is in two places: a that triggers
reliably, and a body short and concrete enough that the agent actually does what
it says. Work the stages below in order, but jump to where the user already is.
description你正在协助用户编写Agent Skill——一个文件(可附带可选的和目录),用于教授AI Agent如何完成重复性任务。在OpenKnowledge中,skill是一等公民、带版本控制且可安装的产物:你可以使用/等skill动词编写它,然后通过将其部署到用户的编辑器中。
SKILL.mdreferences/scripts/writeeditinstallSkill的核心价值在于在恰当的时机被识别并被忠实地执行。其设计技巧主要体现在两方面:一是能可靠触发的(描述),二是足够简洁具体、能让Agent准确执行的内容主体。请按以下阶段依次推进,但可直接跳至用户当前所处的阶段。
descriptionStage 1 — Capture intent and classify the skill
阶段1 — 捕捉意图并分类Skill
Gate — does this already exist? Check BEFORE you build. First list managed
skills with , then read any likely match with ;
these are the Project/Global skills OpenKnowledge already manages. Also search
the public marketplace with before
drafting when the task sounds reusable beyond this project. Each marketplace row
returns , , and ; inspect the strongest descriptions,
then import a chosen candidate with and adapt
it only if reuse is the right call. Use the Vercel skill,
, or manual skills.sh search only when the OK MCP
path is unavailable. If the user already has a skills.sh page
open, pass the full skill-page URL as , e.g.
— the
middle segment is the REPO, not a literal . Do not
run as the
default install path in this flow: import through OpenKnowledge
() so the skill lands as a real folder with
provenance, versioning, and managed fan-out; says where it goes, and
afterwards changes where it lives. Use 2-4 concrete trigger phrases from the user's request plus
the domain or tool name, then open/read the strongest candidates' descriptions
before judging. If an existing or public skill covers most of it, STOP and
recommend reuse — a near-duplicate with overlapping triggers mis-fires and
dilutes both. If a public skill is close but not exact, decide WITH the user
whether to import/adapt it into OpenKnowledge, install it outside OK with the
Skills CLI, or write a narrower companion whose explicitly hands
off to it. Build a new skill only when it is genuinely distinct. Surface the
overlap and the installed-skill plus marketplace search outcome before drafting
or writing anything. This is a disclosure gate: tell the user what you checked,
what matched, and why reuse/import/adapt/new-skill is the right next step. Never
discover overlap after the skill is written. If / skills.sh
is unreachable, say so plainly and continue with the installed-skill check.
skills({})skills({ name })skills({ query: "<2-4 trigger words>" })namesourcedescriptionimport({ source, skill: name, add: [...] })find-skillsnpx skills find <query>skills({ query })sourceimport({ source: "https://www.skills.sh/<owner>/<repo>/<skill>", add: [...] })skillsnpx skills addimport({ source, skill, add })addinstalldescriptionskills({ query })Ask only what you can't infer:
- What recurring task should this skill handle? Get one concrete example.
- Skill type, because it sets how much rigor to apply:
- Reference / technique (most skills) — "how to do X." Prose body, examples.
- Discipline — enforces a behavior the agent tends to skip under pressure (e.g. "always write a failing test first"). These need the RED baseline + pressure-testing in Stage 4–6; reference skills don't.
- Degrees of freedom (calibrate body precision to task fragility):
high (free prose — judgment tasks), medium (parameterized steps), low
(a fixed command — when any deviation breaks the result). Don't over-specify a judgment task or under-specify a fragile one.
scripts/
前置检查——是否已有同类Skill?开始构建前务必检查。 首先使用列出已管理的skill,然后通过查看可能匹配的skill;这些是OpenKnowledge已管理的项目级/全局级Skill。如果任务看起来具有跨项目复用性,在起草前还需使用搜索公开市场。每个市场条目会返回、和;查看最匹配的描述,若选择复用,可通过导入候选skill并按需调整。仅当OK MCP的路径不可用时,才使用Vercel的 skill、或手动在skills.sh搜索。如果用户已打开skills.sh页面,可将完整的skill页面URL作为传入,例如——中间段是仓库名,并非字面的。不要将作为此流程中的默认安装路径:请通过OpenKnowledge导入(),这样skill会作为带有来源追踪、版本控制和管理扩散的真实文件夹存在;参数指定部署位置,后续可通过更改其部署位置。从用户的请求中提取2-4个具体触发短语,加上领域或工具名称,然后查看最匹配候选的描述再做判断。如果已有或公开的Skill能覆盖大部分需求,请停止构建并推荐复用——重叠触发的近似重复Skill会导致误触发,降低两者的有效性。如果公开Skill接近但不完全符合需求,请与用户共同决定是将其导入/适配到OpenKnowledge、通过Skills CLI在OK外部安装,还是编写一个更窄的配套Skill,其明确指向该公开Skill。仅当需求真正独特时才构建新Skill。在起草或编写任何内容前,需告知用户检查结果、匹配项以及选择复用/导入/适配/新建Skill的原因。这是一个披露环节:务必让用户了解你检查了什么、找到了哪些匹配项,以及下一步选择的理由。绝不能在Skill编写完成后才发现重叠。如果/skills.sh无法访问,请直接告知用户,然后继续检查已安装的Skill。
skills({})skills({ name })skills({ query: "<2-4个触发词>" })namesourcedescriptionimport({ source, skill: name, add: [...] })skills({ query })find-skillsnpx skills find <query>sourceimport({ source: "https://www.skills.sh/<owner>/<repo>/<skill>", add: [...] })skillsnpx skills addimport({ source, skill, add })addinstalldescriptionskills({ query })仅询问无法推断的信息:
- 该Skill应处理何种重复性任务? 获取一个具体示例。
- Skill类型,因为它决定了所需的严谨程度:
- 参考/技巧类(大多数Skill)——“如何完成X”。主体为散文式内容,附带示例。
- 规则约束类——强制Agent在压力下容易忽略的行为(例如“始终先编写失败测试”)。这类Skill需要在阶段4-6中进行RED基线测试和压力测试;参考类Skill无需此步骤。
- 自由度(根据任务的脆弱性调整主体的精确程度):
高(自由散文——判断类任务)、中(参数化步骤)、低(固定的命令——任何偏差都会导致结果失败)。不要过度规范判断类任务,也不要对脆弱任务规范不足。
scripts/
Stage 2 — Resolve scope FIRST (never infer silently)
阶段2 — 首先确定范围(切勿默默推断)
Scope determines where the skill lives and where fans it. This is
the user's decision and has different blast radius — make it explicit.
install| Scope | Lives in | |
|---|---|---|
| Global | a real folder under your home's skill roots (e.g. | your editors, in every project |
| Project | a real folder in this repo's skill roots (e.g. | this project's editors; teammates get it on |
Default heuristic: inside an OK project and the task is specific to it → project;
"for all my work / globally" → global; otherwise ask one question. State the
choice and its consequence before writing.
范围决定了Skill的存储位置以及的扩散范围。这是用户的决策,不同选择影响范围不同——务必明确告知用户。
install| 范围 | 存储位置 | |
|---|---|---|
| 全局级 | 用户主目录下的Skill根目录中的真实文件夹(例如 | 你的编辑器,所有项目中 |
| 项目级 | 当前仓库Skill根目录中的真实文件夹(例如 | 当前项目的编辑器;团队成员执行 |
默认规则:在OK项目内且任务特定于该项目 → 项目级;“用于我的所有工作/全局” → 全局级;否则询问用户。在编写前说明选择及其后果。
Stage 3 — Plan the contents
阶段3 — 规划内容
- Body = the durable, reusable instructions — under ~500 lines. If it's
growing past that, move depth into (loaded only when needed) and point at it from the body. For a project skill the reference auto-connects in the graph either way, so a backticked
references/<topic>.mdpath is fine; use a`references/<topic>.md`wiki-link only when you want the mention to be a clickable inline link. For a global skill use a plain backtick path — global references aren't graph docs, so a wiki-link there dangles. Keep references one level deep.[[references/<topic>]] - Do NOT include: a README/CHANGELOG/QUICK_REFERENCE, install instructions for the skill itself, version histories, or anything host-specific. The skill is the instructions, not documentation about the instructions.
- For a discipline skill, plan the failure mode you're correcting and how you'll prove the skill fixes it (Stage 4).
- 主体 = 持久化、可复用的指令——不超过500行。如果内容超过此长度,请将深度内容移至(仅在需要时加载),并在主体中引用它。对于项目级Skill,无论主体如何引用,参考文件都会自动连接到知识图谱中,因此使用反引号包裹的
references/<topic>.md路径即可;仅当需要可点击的内联链接时,才使用`references/<topic>.md`维基链接。对于全局级Skill,请使用纯反引号路径——全局参考文件不属于图谱文档,维基链接会失效。参考文件保持一级深度。[[references/<topic>]] - 请勿包含:README/CHANGELOG/QUICK_REFERENCE、Skill自身的安装说明、版本历史或任何特定于宿主的内容。Skill是指令本身,而非关于指令的文档。
- 对于规则约束类Skill,规划需要纠正的失败模式以及如何证明Skill能修复该模式(阶段4)。
Stage 4 — RED baseline (discipline skills only)
阶段4 — RED基线测试(仅适用于规则约束类Skill)
Before writing the skill, run the scenario WITHOUT it and capture what the agent
does wrong — verbatim, including its rationalizations ("the test is trivial so I
skipped it"). Those rationalizations are the exact loopholes the skill body must
close. Run the scenario in a fresh agent session with the skill absent — a new
chat, a sub-agent, or a second terminal — and keep the transcript; if you have no
way to run it clean, reason through the baseline with the user instead. Skip this
stage for plain reference skills.
在编写Skill前,运行无Skill的场景并记录Agent的错误行为——逐字记录,包括其合理化解释(例如“测试太简单所以我跳过了”)。这些合理化解释正是Skill主体必须填补的漏洞。在无Skill的全新Agent会话中运行场景——新聊天、子Agent或第二个终端——并保存记录;如果无法干净地运行场景,请与用户一起推理基线情况。纯参考类Skill可跳过此阶段。
Stage 5 — Draft the skill
阶段5 — 起草Skill
Author the source with the skill verb (fs-direct; a live preview updates if a
server is running):
write({ skill: { name: "<lowercase-hyphen-name>", description: "<triggers>", body: "<markdown>", scope: "project" } })Frontmatter contract (validated on write — get it right):
- — lowercase letters, digits, hyphens; ≤64; equals the directory.
name - — ≤1024 chars, no XML tags, no
descriptionfield. See Stage 7.version - Nothing else. OK never injects its own frontmatter; bookkeeping lives in .
.ok/
Write the body as direct instructions to the agent (imperative, second person),
concrete over abstract.
Add depth files — (loaded on demand) and (shown as
text, never executed by OK) — through the skill verbs, never native /:
references/*.mdscripts/*Writecatundefined使用skill动词编写源代码(直接操作文件系统;如果服务器运行,实时预览会更新):
write({ skill: { name: "<小写连字符命名>", description: "<触发词>", body: "<markdown内容>", scope: "project" } })前置约定(编写时会验证——务必正确):
- — 小写字母、数字、连字符;长度≤64;与目录名一致。
name - — 长度≤1024字符,无XML标签,无
description字段。详见阶段7。version - 无其他内容。OK绝不会注入自身的前置内容;簿记信息存储在中。
.ok/
将主体编写为对Agent的直接指令(祈使句、第二人称),优先具体而非抽象。
通过skill动词添加深度文件——(按需加载)和(仅显示文本,OK不会执行)——切勿使用原生的/命令:
references/*.mdscripts/*Writecatundefinedwrite one or more bundle files (independent of body — no need to resend SKILL.md)
编写一个或多个捆绑文件(独立于主体——无需重新发送SKILL.md)
write({ skill: { name: "<name>", files: [{ path: "references/tiers.md", content: "..." }] } })
write({ skill: { name: "<名称>", files: [{ path: "references/tiers.md", content: "..." }] } })
surgical edit inside one bundle file (mirrors edit({ document }))
对单个捆绑文件进行精准编辑(镜像edit({ document }))
edit({ skill: { name: "<name>", file: "references/tiers.md", find: "...", replace: "..." } })
edit({ skill: { name: "<名称>", file: "references/tiers.md", find: "...", replace: "..." } })
list the bundle, then read one file (no native cat)
列出捆绑文件,然后读取单个文件(无原生cat命令)
skills({ name: "<name>" }) # → files: [{ path, kind }]
skills({ name: "<name>", file: "references/tiers.md" }) # → { path, kind, text }
skills({ name: "<名称>" }) # → 返回files: [{ path, kind }]
skills({ name: "<名称>", file: "references/tiers.md" }) # → 返回{ path, kind, text }
delete specific bundle files (omit files
to delete the whole skill)
files删除特定捆绑文件(省略files
参数可删除整个Skill)
filesdelete({ skill: { name: "<name>", files: ["references/tiers.md"] } })
Paths are skill-relative and must stay inside the skill dir (no `../`, no
absolute paths). `references/` and `scripts/` are the conventional homes and the
ones to reach for; other roots (`assets/`, a per-harness dir) are accepted
because published skills ship them and an import preserves them verbatim. Keep
references one level deep. A project `.md` reference becomes a live content doc that
auto-connects to its SKILL in the graph regardless of how the body mentions it —
a backticked `` `references/<name>.md` `` path joins the graph just like a
`[[references/<name>]]` wiki-link. Reach for a wiki-link (or
`[label](references/<name>.md)`) only when you want a clickable inline link.
Global skills are different: their references aren't graph docs, so use a plain
backtick path there — a wiki-link would dangle.delete({ skill: { name: "<名称>", files: ["references/tiers.md"] } })
路径是Skill相对路径,必须位于Skill目录内(无`../`,无绝对路径)。`references/`和`scripts/`是常规存储位置;其他根目录(`assets/`、每个工具的专属目录)也可接受,因为已发布的Skill会包含这些目录,导入时会原样保留。参考文件保持一级深度。项目级的`.md`参考文件会成为实时内容文档,无论主体如何提及,都会自动连接到其SKILL的知识图谱中——反引号包裹的`` `references/<name>.md` ``路径与`[[references/<name>]]`维基链接一样会加入图谱。仅当需要可点击的内联链接时,才使用维基链接(或`[标签](references/<name>.md)`)。全局级Skill有所不同:其参考文件不属于图谱文档,因此请使用纯反引号路径——维基链接会失效。Stage 6 — GREEN eval + refactor
阶段6 — GREEN评估与重构
Re-run the scenario WITH the skill. For a discipline skill, pressure-test:
combine 2–3 pressures (time, authority, sunk cost) and confirm the agent still
follows the rule — then patch any loophole and re-test ().
For a reference skill, confirm the agent now does the task correctly and the body
isn't longer than it needs to be. Cut anything the agent already knows.
references/pressure-testing.md使用Skill重新运行场景。对于规则约束类Skill,进行压力测试:结合2-3种压力因素(时间、权限、沉没成本),确认Agent仍遵循规则——然后修补任何漏洞并重新测试()。对于参考类Skill,确认Agent现在能正确完成任务,且主体内容没有冗余。删除Agent已知的任何内容。
references/pressure-testing.mdStage 7 — Optimize the description (this is what makes the skill fire)
阶段7 — 优化描述(这是Skill触发的关键)
The is the only thing the agent sees when deciding whether to
load the skill. Get it right ():
descriptionreferences/description-optimization.md- Triggers, not a summary. Say WHEN to use it, in the user's words and phrasings — NOT a recap of the body. Summarizing the workflow in the description makes the agent follow the description and skip the body.
- Concrete and a little pushy to fight under-triggering: name the situations, verbs, and phrasings that should activate it.
- Sanity-check against near-miss queries: phrasings that SHOULD trigger it and adjacent ones that should NOT.
descriptionreferences/description-optimization.md- 触发词,而非摘要。说明何时使用它,使用用户的语言和措辞——而非主体内容的回顾。在描述中总结工作流会导致Agent遵循描述而跳过主体。
- 具体且略带强制性,以避免触发不足:明确命名应激活Skill的场景、动词和措辞。
- 针对近似查询进行合理性检查:应该触发Skill的措辞以及不应该触发的相邻措辞。
Stage 8 — Install (choose where it's available)
阶段8 — 安装(选择可用位置)
The skill is already live for whichever agent reads the folder it was created
in — its own folder IS the skill (there is no draft state). manages
WHERE ELSE it is available, additively:
installinstall({ name: "<name>", add: ["codex", "opencode"] }) // add locations
install({ name: "<name>", remove: ["codex"] }) // remove locations
install({ name: "<name>", add: ["codex"], mode: "link" }) // ...as a symlink
install({ name: "<name>", convert: ["codex"], mode: "copy" }) // change one location's form
install({ name: "<name>", source: ".team/skills" }) // move the real folder (run alone)Location ids are editor host ids ( … ), (the
vendor-neutral hub), or a custom root path like .
claudepiagents.team/skillsWhich form a location takes. applies only to the locations the call
names — those in , or those in — and to nothing else. Omit it on
and the new location takes the form the skill already uses. There is no
skill-wide mode: installing never rewrites a location you did not name.
Changing an existing location is , which leaves membership alone; pass
every location to make them uniform.
modeaddconvertaddconvertWhat each form means. A symlink points at the source, so it cannot drift. A
copy is its own folder and refreshes automatically from the source — until
someone hand-edits it, at which point it forks and is never overwritten again.
Lifecycle. Edit with ; it routes to the source and versions
in place. There is no "uninstall everywhere" — removing every other location
still leaves the source folder loading for its agent, and a skill stops existing
only via , which removes the source and every location. Roll
a project skill back with → ; global skills are unversioned in this build. For a project skill,
commit the skill folders — they are ordinary files in git, so teammates get them
on pull.
edit({ skill })delete({ skill })history({ skill })restore_version({ skill, version })Skill在创建它的文件夹被Agent读取时就已生效——其文件夹本身就是Skill(没有草稿状态)。用于管理Skill在其他位置的可用性,是增量式操作:
installinstall({ name: "<名称>", add: ["codex", "opencode"] }) // 添加部署位置
install({ name: "<名称>", remove: ["codex"] }) // 移除部署位置
install({ name: "<名称>", add: ["codex"], mode: "link" }) // ...以符号链接形式添加
install({ name: "<名称>", convert: ["codex"], mode: "copy" }) // 转换某个位置的形式
install({ name: "<名称>", source: ".team/skills" }) // 移动真实文件夹(单独运行)位置ID是编辑器宿主ID(…)、(供应商中立中心)或自定义根路径(如)。
claudepiagents.team/skills位置的形式。仅适用于调用中指定的位置——中的位置,或中的位置——不适用于其他位置。时省略,新位置将采用Skill已使用的形式。Skill没有全局模式:安装操作不会重写未指定的位置。更改现有位置需使用,这不会改变成员关系;传入所有位置可使其形式统一。
modeaddconvertaddmodeconvert每种形式的含义。符号链接指向源文件夹,因此不会偏离。副本是独立文件夹,会自动从源文件夹刷新——除非有人手动编辑,此时它会分叉并不再被覆盖。
生命周期。使用进行编辑;它会路由到源文件夹并进行版本控制。没有“全局卸载”操作——移除所有其他位置后,源文件夹仍会被其Agent加载;只有通过才能彻底删除Skill,这会移除源文件夹和所有部署位置。项目级Skill可通过→回滚;当前版本中全局级Skill无版本控制。对于项目级Skill,提交Skill文件夹——它们是git中的普通文件,团队成员执行pull即可获取。
edit({ skill })delete({ skill })history({ skill })restore_version({ skill, version })Reminders
注意事项
- Prefer ONE good skill over many overlapping ones; split only when triggers diverge. (The Stage 1 gate is where you ENFORCE this — don't leave overlap to discover later.)
- Scope is the only placement decision — don't fold harness/format/toolchain assumptions into it, and don't bake one into the scope question's wording. You are authoring an OpenKnowledge skill: create it with — it lands as a real folder at the project's default skill home with attribution and versioning — and fan it out with
write({ skill }); don't hand-scatter copies across editor dirs, becauseinstallowns fan-out and refreshes unedited copies from the source (a hand-edited copy forks and stops refreshing). If you load this flow, author through it.install - Ground claims about how skills behave (versioning, install targets, scope semantics) in this guide or the tool descriptions — don't assert system facts from assumption.
- Avoid blanket ALWAYS/NEVER rules without a stated reason — they read as noise and get ignored. Explain the why.
- A skill that ships executable is projected verbatim into another agent's trust domain — only include scripts the user has reviewed.
scripts/
- 优先选择一个优质Skill而非多个重叠Skill;仅当触发条件不同时才拆分。(阶段1的前置检查是强制执行此规则的环节——不要留到后续才发现重叠。)
- 范围是唯一的部署决策——不要将工具/格式/工具链的假设融入其中,也不要在范围问题的措辞中隐含此类假设。你正在编写OpenKnowledge Skill:使用创建它——它会作为带有归属和版本控制的真实文件夹存放在项目的默认Skill目录中——然后通过
write({ skill })进行扩散;不要手动在编辑器目录中分散副本,因为install负责扩散并会从未编辑的副本中从源文件夹刷新(手动编辑的副本会分叉并停止刷新)。如果使用此流程,请全程遵循。install - 关于Skill行为的声明(版本控制、安装目标、范围语义)需基于本指南或工具描述——不要凭假设断言系统事实。
- 避免无理由的绝对规则(ALWAYS/NEVER)——它们会被视为噪音并被忽略。请解释原因。
- 包含可执行的Skill会被原样投影到另一个Agent的信任域中——仅包含用户已审核的脚本。
scripts/