write-skill

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Write Skill

编写Skill

This skill helps you author high-signal, maintainable Skills that reliably improve agent performance without bloating context.
It is intentionally procedural where the platform has hard constraints (frontmatter validity, invocation controls, safety) and guiding where multiple viable design strategies exist (structure, tone, degree of strictness).
A skill you write should be usable by a different agent (or a human) with no prior context—it should stand on its own.

本Skill可帮助你创作高价值、可维护的Skills,在不占用过多上下文的前提下,可靠地提升Agent性能。
对于平台存在硬性约束的场景(如前置元数据有效性、调用控制、安全规则),本Skill采用流程化指导;对于存在多种可行设计策略的场景(如结构、语气、严格程度),则提供引导式建议
你编写的Skill应能被其他Agent(或人类)直接使用,无需依赖任何前置上下文——它必须具备独立性。

Workflow overview

工作流程概述

Follow the detailed steps below. In practice, the shortest correct path is:
  1. Step 0: Identify request type (Create / Refactor / Harden / Integrate / Update).
  2. Step 2: Capture intent + define "done."
  3. Steps 3–5: Choose invocation/safety, execution model, and structure.
  4. Steps 6–8: Draft frontmatter, SKILL.md body, and supporting files (progressive disclosure).
  5. Step 10: Validate and deliver (folder tree + full contents; minimal assumptions).

请遵循以下详细步骤操作。实际操作中,最简正确流程如下:
  1. 步骤0: 确定请求类型(创建/重构/强化/集成/更新)。
  2. 步骤2: 捕捉核心意图 + 定义“完成标准”。
  3. 步骤3–5: 选择调用/安全策略、执行模型和结构模式。
  4. 步骤6–8: 编写前置元数据、SKILL.md主体内容及支持文件(渐进式披露)。
  5. 步骤10: 验证并交付成果(目录树 + 完整文件内容;尽量减少预设假设)。

Request type routing (cheat sheet)

请求类型路由速查表

Request typeDefault approachLoad (only when needed)Output expectation
Create a new skillFollow Steps 0–10
references/frontmatter-and-invocation.md
,
references/structure-patterns.md
,
references/content-patterns.md
Folder tree + full contents of each file
Refactor/harden a skillFollow Steps 0–10 with a safety lensAlso load
references/security-and-governance.md
for scripts/tool access/high-stakes
Updated files + brief "what changed and why"
Update/refactor (intent-preserving)Use the update playbookLoad:
references/updating-existing-skills.md
Update Report + updated files (all changes confirmed by user before applying)
Integrate with subagentsDecide composition (fork vs preload)Load:
references/frontmatter-and-invocation.md
(subagent composition section)
Working skill structure + correct frontmatter/task prompt
Testing strategy (only if asked)Add a minimal test planLoad:
references/testing-and-iteration.md
Test prompts + pass criteria (tests live outside the skill)

请求类型默认处理方式按需加载文件输出预期
创建新Skill遵循步骤0–10
references/frontmatter-and-invocation.md
references/structure-patterns.md
references/content-patterns.md
目录树 + 各文件完整内容
重构/强化现有Skill以安全为核心遵循步骤0–10额外加载
references/security-and-governance.md
(针对脚本/工具访问/高风险场景)
更新后的文件 + 简短的“变更内容及原因说明”
更新/重构(保留原意图)使用更新手册加载:
references/updating-existing-skills.md
更新报告 + 更新后的文件(所有变更需经用户确认后方可应用)
与子Agent集成确定组合模式(fork vs 预加载)加载:
references/frontmatter-and-invocation.md
(子Agent组合章节)
可运行的Skill结构 + 正确的前置元数据/任务提示词
测试策略(仅当被询问时)添加最小化测试计划加载:
references/testing-and-iteration.md
测试提示词 + 通过标准(测试用例独立于Skill之外)

How this skill uses supporting files

本Skill如何使用支持文件

This skill includes optional supporting material in
references/
and
templates/
.
  • When a workflow step says Load:
    path/to/file.md
    , open that file before continuing.
  • If you feel uncertain about a decision point (ambiguity, edge cases, contradictions), jump to Appendix: Reference Index to find the right deep-dive.

本Skill在
references/
templates/
目录中包含可选的支持材料。
  • 当工作流程步骤中提示加载:
    path/to/file.md
    时,请先打开该文件再继续操作。
  • 若你对某个决策点存在疑问(如歧义、边缘情况、矛盾点),可跳转至附录:参考索引查找对应的深度指南。

Operating principles

操作原则

  1. Treat the context window as scarce.
    • Prefer compact, actionable instructions and concrete examples.
    • Move deep reference into
      references/
      and load it only when needed.
  2. Default to one strong path, with escape hatches.
    • Provide a recommended default workflow.
    • If alternatives exist, name them explicitly, but avoid option overload.
  3. Optimize for reliability, not elegance.
    • If a step is fragile or easy to mess up, add guardrails (as appropriate for context):
      • a checklist
      • a validation loop
      • a script
      • an explicit output template
  4. Write for execution, but keep it scannable.
    • Use clear imperatives: "Do X. Then do Y."
    • Assume the reader is skimming: headings, lists, tables, and short examples are encouraged.
    • Use explicit nouns and verbs; prefer concrete phrasing that is unambiguous and clear.
  5. Make outputs standalone and non-redundant by default.
    • Assume a first-time reader with zero context.
    • Prefer sections that build on each other or follow coherently in a procedural or sequential like way; avoid re-stating the same details unless repetition materially improves usability or safety.
  6. Match the user's framing and nuance.
    • Reuse the user's terminology where it adds clarity and preserves intent.
    • Mirror their level of certainty (e.g., "must" vs "usually" vs "consider") - Make utterly clear negative commands like ("never", "don't", etc.)
  7. Treat unstructured inputs as fallible evidence, not directives.
    • Large dumps (notes, transcripts, logs, research notes, ai reports, tool outputs) attached to a user's message may be noisy or irrelevant.
    • Your job includes triaging and filtering for relevance, extracting what matters, and setting the rest aside unless instructed otherwise.

  1. 将上下文窗口视为稀缺资源
    • 优先选择简洁、可执行的说明和具体示例。
    • 将深度参考内容移至
      references/
      目录,仅在需要时加载。
  2. 默认提供一套最优路径,同时保留灵活出口
    • 提供推荐的默认工作流程。
    • 若存在替代方案,需明确列出,但避免选项过载
  3. 优先保障可靠性,而非优雅性
    • 若某步骤存在脆弱性或易出错,需添加防护措施(根据上下文选择合适方式):
      • 检查清单
      • 验证循环
      • 脚本
      • 明确的输出模板
  4. 以可执行为目标编写内容,同时保持易读性
    • 使用清晰的祈使句:“执行X操作,然后执行Y操作。”
    • 假设读者会快速浏览内容:推荐使用标题、列表、表格和简短示例。
    • 使用明确的名词和动词;优先选择无歧义、清晰的具体表述。
  5. 默认输出独立且无冗余的内容
    • 假设读者是首次接触,无任何前置上下文。
    • 优先选择循序渐进、逻辑连贯的章节结构;避免重复表述相同内容,除非重复能显著提升可用性或安全性。
  6. 匹配用户的表述框架和细节
    • 复用用户的术语(若能提升清晰度并保留意图)。
    • 匹配用户的确定性程度(如“必须”vs“通常”vs“建议”);明确表述否定指令(如“绝不”、“不要”等)。
  7. 将非结构化输入视为可出错的参考,而非指令
    • 用户消息中附带的大量内容(如笔记、转录稿、日志、研究报告、AI输出、工具结果)可能存在噪音或无关信息。
    • 你的职责包括筛选相关内容、提取关键信息,除非另有指示,否则可忽略无关内容。

The workflow to create or revise a skill

创建或修订Skill的工作流程

Follow these steps in order. Skip only if you have a concrete reason.
请按顺序执行以下步骤。仅当有具体理由时才可跳过步骤。

Step 0: Identify the request type

步骤0:确定请求类型

Determine which you're doing:
  • Create a new skill from scratch
  • Refactor an existing skill (shorten, restructure, split into references)
  • Harden a skill (add validations, reduce hallucinations, limit tools, prevent side effects)
  • Integrate a skill with subagents (e.g.,
    context: fork
    ,
    agent: Explore
    )
  • Update/refactor an existing skill (intent-preserving)
If updating/refactoring an existing skill:
Load:
references/updating-existing-skills.md
Critical: Before proceeding with any update work, you must complete Step 0: Full context loading from that file. This means reading:
  1. Every file in the
    write-skill/
    folder (SKILL.md + all references/ + all templates/ + all scripts/)
  2. Every file in the target skill folder
Do not skip this step. Partial context loading is the primary cause of semantic drift during updates.
Default to fidelity-preserving changes only; treat substantive/routing/tool changes as "requires author consent." When requesting author decisions, use the Decision Support Protocol in that file.
If the user request is ambiguous, ask 2–4 targeted questions by default, then proceed with reasonable assumptions and make those assumptions explicit in your output.
If the ambiguity is high or the consequences are high-stakes (routing, tool power, destructive ops), you may ask up to 5–10 questions—but keep them sharply scoped and easy to answer. If you find yourself needing many questions, prefer progressive disclosure (see below) to avoid decision fatigue.
明确你要执行的操作类型:
  • 创建: 从零开始构建新Skill
  • 重构: 优化现有Skill(缩短篇幅、调整结构、拆分至参考目录)
  • 强化: 为Skill添加验证机制、减少幻觉、限制工具使用、防止副作用
  • 集成: 将Skill与子Agent集成(如
    context: fork
    agent: Explore
  • 更新/重构(保留原意图): 更新现有Skill且不改变原作者意图
若为更新/重构现有Skill:
加载:
references/updating-existing-skills.md
关键要求: 在开始任何更新工作前,必须完成该文件中的步骤0:完整上下文加载。这意味着你需要阅读:
  1. write-skill/
    目录下的所有文件(SKILL.md + 所有references/ + 所有templates/ + 所有scripts/)
  2. 目标Skill目录下的所有文件
请勿跳过此步骤。部分上下文加载是更新过程中语义偏差的主要原因。
默认仅进行保真变更;将实质性/路由/工具变更视为“需经作者同意”的操作。当需要作者决策时,使用该文件中的决策支持协议。
若用户请求存在歧义,默认提出2–4个针对性问题,然后基于合理假设继续操作,并在输出中明确说明这些假设
若歧义程度高或后果严重(如路由、工具权限、破坏性操作),你可提出最多5–10个问题——但需确保问题聚焦且易于回答。若你发现需要提出大量问题,建议采用渐进式披露(见下文)以避免决策疲劳。

Clarification strategy (when to ask vs. when to assume)

澄清策略(何时询问vs何时假设)

Use this decision table to reduce both under-asking and over-asking:
SituationDo
Missing info that affects routing (skill triggers), tool power, side effects, or compatibility (name/invocation/arguments)Ask targeted questions before drafting (or draft a skeleton but do not "finalize" choices).
User says "whatever you think is best" / signals indifferenceProvide a specific recommendation, plus 1–2 alternatives, then ask for explicit confirmation on the non-trivial choice.
Details are low-stakes and reversible (section names, minor formatting, example wording)Use sensible defaults; list assumptions briefly so the user can correct if needed.
You anticipate >4 questionsStart with a mode selector (Quick/Custom/Guided), then ask only what that mode requires.
使用以下决策表减少询问不足或过度询问的情况:
场景操作
缺失影响路由(Skill触发条件)、工具权限副作用兼容性(名称/调用/参数)的信息在起草前提出针对性问题(或起草框架但不“确定”选择)。
用户表示“你看着办”/表现出无所谓的态度提供具体建议及1–2个替代方案,然后请求用户对非 trivial 选择进行明确确认。
细节为低风险且可逆(如章节名称、次要格式、示例措辞)使用合理默认值;简要列出假设以便用户纠正。
你预计需要提出**>4个问题**先提供模式选择器(快速/自定义/引导式),然后仅询问该模式所需的问题。

Question design checklist (when you need human input)

问题设计清单(当需要人类输入时)

When you need input from a human, make it easy to answer:
  • Offer 2–4 clearly labeled options and include a keep as-is option when appropriate.
  • Include an Other option when your options might not cover reality.
  • Put your recommended option first and label it (e.g., "(Recommended)"), with a 1–2 sentence consequence.
  • Avoid leading questions and false dichotomies ("A or B?" when C is plausible).
  • If you proceed with assumptions, clearly label them as Assumptions and provide a simple way for the user to correct them.
At the end of your output, include a Quick Reference summary that recaps all pending decisions in a scannable format (question + options + your recommendation). This lets the human respond quickly without re-reading everything.
当需要人类输入时,应让回答变得简单:
  • 提供2–4个清晰标记的选项,并在合适时包含“保持原样”选项。
  • 若你的选项可能无法覆盖所有情况,需包含“其他”选项。
  • 推荐选项放在首位并标记(如“(推荐)”),同时附上1–2句话说明后果。
  • 避免诱导性问题和虚假二分法(如当C可行时问“A或B?”)。
  • 若基于假设继续操作,需明确标记为假设,并提供用户纠正的简单方式。
在输出末尾,包含快速参考摘要,以易读格式概述所有待决策事项(问题 + 选项 + 你的建议)。这能让人类无需重新阅读全文即可快速回复。

Progressive disclosure (optional, but recommended when many decisions are pending)

渐进式披露(可选,但在存在大量待决策事项时推荐使用)

If you need more than a few clarifications, start with a single question like:
  • Quick (Recommended): Use sensible defaults; ask only critical questions.
  • Custom: Ask all configuration questions up front.
  • Guided: Step-by-step with explanations and recommendations at each step.
Then tailor follow-up questions to the chosen mode.
Suggested minimal questions:
  • What should the skill be named (or should I propose one)?
  • Is it meant to be auto-invoked by Claude, a manual command, or background knowledge?
  • Does it need to run tools / scripts, or is it purely guidance?

若你需要多个澄清,可先提出如下单一问题:
  • 快速模式(推荐): 使用合理默认值;仅询问关键问题。
  • 自定义模式: 一次性询问所有配置问题。
  • 引导模式: 分步操作,每步提供解释和建议。
然后根据所选模式调整后续问题。
建议的最小问题集:
  • Skill的名称是什么(或由我提议一个名称)?
  • 它是供Claude自动调用、作为手动命令,还是作为背景知识
  • 它是否需要运行工具/脚本,还是仅作为指导?

Step 1: Decide whether this should be a skill

步骤1:判断是否需要创建Skill

Use a skill when you need portable procedural knowledge that should load on demand.
Prefer alternatives when they fit better:
  • CLAUDE.md / AGENTS.md (project rules + setup):
    • Use for repo-specific commands, conventions, "how to work here," and evergreen constraints.
  • Subagents (specialized system prompts + tool constraints):
    • Use for isolation, parallelization, or a distinct role with different permissions.
  • Tools / MCP servers (capability extension):
    • Use when the core need is a deterministic action (send email, query DB) rather than guidance.
  • Docs / llms.txt (reference):
    • Use for comprehensive "what exists" coverage, not "what to do in practice."
If the user explicitly asked for a skill, proceed.

当你需要可按需加载的可移植流程知识时,使用Skill。
若以下替代方案更合适,优先选择:
  • CLAUDE.md / AGENTS.md(项目规则 + 设置):
    • 用于存储仓库特定命令、约定、“如何在此工作”及长期约束。
  • 子Agent(专用系统提示词 + 工具约束):
    • 用于隔离、并行处理,或具有不同权限的特定角色。
  • 工具 / MCP服务器(功能扩展):
    • 当核心需求是确定性操作(如发送邮件、查询数据库)而非指导时使用。
  • 文档 / llms.txt(参考):
    • 用于全面覆盖“现有内容”,而非“实际操作方法”。
若用户明确要求创建Skill,则继续操作。

Step 2: Capture intent and define "done-ness"

步骤2:捕捉核心意图并定义“完成标准”

Before you draft structure, capture an intent snapshot (for you, not necessarily to paste verbatim):
  • Goal: what the user wants to make repeatable
  • Audience: who will read/use the outputs (default: first-time reader with no context)
  • Constraints: safety, tools, runtime, "never do X" rules
  • Tone / modality: how strict vs flexible the instructions should be
  • Success criteria: what must be true for the skill to be "working"
Then write down (briefly):
  • Scope: what tasks the skill covers, and what it explicitly does not cover
  • Primary failure modes: what the model commonly gets wrong without this skill
If the request is high-stakes (security, production deploys, destructive ops), require a validation step.
Default output assumptions (unless the user specifies otherwise):
  • Output format is Markdown.
  • Optimize for human consumption (scannable headings, lists, tables where helpful).
Copy/paste template (optional but recommended):
md
**Intent Snapshot**
- Goal:
- Audience:
- In-scope:
- Out-of-scope:
- Constraints (tools/safety/runtime):
- Operating assumptions (tools, workflow model, platform, user intent):
- Success criteria (what "done" means):
- Primary failure modes to prevent:
- Output format expectations (if any):
- Safety posture (invocation + side-effects policy):
- Assumptions (if any):
- Open questions / pending decisions (if any):

在起草结构前,先记录意图快照(供你自己使用,无需直接粘贴):
  • 目标: 用户希望实现的可重复操作
  • 受众: 输出内容的阅读/使用者(默认:无前置上下文的首次读者)
  • 约束: 安全规则、工具限制、运行环境、“绝不允许X”规则
  • 语气/方式: 说明的严格程度vs灵活程度
  • 成功标准: Skill“完成”的判定条件
然后简要记录:
  • 范围: Skill涵盖的任务,以及明确不涵盖的任务
  • 主要失败模式: 若无此Skill,模型通常会出错的场景
若请求涉及高风险场景(如安全、生产部署、破坏性操作),需添加验证步骤。
默认输出假设(除非用户另有指定):
  • 输出格式为Markdown
  • 优化为人类可读格式(使用易读的标题、列表、表格)。
可复制的模板(可选但推荐):
md
**意图快照**
- 目标:
- 受众:
- 包含范围:
- 排除范围:
- 约束(工具/安全/运行环境):
- 操作假设(工具、工作流模型、平台、用户意图):
- 成功标准(“完成”的定义):
- 需预防的主要失败模式:
- 输出格式要求(若有):
- 安全策略(调用 + 副作用规则):
- 假设(若有):
- 未解决问题 / 待决策事项(若有):

Step 3: Choose invocation and safety posture

步骤3:选择调用方式和安全策略

Load:
references/frontmatter-and-invocation.md
If the skill includes scripts, tool access, external fetching, or high-stakes domains:
Load:
references/security-and-governance.md
Decide how the skill is invoked:
  1. Default (recommended for most skills): Claude and the user can invoke it.
  2. Manual-only command: set
    disable-model-invocation: true
    • Use when the skill has side effects or should not run opportunistically.
  3. Claude-only background knowledge: set
    user-invocable: false
    • Use when it's not meaningful as a command, but should guide behavior.
Guidance:
  • If a skill can run commands that could change state, strongly consider manual-only plus tool restrictions.

加载:
references/frontmatter-and-invocation.md
若Skill包含脚本、工具访问、外部数据获取或涉及高风险领域:
加载:
references/security-and-governance.md
确定Skill的调用方式:
  1. 默认(推荐用于大多数Skill): Claude和用户均可调用。
  2. 仅手动命令: 设置
    disable-model-invocation: true
    • 当Skill存在副作用或不应自动运行时使用。
  3. 仅Claude背景知识: 设置
    user-invocable: false
    • 当Skill不适合作为命令,但需引导行为时使用。
指导原则:
  • 若Skill可运行可能改变状态的命令,强烈建议设置为仅手动调用并添加工具限制

Step 4: Choose execution model and composition with subagents

步骤4:选择执行模型及与子Agent的组合方式

Continue using:
references/frontmatter-and-invocation.md
There are two common "skills + subagents" compositions:
A) Skill runs as an isolated subagent (
context: fork
)
  • Use when you want:
    • isolation from the main thread
    • a specialized agent type (
      Explore
      ,
      Plan
      , etc.)
    • a skill to act like a "mini-program" with a clear task prompt
  • Requires: the skill body must contain a complete task prompt.
B) Subagent preloads one or more skills (subagent frontmatter
skills:
)
  • Use when you want:
    • a persistent role agent (reviewer, planner, researcher)
    • skills to be "reference material" injected into its context
  • Note: subagents don't inherit the parent's skills automatically.
See also:
templates/SKILL.fork-task.template.md
for forked execution pattern.

继续使用:
references/frontmatter-and-invocation.md
Skill与子Agent的常见组合方式有两种:
A) Skill作为独立子Agent运行(
context: fork
  • 适用于以下场景:
    • 与主线程隔离
    • 使用专用Agent类型(如
      Explore
      Plan
      等)
    • Skill需作为具有明确任务提示词的“迷你程序”运行
  • 要求:Skill主体必须包含完整的任务提示词。
B) 子Agent预加载一个或多个Skill(子Agent前置元数据
skills:
  • 适用于以下场景:
    • 持久化角色Agent(如审核者、规划者、研究者)
    • Skill需作为“参考材料”注入上下文
  • 注意:子Agent不会自动继承父Agent的Skill。
另见:
templates/SKILL.fork-task.template.md
(用于fork执行模式)。

Step 5: Pick a structure (choose one default)

步骤5:选择结构模式(选择一种默认模式)

Load:
references/structure-patterns.md
Choose the simplest structure that can still be high-quality:
Pattern 1: Single-file skill
  • Best when it fits comfortably under the size guidance and doesn't need deep reference.
Pattern 2: SKILL.md + references/
  • Best when you need deep details sometimes (schemas, API docs, edge cases).
Pattern 3: SKILL.md + scripts/
  • Best when reliability matters and you want deterministic steps (validation, transformations).
Pattern 4: Index skill + rules/
  • Best for "many discrete rules" and prioritized playbooks.

加载:
references/structure-patterns.md
选择最简单且仍能保证高质量的结构:
模式1:单文件Skill
  • 最适合内容简洁、无需深度参考的场景。
模式2:SKILL.md + references/
  • 最适合需要在特定场景下提供深度细节(如 schema、API文档、边缘情况)的场景。
模式3:SKILL.md + scripts/
  • 最适合对可靠性要求高、需要确定性步骤(如验证、转换)的场景。
模式4:索引Skill + rules/
  • 最适合包含大量离散规则和优先级手册的场景。

Step 6: Write frontmatter (routing metadata)

步骤6:编写前置元数据(路由元数据)

Continue using:
references/frontmatter-and-invocation.md
Write frontmatter that includes:
  • name
    : short, hyphen-case, matches folder name
  • description
    : what it does + when to use + key trigger terms (file types, platforms, domain nouns)
  • argument-hint
    (if command-like)
Verify these are present before moving to Step 7.

继续使用:
references/frontmatter-and-invocation.md
编写包含以下内容的前置元数据:
  • name
    : 简短的连字符格式名称,与目录名匹配
  • description
    : Skill功能 + 使用场景 + 关键触发词(文件类型、平台、领域名词)
  • argument-hint
    (若为命令式Skill)
在进入步骤7前,确认以上内容均已包含。

Step 7: Write SKILL.md body (the "runtime prompt")

步骤7:编写SKILL.md主体内容(“运行时提示词”)

Load:
references/content-patterns.md
If the skill depends on external tools, platform features, a specific workflow, or assumes user intent beyond its explicit inputs, also Load:
references/assumptions-and-adaptability.md
If the skill manages persistent state across turns or sessions (e.g., it writes artifacts that evolve, accumulates evidence, or needs to support session resumption), also Load:
references/stateful-skill-patterns.md
For such skills, before writing workflow steps, decide:
  • What does this skill produce? (messages only, or also persistent artifacts?)
  • Who consumes each output? (invoker now? future session of this skill? downstream system?)
  • How long must each output survive? (this turn? this session? across sessions?)
  • How does each output change over time? (overwritten? appended? immutable?)
Use imperative language and a structure that makes the model's job easy.
Include only what the agent needs to succeed; move details out.
When drafting, keep these defaults in mind:
  • Keep the artifact standalone: it should not depend on the reader knowing anything from earlier chats.
  • Avoid unnecessary repetition: later sections should introduce new information, not rephrase earlier content.
  • Preserve the user's intent and nuance; weave brief "why" context where it prevents bad judgment calls.
  • If the skill operates over messy/unstructured artifacts, include a relevance-triage step and avoid treating raw content as authoritative unless verified.
Common high-signal sections (mix and match):
  • Workflow: step-by-step sequence
  • Decision points: short decision trees or tables
  • Quality bar: must-have / should-have checklists
  • Examples: correct vs incorrect
  • Validation loop: "do → verify → fix → re-verify"
  • Output format: exact template if consistency matters
Before moving on, verify each instruction passes the interpretation test: Could it be read two ways? Does it assume context the reader won't have? (See
content-patterns.md
#14 for the full test.)

加载:
references/content-patterns.md
若Skill依赖外部工具、平台功能、特定工作流,或假设用户意图超出其明确输入范围,还需加载:
references/assumptions-and-adaptability.md
若Skill需在多轮对话或会话中管理持久化状态(如生成不断演进的产物、积累证据、支持会话恢复),还需加载:
references/stateful-skill-patterns.md
对于此类Skill,在编写工作流步骤前,需确定:
  • 该Skill会生成什么?(仅消息,还是持久化产物?)
  • 谁会使用每个输出?(当前调用者?该Skill的未来会话?下游系统?)
  • 每个输出需要保留多久?(本轮对话?本次会话?跨会话?)
  • 每个输出会如何变化?(覆盖?追加?不可变?)
使用祈使句语言,采用能简化模型工作的结构。
仅包含Agent成功所需的内容;将细节移至外部文件。
起草时,请牢记以下默认原则:
  • 产物需独立:不应依赖读者了解之前的对话内容。
  • 避免不必要的重复:后续章节应引入新信息,而非重复之前的内容。
  • 保留用户的意图和细节;在必要时添加简短的“原因”上下文以防止错误判断。
  • 若Skill处理混乱/非结构化产物,需添加相关性筛选步骤,除非已验证,否则不要将原始内容视为权威。
常见高价值章节(可组合使用):
  • 工作流: 分步操作序列
  • 决策点: 简短决策树或表格
  • 质量标准: 必须满足/建议满足的检查清单
  • 示例: 正确vs错误示例
  • 验证循环: “执行→验证→修复→重新验证”
  • 输出格式: 若一致性重要,需提供精确模板
在进入下一步前,验证每条指令是否通过“歧义测试”:是否存在两种解读方式?是否假设读者具有未知上下文?(详见
content-patterns.md
第14条的完整测试方法。)

Step 8: Add supporting files (progressive disclosure)

步骤8:添加支持文件(渐进式披露)

Use supporting files for two reasons:
  • keep SKILL.md lean
  • make deep info available only when needed
Recommended:
  • Put detailed material in
    references/*.md
    .
  • Put executable utilities in
    scripts/
    .
  • Put reusable templates in
    assets/
    (or
    templates/
    if they're authoring aids).
Avoid:
  • deep chains (reference files that require chasing other references)
  • duplicating the same content across files
If you add files under
references/
or
templates/
, follow the "Use when / Priority / Impact" header standard (see Appendix) so routing stays reliable.

添加支持文件的两个原因:
  • 保持SKILL.md简洁
  • 仅在需要时提供深度信息
推荐做法:
  • 将详细材料放入
    references/*.md
  • 将可执行工具放入
    scripts/
  • 将可复用模板放入
    assets/
    (若为创作辅助工具,可放入
    templates/
    )。
避免:
  • 深层嵌套(参考文件需要跳转至其他参考文件)
  • 在多个文件中重复相同内容
若在
references/
templates/
下添加文件,请遵循“使用场景/优先级/影响”标题标准(见附录)以确保路由可靠性。

Step 9 (optional): Tests

步骤9(可选):测试

If and only if asked to come up with a testing strategy for the skill:
Load:
references/testing-and-iteration.md
Key notes:
  • Tests live outside the skill. Skills are self-contained; test harnesses are separate infrastructure (e.g. an agent execution framework)
  • Tests ≠ runtime validations. Runtime validations are instructions within the skill for the agent to verify its own outputs. Tests are deterministic scripts that validate artifacts or side effects after execution.
  • Not all skills need tests. Testing is most valuable for skills that produce structured outputs, modify files, or have clear testable pass/fail criteria.

仅当被要求为Skill制定测试策略时执行此步骤:
加载:
references/testing-and-iteration.md
关键说明:
  • 测试需独立于Skill。 Skill是自包含的;测试框架是独立的基础设施(如Agent执行框架)
  • 测试≠运行时验证。 运行时验证是Skill内部用于Agent验证自身输出的说明。测试是用于验证执行后产物或副作用的确定性脚本。
  • 并非所有Skill都需要测试。 测试对生成结构化输出、修改文件或具有明确可测试通过/失败标准的Skill最有价值。

Step 10: Deliver the output cleanly

步骤10:清晰交付输出

When asked to "write a skill," output:
  1. The folder tree
  2. The full contents of each file
  3. Minimal assumptions (clearly labeled)
If revising an existing skill, provide:
  • what you changed and why (briefly)
  • before/after structure if relevant
Keep the resulting skill(s) stateless and standalone:
  • Do not embed "change notes" or update commentary inside SKILL.md.
  • Put update commentary in your response or a separate changelog file only if requested.
Optional validation (recommended when you can):
  • If
    bun
    is available, run:
    • bun scripts/validate_skill_dir.ts path/to/skill-folder
  • If it fails, fix and rerun.
  • Treat warnings as "review required," not automatic blockers.
Final self-check (copy/paste):
  • Frontmatter has
    name
    +
    description
    and name is hyphen-case.
  • Invocation posture matches risk (manual-only for side effects).
  • SKILL.md has a default workflow + clear success criteria.
  • Output is standalone (first-time reader can execute it).
  • Any references are one-level-deep and have a "Use when / Priority / Impact" header.
  • If inputs are messy/unstructured, the skill includes a relevance-triage step.
  • If the skill is high-stakes, it includes a validation loop / stop-and-verify step.
  • Checked for ambiguous instructions that could be interpreted differently in other contexts.

当被要求“编写Skill”时,输出:
  1. 目录树
  2. 每个文件的完整内容
  3. 最小化假设(明确标记)
若修订现有Skill,需提供:
  • 变更内容及原因(简要说明)
  • 相关的前后结构对比
确保最终Skill无状态且独立
  • 不要在SKILL.md中嵌入“变更说明”或更新注释。
  • 仅在用户要求时,将更新注释放入回复或单独的变更日志文件中。
可选验证步骤(推荐,若条件允许):
  • bun
    可用,运行:
    • bun scripts/validate_skill_dir.ts path/to/skill-folder
  • 若验证失败,修复后重新运行。
  • 将警告视为“需要审核”,而非自动阻止。
最终自检清单(可复制):
  • 前置元数据包含
    name
    +
    description
    ,且name为连字符格式。
  • 调用方式与风险匹配(存在副作用时设置为仅手动调用)。
  • SKILL.md包含默认工作流 + 明确的成功标准。
  • 输出独立(首次读者可直接执行)。
  • 所有参考文件均为一级嵌套,并包含“使用场景/优先级/影响”标题。
  • 若输入为混乱/非结构化内容,Skill包含相关性筛选步骤。
  • 若Skill涉及高风险场景,包含验证循环/停止并验证步骤。
  • 检查是否存在可在其他上下文中产生歧义的说明。

Guidance vs house conventions

指导原则 vs 内部约定

This skill describes multiple valid skill structures. Skills do not need to follow a single format.
However, within this
write-skill/
skill
, we use a few house conventions to keep our own supporting files discoverable and reliable. See the appendices for the conventions and the reference index.

本Skill描述了多种有效的Skill结构。Skill无需遵循单一格式。
然而,在本
write-skill/
Skill内部
,我们使用一些内部约定来确保支持文件的可发现性和可靠性。详见附录中的约定和参考索引。

Making supporting files discoverable (optional pattern)

提升支持文件的可发现性(可选模式)

If you decide to split a skill into multiple files (e.g.,
references/
,
templates/
,
rules/
), it often helps to:
  • Add explicit pointers in the workflow ("Load:
    references/x.md
    ") at the moment the file becomes relevant
  • Give each supporting file a short "Use when / Priority / Impact" header
This is not required for all skills. Many skills should remain single-file. Use this pattern when you notice agents aren't consulting supporting material reliably.

若你决定将Skill拆分为多个文件(如
references/
templates/
rules/
),通常可采取以下做法:
  • 在工作流中添加明确的指针(“加载:
    references/x.md
    ”),在文件相关的步骤中提示加载
  • 为每个支持文件添加简短的“使用场景/优先级/影响”标题
并非所有Skill都需要这样做。许多Skill应保持单文件格式。当你发现Agent无法可靠地参考支持材料时,可使用此模式。

Appendices

附录



Appendix: Reference File Header Standard (house convention)

附录:参考文件标题标准(内部约定)

For files under
references/
and
templates/
in this skill, we add a short routing header at the top so an agent can quickly decide relevance.
Header format:
Use when: <1–3 trigger conditions>
Priority: P0 | P1 | P2
Impact: <what goes wrong if skipped>

对于本Skill中
references/
templates/
下的文件,我们在顶部添加简短的路由标题,以便Agent快速判断相关性。
标题格式:
使用场景: <1–3个触发条件>
优先级: P0 | P1 | P2
影响: <跳过此文件会导致的问题>

Appendix: Reference Index (navigation aid)

附录:参考索引(导航辅助)

This index exists to help you quickly find the right deep-dive. In the main workflow, prefer the Load: pointers.
Priority legend:
  • P0 = must for correctness/reliability of the skill-writing process
  • P1 = improves quality and consistency
  • P2 = optional depth
PathPriorityUse whenImpact if skipped
references/frontmatter-and-invocation.md
P0Writing/editing frontmatter, invocation controls, or subagent compositionSkill may not trigger correctly; wrong execution model
references/structure-patterns.md
P0Deciding folder structure (single-file vs references/ vs rules/)Poor progressive disclosure; bloated SKILL.md
references/content-patterns.md
P0Drafting SKILL.md body sectionsMissing high-signal patterns; increased hallucination risk
references/updating-existing-skills.md
P0"Update" or "refactor" requests for existing skillsIntent drift; accidental semantic changes
references/testing-and-iteration.md
P1Adding test prompts and iteration guidanceRegressions go unnoticed
references/security-and-governance.md
P1Skills with scripts, tool access, or high-stakes domainsSecurity vulnerabilities; unsafe defaults
references/assumptions-and-adaptability.md
P1Skill depends on external tools, platform capabilities, or specific execution contextImplicit assumptions baked in; silent failures in different contexts
references/stateful-skill-patterns.md
P1Skills that manage persistent state across turns or sessions (spec, research, feature dev)No guidance for artifact lifecycle, session resumption, evidence/synthesis separation
templates/SKILL.minimal.template.md
P0Starting a new single-file skillSlow start; inconsistent structure
templates/SKILL.guidelines.template.md
P1Skills that are primarily guidance/rulesMissing quality bar or examples
templates/SKILL.fork-task.template.md
P1Skills that run as isolated subagents (
context: fork
)
Incomplete task prompt; empty output
templates/SKILL.rules-index.template.md
P1Skills with many discrete rulesPoor rule organization; hard to navigate
templates/rule.template.md
P2Adding individual rules to a rules/ folderInconsistent rule format
scripts/validate_skill_dir.ts
P2Automated validation of skill directoriesManual verification only

本索引可帮助你快速找到对应的深度指南。在主工作流中,优先使用加载: 指针。
优先级说明:
  • P0 = 对Skill编写流程的正确性/可靠性至关重要
  • P1 = 提升质量和一致性
  • P2 = 可选深度内容
路径优先级使用场景跳过影响
references/frontmatter-and-invocation.md
P0编写/编辑前置元数据、调用控制或子Agent组合Skill可能无法正确触发;执行模型错误
references/structure-patterns.md
P0确定目录结构(单文件vs references/ vs rules/)渐进式披露效果差;SKILL.md过于臃肿
references/content-patterns.md
P0起草SKILL.md主体章节缺失高价值模式;幻觉风险增加
references/updating-existing-skills.md
P0现有Skill的“更新”或“重构”请求意图偏差;意外语义变更
references/testing-and-iteration.md
P1添加测试提示词和迭代指导无法发现回归问题
references/security-and-governance.md
P1包含脚本、工具访问或高风险领域的Skill安全漏洞;不安全默认值
references/assumptions-and-adaptability.md
P1Skill依赖外部工具、平台功能或特定执行上下文隐含假设;在不同上下文下出现静默失败
references/stateful-skill-patterns.md
P1在多轮对话或会话中管理持久化状态的Skill(如规格、研究、功能开发)缺乏产物生命周期、会话恢复、证据/合成分离的指导
templates/SKILL.minimal.template.md
P0启动新单文件Skill启动缓慢;结构不一致
templates/SKILL.guidelines.template.md
P1主要为指导/规则的Skill缺失质量标准或示例
templates/SKILL.fork-task.template.md
P1作为独立子Agent运行的Skill(
context: fork
任务提示词不完整;输出为空
templates/SKILL.rules-index.template.md
P1包含大量离散规则的Skill规则组织混乱;难以导航
templates/rule.template.md
P2向rules/目录添加单个规则规则格式不一致
scripts/validate_skill_dir.ts
P2自动验证Skill目录仅能手动验证

Appendix: House conventions for this skill

附录:本Skill的内部约定

  • No orphan files: If we add a file under
    references/
    or
    templates/
    , we either:
    • add a Load: pointer in the workflow where it's relevant, and/or
    • list it in the Appendix Reference Index with "Use when"
  • Headers on supporting files: Each file under
    references/
    and
    templates/
    includes a "Use when / Priority / Impact" header block.
  • Appendix for navigation, workflow for execution: The Reference Index is for scanning and maintenance; actual loading happens via Load: gates in the workflow steps.
  • 无孤立文件: 若在
    references/
    templates/
    下添加文件,需:
    • 在工作流的相关步骤中添加加载: 指针,和/或
    • 在附录参考索引中列出该文件并添加“使用场景”
  • 支持文件添加标题:
    references/
    templates/
    下的每个文件均包含“使用场景/优先级/影响”标题块。
  • 附录用于导航,工作流用于执行: 参考索引用于扫描和维护;实际加载通过工作流步骤中的加载: 触发。