oss-skill
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBuild reliable Agent Skills
构建可靠的 Agent Skills
Fix the mechanics that decide whether a skill loads, then verify that it improves the task it claims to handle. Format conformance cannot prove output quality, and model behavior is nondeterministic, so never infer reliable behavior from a validator exit code alone.
Most of what this skill fixes is mechanical, and the validator this skill ships at in its own directory names the fault precisely (R-SKL-02). It reads files, needs nothing installed, and runs on Node or Bun: . Both paths are absolute on purpose, because the script lives in this skill's installed directory and not in the repository under audit, where a bare would resolve and fail; references/hosts.md names where each host installs a skill. Run it before reading further into any repository; its output tells you which of the rules below is in play.
scripts/validate.mjsnode /path/to/oss-skill/scripts/validate.mjs /path/to/repositoryscripts/validate.mjs先修复决定 skill 能否加载的机制,再验证它是否确实改善了其声称处理的任务。格式符合规范并不能证明输出质量,而模型行为具有非确定性,因此绝不能仅凭验证器的退出代码推断其行为可靠。
此 skill 修复的大部分问题都是机械性问题,而此 skill 附带的验证器位于其自身目录中的 ,能够准确指出故障(R-SKL-02)。它只读取文件,无需安装任何依赖,可在 Node 或 Bun 上运行:。两个路径都特意使用绝对路径,因为脚本位于此 skill 的安装目录,而不是被审计的仓库中;在仓库里直接使用 会解析到错误位置并失败;references/hosts.md 会说明每个宿主将 skill 安装在何处。开始进一步读取任何仓库之前先运行它;其输出会告诉你以下哪些规则适用。
scripts/validate.mjsnode /path/to/oss-skill/scripts/validate.mjs /path/to/repositoryscripts/validate.mjsScope
范围
The SKL rules belong here: R-SKL-01 layout, R-SKL-02 specification conformance, R-SKL-03 body size, R-SKL-04 licensing, R-SKL-05 portable scripts, R-SKL-06 install paths, and R-SKL-07 focused procedures with progressive disclosure.
When exists at the repository root, read the group addressed to this skill and work from that. Each failing rule there carries the audit's evidence and that rule's text verbatim, so reading as well adds nothing. Where the file is absent, work from the request as usual.
oss-audit-report.mdCheck:STANDARD.mdNeighbouring work belongs elsewhere. Wiring the validator into CI is R-CI-02, owned by , because the rule already requires CI to run the same linter the contributing guide gives to humans, and for a skills repository that linter is the validator. Keeping every host manifest on one version is R-CHG-03, owned by . The README's install command and runnable example are R-DOC-02, and its links to the license, changelog, and contributing guide are R-DOC-03, both owned by . The sentences inside any file are R-DOC-05, owned by . Note what a repository needs and hand it to the owning skill rather than doing that work from here.
oss-cioss-changelogoss-readmeoss-writingUse for sentence-level prose and for repository documentation. This skill owns whether the skill itself has a focused trigger, an efficient procedure, conditional references, and a verification loop.
oss-writingoss-readmeSKL 规则归本 skill 处理:R-SKL-01 布局、R-SKL-02 规范符合性、R-SKL-03 正文大小、R-SKL-04 许可、R-SKL-05 可移植脚本、R-SKL-06 安装路径,以及采用渐进式披露的聚焦流程。
当仓库根目录存在 时,读取分配给本 skill 的规则组并据此工作。其中每条失败规则都附有审计证据,并逐字包含该规则的 文本,因此再读 不会增加任何信息。如果该文件不存在,则照常根据请求执行。
oss-audit-report.mdCheck:STANDARD.md相邻工作归属别处。将验证器接入 CI 属于 R-CI-02,由 负责,因为该规则本就要求 CI 运行贡献指南供人工使用的同一个 linter,而对于 skills 仓库而言,该 linter 就是验证器。让所有宿主 manifest 保持同一版本属于 R-CHG-03,由 负责。README 中的安装命令和可运行示例属于 R-DOC-02,README 中指向许可证、变更日志和贡献指南的链接属于 R-DOC-03,两者均由 负责。任何文件中的句子属于 R-DOC-05,由 负责。明确仓库还需要哪些工作,并将其移交给负责的 skill,而不是在此处完成这些工作。
oss-cioss-changelogoss-readmeoss-writing句子层面的文案使用 ,仓库文档使用 。本 skill 负责 skill 本身是否具备聚焦的触发条件、高效流程、按需引用和验证闭环。
oss-writingoss-readmeStep 1: Find every skill in the repository
步骤 1:找到仓库中的每个 skill
Locate every in the repository. Resolve symlinked directories to their target first: a repository may commit and as symlinks pointing at one real directory, and a search that follows them reports every skill two or three times.
SKILL.md.claude/skills.agents/skillsskills/Sort what you find into three cases. A that is a direct child of a top-level satisfies R-SKL-01. A reached only through a symlink to that directory is the same file and not a finding. A anywhere else is a real finding.
SKILL.mdskills/<name>/SKILL.mdSKILL.mdFix a real finding by moving the whole skill directory under , keeping its and subdirectories with it, and by pointing every host manifest that names a skills path at . Read references/hosts.md for which manifest each host reads. Moving the directory without updating the manifests trades one loading failure for another.
skills/references/assets/skills/Where a repository ships skills only as a plugin and keeps them under a nested plugin directory, say so plainly rather than moving them: that layout loads in the plugin host and fails the CLI installer, and choosing between them is the maintainer's call, not yours.
skills定位仓库中的每个 。首先将符号链接目录解析到其目标:仓库可能将 和 提交为指向同一个真实 目录的符号链接,而跟随这些链接的搜索会把每个 skill 报告两三遍。
SKILL.md.claude/skills.agents/skillsskills/将找到的内容归为三类。 如果是顶层 的直接子项,就满足 R-SKL-01。仅通过指向该目录的符号链接访问到的 是同一个文件,不构成问题。位于其他任何位置的 都是真正的问题。
SKILL.mdskills/<name>/SKILL.mdSKILL.md修复真正的问题时,将整个 skill 目录移到 下,同时保留其 和 子目录,并把所有指定 skills 路径的宿主 manifest 改为指向 。查阅 references/hosts.md,了解每个宿主会读取哪个 manifest。只移动目录而不更新 manifest,只会用一种加载失败替换另一种加载失败。
skills/references/assets/skills/如果仓库仅以 plugin 形式分发 skills,并将其保留在嵌套的 plugin 目录下,应如实说明,而不是擅自移动:该布局在 plugin 宿主中能够加载,但 CLI 安装器无法使用;二者之间的取舍应由维护者决定,而不是由你决定。
skillsStep 2: Validate against the specification (R-SKL-02)
步骤 2:对照规范进行验证(R-SKL-02)
Run the bundled validator over the repository and fix what it names:
bash
node /path/to/oss-skill/scripts/validate.mjs /path/to/repositoryIt needs Node 22 or later, or Bun, and nothing installed. It reads files: it writes nothing, spawns nothing, and makes no network call. It reports an error for every violation of R-SKL-01 through R-SKL-05, and exits 1 if any error was found. It warns in two cases, and a warning never moves the exit code. The first is a frontmatter construct it does not read, which says nothing about whether the construct is valid. The second is a value that breaks a constraint a host enforces and the specification does not; that warning names the constraint and the host, and says the specification permits the value. Read which kind you have before acting: the first asks you to check the construct with a YAML parser, and the second asks you to change a file that already conforms.
The faults come in a small set.
A name and directory mismatch means the frontmatter and the directory name differ. The specification requires them to match exactly. Decide which one is correct by looking at what already references the skill: a name in the README table, in a plugin manifest, or in another skill's prose is a name people already use. Rename the other one.
nameAn invalid name means the value breaks the character rules: 1 to 64 characters, lowercase letters, digits, and hyphens only, no leading or trailing hyphen, no consecutive hyphens. Rewrite it and rename the directory to match.
An over-long description means the field exceeds 1024 characters. Cut the parts a reader already knows, keeping both halves the field must carry: what the skill does, and when to use it. Cutting the when half to fit the limit produces a skill that validates and never triggers.
A missing required field means or is absent or empty. Both are required and neither has a default.
namedescriptionA reserved word or an XML tag is the host-constraint warning. Anthropic's platform rejects a containing "anthropic" or "claude", and rejects an XML tag in or ; the specification imposes neither, which is why these carry no rule ID and leave the exit code alone. Rename the skill and its directory together, or write the description in plain text. A skill that ships as it stands conforms to the specification and is refused on upload, so the warning is the only notice you get.
namenamedescriptionFrontmatter that fails to parse needs a YAML fix, not a guessed rewrite. Quote single-line descriptions as the repository convention. If the bundled validator warns that it cannot read a valid YAML construct such as a block scalar, check that construct with a strict YAML parser before changing it.
对仓库运行捆绑的验证器,并修复它指出的问题:
bash
node /path/to/oss-skill/scripts/validate.mjs /path/to/repository它需要 Node 22 或更高版本,或者 Bun,无需安装任何依赖。它只读取文件:不写入任何内容、不启动任何子进程,也不发起网络调用。它会报告 R-SKL-01 至 R-SKL-05 的每项违规;如果发现任何错误,则以状态码 1 退出。它会在两种情况下发出警告,而警告永远不会改变退出码。第一种情况是某种它不读取的 frontmatter 结构,这无法说明该结构是否有效。第二种情况是某个值违反了宿主强制执行、但规范并未强制的约束;此类警告会指出相关约束和宿主,并说明规范允许该值。采取行动前先确认属于哪一种:第一种要求你使用 YAML parser 检查该结构,第二种要求你修改原本已符合规范的文件。
故障种类并不多。
名称与目录不匹配,意味着 frontmatter 的 与目录名不同。规范要求两者完全一致。查看哪些现有内容引用了该 skill,即可判断哪个名称正确:README 表格、plugin manifest 或其他 skill 文案中出现的名称,已经是人们正在使用的名称。重命名另一个即可。
name名称无效,意味着该值违反字符规则:长度为 1 至 64 个字符,只能包含小写字母、数字和连字符,不得以连字符开头或结尾,也不得包含连续连字符。重写名称,并重命名目录以保持一致。
描述过长,意味着该字段超过 1024 个字符。删除读者已经知道的内容,但保留该字段必须承载的两部分:skill 做什么,以及何时使用它。为了满足长度限制而删除“何时使用”部分,会产生一个能够通过验证却永远无法触发的 skill。
缺少必填字段,意味着 或 不存在或为空。两者都是必填字段,且都没有默认值。
namedescription保留字或 XML 标签会触发宿主约束警告。Anthropic 平台会拒绝包含 "anthropic" 或 "claude" 的 ,也会拒绝 或 中的 XML 标签;规范对二者均无此限制,因此这些问题不带规则 ID,也不会改变退出码。请同步重命名 skill 及其目录,或者用纯文本重写 description。按现状分发的 skill 虽然符合规范,却会在上传时被拒绝,因此警告是你能获得的唯一提示。
namenamedescriptionfrontmatter 解析失败时,需要修复 YAML,而不是凭猜测重写。按照仓库约定,为单行 description 加引号。如果捆绑的验证器警告它无法读取某种有效 YAML 结构,例如块标量,请在修改前使用严格的 YAML parser 检查该结构。
Step 3: Bring an oversized body under the ceiling (R-SKL-03)
步骤 3:将过长的正文控制在上限以内(R-SKL-03)
Count the lines of each . Where one exceeds 500, the fix is to move material into that skill's own directory, not to compress the prose until it fits.
SKILL.mdreferences/Decide what moves by asking what the reader needs on every run against what they need only sometimes. The procedure, the decisions, and the facts that defy assumption stay in . Long tables, per-platform detail, worked examples, and anything consulted only in one branch of the work move out.
SKILL.mdName each reference file from at the point the reader would need it, and say what makes it worth opening. A pointer at the top of the file listing every reference at once loads nothing usefully, because the reader has no way to tell which one this task needs.
SKILL.mdName each file for what it contains, such as rather than , and group a set of them into directories by domain. The filename is what a reader chooses from, so a name that describes nothing costs a read to find out.
form-validation-rules.mddoc2.mdOpen every reference file over 100 lines with a table of contents listing every section it has. A reader who takes the first 100 lines of a 300-line file otherwise sees no sign that two thirds of it exists.
Keep references one level deep. A file reached through another referenced file is partially read rather than read, so nesting yields incomplete information rather than merely slow information.
统计每个 的行数。如果某个文件超过 500 行,修复方法是将相关材料移入该 skill 自己的 目录,而不是不断压缩文字直到文件勉强符合限制。
SKILL.mdreferences/判断哪些内容应移动时,比较读者每次运行都需要的内容与仅偶尔需要的内容。流程、决策以及不应凭假设推断的事实应保留在 中。长表格、各平台细节、演练示例,以及仅在工作某一分支中查阅的任何内容都应移出。
SKILL.md在读者需要的位置从 提及每个引用文件,并说明它为何值得打开查看。在文件顶部集中罗列所有引用的指引无法有效加载任何内容,因为读者无法判断当前任务需要哪一个。
SKILL.md根据文件内容命名,例如使用 而不是 ,并按领域将一组文件归入不同目录。文件名是读者选择文件时的依据,因此毫无描述性的名称会迫使读者先读取一次才能弄清楚内容。
form-validation-rules.mddoc2.md为每个超过 100 行的引用文件提供目录,列出它包含的所有章节。否则,读者读完一个 300 行文件的前 100 行时,完全不知道后面还有三分之二的内容。
引用文件保持单层深度。通过另一个被引用文件访问到的文件只会被部分读取,而不是完整读取,因此嵌套带来的是信息不完整,而不只是信息获取变慢。
Step 4: Declare the license in every skill (R-SKL-04)
步骤 4:为每个 skill 声明许可证(R-SKL-04)
Add a line to every , naming the license that applies to that skill. Use the repository license when it covers every skill. If one skill has different terms, bundle its license file inside that skill and reference the file from frontmatter. Where the evidence conflicts, stop and ask which terms apply.
license:SKILL.mdThe Agent Skills specification makes optional and accepts either a name or a bundled file reference. R-SKL-04 deliberately requires it because an installer may extract one skill directory without the repository license.
license在每个 中添加 行,写明适用于该 skill 的许可证。如果仓库许可证涵盖所有 skill,就使用该许可证。如果某个 skill 采用不同条款,则将其许可证文件捆绑在该 skill 内部,并从 frontmatter 引用该文件。如果证据相互冲突,停止操作并询问适用哪些条款。
SKILL.mdlicense:Agent Skills 规范将 设为可选字段,并接受许可证名称或捆绑文件引用。R-SKL-04 特意要求提供许可证,因为安装器可能只解压某个 skill 目录,而不会携带仓库许可证。
licenseStep 5: Keep a shipped script runnable (R-SKL-05)
步骤 5:确保分发脚本可以运行(R-SKL-05)
Where a skill ships a directory, check what its files assume. A script runs on the reader's machine, so an interpreter they lack or a dependency they cannot install fails the task the skill was invoked for.
scripts/A script file needs a shebang naming portable or ; documentation and data files under , such as a README or fixture, need no shebang. Ship JavaScript, not TypeScript, because Node 22 does not provide the type-stripping behavior this repository would need. JavaScript may import real Node built-ins or sibling files by relative path, but no package. No dependency manifest, lockfile, , runtime-specific module, or or global travels with the skill.
shnodescripts/node_modulesBunDenoThe specification permits Python, Bash, TypeScript, dependencies, and other host-supported choices. R-SKL-05 is deliberately stricter so one shipped script runs unchanged under the repository's Node 22 floor or a POSIX shell. Where a skill needs another runtime, report the conflict and let the maintainer choose rather than silently rewriting working code.
Fix a violation by rewriting the script against Node built-ins, or by moving the work into the skill's prose where an agent performs it directly.
Where the work is writing a script rather than judging one, read references/scripts.md first. It covers what R-SKL-05 does not reach: handling a failure instead of deferring it, giving every constant its reason, error messages that name what was expected, stating whether a pointer means run or read, and naming the runtime floor and every external command in place of the package list a shipped script cannot have.
如果 skill 包含 目录,检查其中文件所依赖的假设。脚本会在读者的机器上运行,因此缺少所需解释器或无法安装依赖,都会导致 skill 无法完成其被调用的任务。
scripts/脚本文件需要带有 shebang,指向可移植的 或 ; 下的文档和数据文件,例如 README 或 fixture,则不需要 shebang。应分发 JavaScript,而不是 TypeScript,因为 Node 22 不提供本仓库所需的类型剥离行为。JavaScript 可以通过相对路径导入 Node 内置模块或同级文件,但不得导入任何 package。不得随 skill 携带依赖 manifest、lockfile、、特定运行时模块,也不得携带 或 全局对象。
shnodescripts/node_modulesBunDeno规范允许使用 Python、Bash、TypeScript、依赖项以及宿主支持的其他方案。R-SKL-05 特意采用更严格的要求,以确保分发的脚本无需修改即可在仓库规定的 Node 22 最低版本或 POSIX shell 下运行。如果某个 skill 需要其他 runtime,请报告冲突并让维护者选择,而不是悄悄重写原本可用的代码。
修复违规项时,可以使用 Node 内置模块重写脚本,也可以将工作移入 skill 正文,由 Agent 直接完成。
如果当前任务是编写脚本而不是审查脚本,请先阅读 references/scripts.md。它涵盖了 R-SKL-05 未涉及的内容:显式处理失败而不是延后处理,为每个常量说明设置理由,在错误消息中写明预期内容,说明引用是供运行还是供阅读,以及由于分发脚本不能包含 package 列表,应改为注明 runtime 最低版本和每个外部命令。
Step 6: Make the procedure earn its context (R-SKL-07)
步骤 6:让流程物尽其用(R-SKL-07)
Start from real task evidence: upstream documentation, project artifacts, recurring corrections, and failure cases. Remove generic knowledge the agent already has. Keep one coherent unit of work whose output and boundary can be stated precisely.
Write the description for activation. State what outcome the skill produces and when to use it, using the language a user is likely to use. Include adjacent cases only when the skill truly handles them. Test near-miss prompts too, because a description that triggers on unrelated work wastes the whole body load.
Write the description in the third person throughout. "I can help you write a README" and "You can use this to write a README" are the two openers that go wrong, and both spend the field's opening words on the reader rather than on the trigger terms a selector matches.
Name the skill for what it does, preferring a gerund or a noun phrase, and keep one naming shape across a collection so the set reads as one product. Avoid , , , and , which name nothing a user would search for.
helperutilsdocumentsdataWrite nothing time-sensitive into a skill. A version number, a release date, or a phrase such as "currently" expires without telling anybody, and a reader copying it has no way to know. Name the documentation to re-read instead. A dated verification record is a different thing and is fine: stamps each claim with when it was checked, which tells a reader how old the evidence is rather than instructing them from it.
references/hosts.mdInside the body:
- Give a default path, not a menu of equal choices.
- Match control to risk. Prescribe fragile sequences; explain intent where several correct approaches exist.
- Keep non-obvious gotchas before the point where they cause failure.
- Name capabilities and observable evidence, not a host's tool names.
- Load a direct reference only at the branch that needs it. Do not chain references.
- Bundle a tested script only when repeated runs otherwise recreate the same deterministic logic.
- End state-changing work with validation, correction, and re-validation.
Evaluate behavior separately from format. A validator exit code says a skill loads, not that it helps. Where the work is to establish that a skill improves the task it claims, or to decide whether a change to one was worth making, read references/evaluating.md: it covers the task records, the two-session loop that keeps an author from grading their own instructions, and what the read order of the bundled files says about where the body points.
从真实任务证据出发:上游文档、项目产物、反复出现的修正以及失败案例。删除 Agent 已经具备的通用知识。保持为一个连贯的工作单元,能够精确说明其输出和边界。
围绕激活来编写 description。说明 skill 产生什么结果以及何时使用它,并采用用户可能使用的语言。只有在 skill 确实能够处理相邻场景时,才将这些场景包含在内。也要测试近似但不应触发的提示词,因为一旦 description 对无关工作产生触发,整个正文都会被浪费地加载。
始终以第三人称编写 description。"I can help you write a README" 和 "You can use this to write a README" 这两种开头都不合适,因为它们把字段开头的文字用于描述读者,而不是用于 selector 匹配的触发词。
根据 skill 所做的事情命名,优先使用动名词或名词短语,并让整个集合保持一致的命名形式,使整套 skill 读起来像一个产品。避免使用 、、 和 ,因为这些名称没有表达任何用户会搜索的内容。
helperutilsdocumentsdata不要把有时效性的内容写入 skill。版本号、发布日期或 "currently" 之类的措辞都会在无人察觉的情况下失效,而复制内容的读者无从得知。改为指明需要重新查阅的文档。带日期的验证记录则是另一回事,可以使用: 会为每项声明标注核查时间,让读者知道证据有多旧,而不是依据它向读者发出指令。
references/hosts.md在正文中:
- 给出默认路径,而不是提供一组同等选项的菜单。
- 让控制力度与风险相称。对脆弱的步骤序列作出明确规定;在存在多种正确方案时,解释意图。
- 将不明显的陷阱放在会导致故障的步骤之前。
- 说明能力和可观察证据,而不是宿主的工具名称。
- 仅在需要它的分支加载直接引用。不要串联引用。
- 只有当重复运行否则会重新实现同一套确定性逻辑时,才捆绑经过测试的脚本。
- 以验证、修正和再次验证结束会改变状态的工作。
将行为评估与格式检查分开进行。验证器的退出码表明 skill 能够加载,而不是表明它能够提供帮助。如果当前任务是验证 skill 是否确实改善了其声称处理的任务,或者判断对 skill 的某项变更是否值得,请阅读 references/evaluating.md:它涵盖了任务记录、防止作者给自己编写的指令评分的双会话循环,以及捆绑文件的阅读顺序如何表明正文应指向何处。
Step 7: Check the install path behind every claimed host
步骤 7:检查每个声明支持的宿主背后的安装路径
Read the README and the install documentation it links to, and list every host named there. For each one, find the manifest that host reads, at the path that host reads it from, or the documented command that installs without a manifest. A host with neither is an R-SKL-06 finding: either ship the manifest or stop naming the host. Do not accept a manifest at a path no host reads as evidence.
阅读 README 及其链接的安装文档,并列出其中提到的每个宿主。对于每个宿主,找到它读取的 manifest 及读取路径,或者找到无需 manifest 即可安装的文档化命令。两者皆无的宿主属于 R-SKL-06 问题:要么提供 manifest,要么不再声明支持该宿主。不能把位于任何宿主都不读取的路径中的 manifest 当作证据。
Renaming a skill breaks installs
重命名 skill 会破坏安装
A skill's name is its identity everywhere downstream: in an installer command, in a plugin manifest, in a user's local configuration, and in any other skill that names it. Renaming one to satisfy R-SKL-02 is correct and is also a breaking change for anyone who installed it.
Treat it as one. Say so when proposing the rename, and hand the changelog entry and the version decision to rather than deciding the bump here.
oss-changelogskill 的名称是它在所有下游位置的标识,包括安装命令、plugin manifest、用户的本地配置,以及任何提及它的其他 skill。为满足 R-SKL-02 而重命名 skill 是正确的,但这也会对已经安装它的用户造成破坏性变更。
应将其视为破坏性变更。提出重命名时明确说明这一点,并将变更日志条目和版本决策移交给 ,而不是在此处决定版本递增。
oss-changelogVerify, then report what you changed
验证,然后报告所做更改
Re-run the validator after every fix, not once at the end, because one edit can introduce a fault another edit was meant to clear. Then read each SKL rule's line in against the repository as it now stands, fix what fails, and start the list again. Completion is gated on both: a clean validator exit and every cited rule passing.
Check:STANDARD.mdList every skill you touched, the rule each change satisfies, and every fault the validator reported that you did not fix, with the reason. Name the rename separately from the mechanical fixes, since it is the only one with downstream cost.
每次修复后都重新运行验证器,不要只在最后运行一次,因为一处编辑可能会引入另一处编辑本要消除的问题。然后根据仓库当前状态,逐条对照 中每项 SKL 规则的 行,修复所有未通过项,并重新开始这组检查。只有同时满足以下两项条件,工作才算完成:验证器干净退出,并且所有引用规则均通过。
STANDARD.mdCheck:列出你修改的每个 skill、每项变更满足的规则,以及验证器报告但未修复的每个问题及其原因。将重命名与机械性修复分开列出,因为它是唯一具有下游成本的变化。
Upstream sources
上游来源
Use the current Agent Skills specification, creator best practices, evaluation guide, description optimization guide, and script guide. Recheck them before changing a rule because the format and host implementations continue to evolve.