References
【免费下载链接】next.jsThe React Framework项目地址: https://gitcode.com/GitHub_Trending/next/next.js
- workflow.md — prioritization, common failure patterns, resolving review threads
- local-repro.md — mode/env matching and isolation guidance
这样 Agent 加载技能入口时先获得全貌,再按需要在细节文件中深挖,避免一次性把所有诊断细节灌进上下文。 ## SKILL.md 格式:frontmatter 字段完整参考 `SKILL.md` 由 YAML frontmatter 和 Markdown 正文两部分组成。frontmatter 是最小可用形式: ```yaml --- name: my-skill description: > What this skill covers and when to use it. Include key file names, concepts, and trigger phrases so Claude can match user intent to this skill. This is the primary field Claude uses for auto-activation. ---指南同时给出了一张"受支持字段"表,强调只允许使用表内字段,未知字段会被 Claude Code 忽略:
| 字段 | 必填 | 说明 |
|---|---|---|
name | 是 | 技能名,用于$name引用和/name斜杠命令 |
description | 是 | 技能做什么、何时使用。这是 Claude 决定是否自动加载技能的依据,需包含文件名、概念和关键词 |
argument-hint | 否 | 自动补全中期望参数的提示,如'<pr-number>' |
user-invocable | 否 | 设为false可从/斜杠命令菜单中隐藏该技能 |
disable-model-invocation | 否 | 设为true可禁止 Claude 自动触发此技能 |
allowed-tools | 否 | 该技能激活时无需授权即可使用的工具列表 |
model | 否 | 该技能专用的模型覆盖 |
context | 否 | 设为fork表示在隔离子代理中执行 |
agent | 否 | 配合context: fork使用的子代理类型 |
hooks | 否 | 作用域限定在该技能生命周期内的钩子 |
在仓库真实技能中可以观察到这些字段的各种组合。authoring-skills 技能 的 frontmatter 同时使用了user-invocable: false和metadata: internal: true,表示它只对内部 Agent 维护者有意义、不出现在斜杠菜单中:
--- name: authoring-skills description: > How to create and maintain agent skills in .agents/skills/. Use when creating a new SKILL.md, writing skill descriptions, choosing frontmatter fields, or deciding what content belongs in a skill vs AGENTS.md. user-invocable: false metadata: internal: true ---另一个值得注意的观察:多个技能(如 flags、pr-status-triage、dce-edge)都携带了metadata: internal: true。该字段并未出现在指南的支持字段表中——按照"未知字段被忽略"的规则,它不参与激活逻辑,实际是团队用来标记"内部工作流技能"的约定,这提示在遵循指南字段表之外,仓库内还存在少量社区性扩展。
写好 description:自动激活的匹配面
指南将description称为"the single most important field"——Claude 用它决定是否自动加载技能。写 description 要覆盖四要素:
- 技能覆盖什么(主题,the topic);
- 何时使用(触发场景,trigger scenario);
- 技能中引用的关键文件名(如
config-shared.ts、entry-base.ts); - 用户或 Agent 可能提到的关键概念/关键词(如 "DCE"、"feature flag"、"vendored React")。
指南给出的正反示例:
# Bad: too vague, won't match well description: Helps with flags. # Good: specific, includes file names and keywords description: > How to add or modify Next.js experimental feature flags end-to-end. Use when editing config-shared.ts, config-schema.ts, define-env-plugin.ts, next-server.ts, export/worker.ts, or module.compiled.js.【免费下载链接】next.jsThe React Framework项目地址: https://gitcode.com/GitHub_Trending/next/next.js
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考