create-skill

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Create Skill Command

创建Skill指令

This command provides guidance for creating effective skills.
本指令提供创建高效Skill的指导方案。

Overview

概述

Writing skills IS Test-Driven Development applied to process documentation.
Personal skills live in agent-specific directories (
~/.claude/skills
for Claude Code,
~/.codex/skills
for Codex)
You write test cases (pressure scenarios with subagents), watch them fail (baseline behavior), write the skill (documentation), watch tests pass (agents comply), and refactor (close loopholes).
Core principle: If you didn't watch an agent fail without the skill, you don't know if the skill teaches the right thing.
REQUIRED BACKGROUND: You MUST understand Test-Driven Development before using this skill. That skill defines the fundamental RED-GREEN-REFACTOR cycle. This skill adapts TDD to documentation.
Official guidance: The Anthropic's official skill authoring best practices provided at the
/apply-anthropic-skill-best-practices
command, they enhance
prompt-engineering
skill. Use skill and the document, as they not copy but add to each other. These document provides additional patterns and guidelines that complement the TDD-focused approach in this skill.
编写Skill是将测试驱动开发(TDD)应用于流程文档的实践。
个人Skill存储在Agent专属目录中(Claude Code对应
~/.claude/skills
,Codex对应
~/.codex/skills
你需要先编写测试用例(带有子Agent的压力场景),观察测试失败(基准行为),编写Skill(文档),观察测试通过(Agent遵循要求),然后重构(填补漏洞)。
**核心原则:**如果没观察到无Skill时Agent的失败表现,你就无法确定Skill是否传递了正确的内容。
**必备背景知识:**使用本Skill前,你必须理解测试驱动开发(TDD)。TDD定义了基础的RED-GREEN-REFACTOR循环,本Skill将TDD适配到文档编写场景。
**官方指导:**Anthropic官方Skill编写最佳实践可通过
/apply-anthropic-skill-best-practices
指令获取,该实践可增强
prompt-engineering
Skill的能力。请同时使用本Skill与官方文档,二者互为补充而非重复。官方文档提供了额外的模式和指南,与本Skill中聚焦TDD的方法形成互补。

About Skills

关于Skill

Skills are modular, self-contained packages that extend Claude's capabilities by providing specialized knowledge, workflows, and tools. Think of them as "onboarding guides" for specific domains or tasks—they transform Claude from a general-purpose agent into a specialized agent equipped with procedural knowledge that no model can fully possess.
Skill是模块化、独立的包,通过提供专业知识、工作流和工具来扩展Claude的能力。可以将其视为特定领域或任务的“入门指南”——它能将Claude从通用型Agent转变为具备特定流程知识的专业Agent,而这类知识是任何模型都无法完全内置的。

What is a Skill?

什么是Skill?

A skill is a reference guide for proven techniques, patterns, or tools. Skills help future Claude instances find and apply effective approaches.
Skills are: Reusable techniques, patterns, tools, reference guides
Skills are NOT: Narratives about how you solved a problem once
Skill是经验证的技术、模式或工具的参考指南。Skill帮助后续的Claude实例找到并应用有效的解决方法。
**Skill包含:**可复用技术、模式、工具、参考指南
**Skill不包含:**单次问题解决过程的叙事内容

What Skills Provide

Skill能提供的内容

  1. Specialized workflows - Multi-step procedures for specific domains
  2. Tool integrations - Instructions for working with specific file formats or APIs
  3. Domain expertise - Company-specific knowledge, schemas, business logic
  4. Bundled resources - Scripts, references, and assets for complex and repetitive tasks
  1. 专业工作流 - 特定领域的多步骤流程
  2. 工具集成 - 特定文件格式或API的使用说明
  3. 领域专业知识 - 公司专属知识、架构、业务逻辑
  4. 捆绑资源 - 复杂重复任务所需的脚本、参考资料和资产

TDD Mapping for Skills

Skill的TDD映射

TDD ConceptSkill Creation
Test casePressure scenario with subagent
Production codeSkill document (SKILL.md)
Test fails (RED)Agent violates rule without skill (baseline)
Test passes (GREEN)Agent complies with skill present
RefactorClose loopholes while maintaining compliance
Write test firstRun baseline scenario BEFORE writing skill
Watch it failDocument exact rationalizations agent uses
Minimal codeWrite skill addressing those specific violations
Watch it passVerify agent now complies
Refactor cycleFind new rationalizations → plug → re-verify
The entire skill creation process follows RED-GREEN-REFACTOR.
TDD概念Skill创建对应动作
测试用例带Subagent的压力场景
生产代码Skill文档(SKILL.md)
测试失败(RED)无Skill时Agent违反规则(基准行为)
测试通过(GREEN)有Skill时Agent遵循要求
重构在保持合规性的前提下填补漏洞
先写测试编写Skill前先运行基准场景
观察失败记录Agent使用的具体合理化借口
最小化代码编写Skill以解决这些特定的违规问题
观察通过验证Agent现在已合规
重构循环发现新的合理化借口 → 填补漏洞 → 重新验证
整个Skill创建流程遵循RED-GREEN-REFACTOR循环。

When to Create a Skill

何时创建Skill

Create when:
  • Technique wasn't intuitively obvious to you
  • You'd reference this again across projects
  • Pattern applies broadly (not project-specific)
  • Others would benefit
Don't create for:
  • One-off solutions
  • Standard practices well-documented elsewhere
  • Project-specific conventions (put in CLAUDE.md)
创建时机:
  • 某项技术对你而言并非直观易懂
  • 你会在多个项目中反复参考该内容
  • 模式具有广泛适用性(非项目专属)
  • 其他用户也能从中受益
无需创建的情况:
  • 一次性解决方案
  • 已有完善文档记录的标准实践
  • 项目专属约定(应放入CLAUDE.md)

Skill Types

Skill类型

Technique

技术型

Concrete method with steps to follow (condition-based-waiting, root-cause-tracing)
包含具体步骤的可执行方法(如condition-based-waiting、root-cause-tracing)

Pattern

模式型

Way of thinking about problems (flatten-with-flags, test-invariants)
解决问题的思维方式(如flatten-with-flags、test-invariants)

Reference

参考型

API docs, syntax guides, tool documentation (office docs)
API文档、语法指南、工具说明(如办公文档)

Directory Structure

目录结构

skills/
  skill-name/
    SKILL.md              # Main reference (required)
    supporting-file.*     # Only if needed
Flat namespace - all skills in one searchable namespace
Separate files for:
  1. Heavy reference (100+ lines) - API docs, comprehensive syntax
  2. Reusable tools - Scripts, utilities, templates
Keep inline:
  • Principles and concepts
  • Code patterns (< 50 lines)
  • Everything else
skills/
  skill-name/
    SKILL.md              # 主参考文档(必填)
    supporting-file.*     # 仅在需要时添加
扁平命名空间 - 所有Skill都在同一个可搜索的命名空间中
单独存放的内容:
  1. 大型参考资料(100行以上)- API文档、全面语法说明
  2. 可复用工具 - 脚本、实用程序、模板
内联存放的内容:
  • 原则和概念
  • 代码模式(少于50行)
  • 其他所有内容

Anatomy of a Skill

Skill的结构

Every skill consists of a required SKILL.md file and optional bundled resources:
skill-name/
├── SKILL.md (required)
│   ├── YAML frontmatter metadata (required)
│   │   ├── name: (required)
│   │   └── description: (required)
│   └── Markdown instructions (required)
└── Bundled Resources (optional)
    ├── scripts/          - Executable code (Python/Bash/etc.)
    ├── references/       - Documentation intended to be loaded into context as needed
    └── assets/           - Files used in output (templates, icons, fonts, etc.)
每个Skill都包含必填的SKILL.md文件和可选的捆绑资源:
skill-name/
├── SKILL.md (必填)
│   ├── YAML前置元数据 (必填)
│   │   ├── name: (必填)
│   │   └── description: (必填)
│   └── Markdown说明文档 (必填)
└── 捆绑资源 (可选)
    ├── scripts/          - 可执行代码(Python/Bash等)
    ├── references/       - 按需加载到上下文的参考文档
    └── assets/           - 输出中使用的文件(模板、图标、字体等)

SKILL.md (required)

SKILL.md(必填)

Metadata Quality: The
name
and
description
in YAML frontmatter determine when Claude will use the skill. Be specific about what the skill does and when to use it. Use the third-person (e.g. "This skill should be used when..." instead of "Use this skill when...").
**元数据质量:**YAML前置元数据中的
name
description
决定了Claude何时会使用该Skill。请明确说明Skill的功能和适用场景。使用第三人称表述(例如:"当需要...时应使用本Skill"而非"当需要...时使用本Skill")。

SKILL.md Structure

SKILL.md结构

Frontmatter (YAML):
  • Only two fields supported:
    name
    and
    description
  • Max 1024 characters total
  • name
    : Use letters, numbers, and hyphens only (no parentheses, special chars)
  • description
    : Third-person, includes BOTH what it does AND when to use it
    • Start with "Use when..." to focus on triggering conditions
    • Include specific symptoms, situations, and contexts
    • Keep under 500 characters if possible
markdown
---
name: Skill-Name-With-Hyphens
description: Use when [specific triggering conditions and symptoms] - [what the skill does and how it helps, written in third person]
---
前置元数据(YAML):
  • 仅支持两个字段:
    name
    description
  • 总字符数不超过1024
  • name
    :仅使用字母、数字和连字符(不允许括号、特殊字符)
  • description
    :第三人称表述,需同时包含功能和适用场景
    • 以"Use when..."开头,聚焦触发条件
    • 包含具体的症状、场景和上下文
    • 尽可能控制在500字符以内
markdown
---
name: Skill-Name-With-Hyphens
description: Use when [具体触发条件和症状] - [Skill的功能和作用,第三人称表述]
---

Skill Name

Skill名称

Overview

概述

What is this? Core principle in 1-2 sentences.
这是什么?用1-2句话说明核心原则。

When to Use

适用场景

[Small inline flowchart IF decision non-obvious]
Bullet list with SYMPTOMS and use cases When NOT to use
[若决策逻辑不直观,可添加小型内嵌流程图]
列出症状和用例的项目符号列表 说明不适用的场景

Core Pattern (for techniques/patterns)

核心模式(针对技术/模式型Skill)

Before/after code comparison
代码前后对比

Quick Reference

快速参考

Table or bullets for scanning common operations
用于快速浏览常见操作的表格或项目符号

Implementation

实现方式

Inline code for simple patterns Link to file for heavy reference or reusable tools
简单模式的内联代码 大型参考资料或可复用工具的文件链接

Common Mistakes

常见错误

What goes wrong + fixes
可能出现的问题及解决方法

Real-World Impact (optional)

实际效果(可选)

Concrete results
undefined
具体成果
undefined

Bundled Resources (optional)

捆绑资源(可选)

Scripts (
scripts/
)
脚本(
scripts/
Executable code (Python/Bash/etc.) for tasks that require deterministic reliability or are repeatedly rewritten.
  • When to include: When the same code is being rewritten repeatedly or deterministic reliability is needed
  • Example:
    scripts/rotate_pdf.py
    for PDF rotation tasks
  • Benefits: Token efficient, deterministic, may be executed without loading into context
  • Note: Scripts may still need to be read by Claude for patching or environment-specific adjustments
用于需要确定性可靠性或重复编写的任务的可执行代码(Python/Bash等)。
  • 添加时机:当相同代码被反复编写,或需要确定性可靠性时
  • 示例
    scripts/rotate_pdf.py
    用于PDF旋转任务
  • 优势:Token效率高、确定性强,无需加载到上下文即可执行
  • 注意:Claude可能仍需读取脚本以进行补丁或环境特定调整
References (
references/
)
参考资料(
references/
Documentation and reference material intended to be loaded as needed into context to inform Claude's process and thinking.
  • When to include: For documentation that Claude should reference while working
  • Examples:
    references/finance.md
    for financial schemas,
    references/mnda.md
    for company NDA template,
    references/policies.md
    for company policies,
    references/api_docs.md
    for API specifications
  • Use cases: Database schemas, API documentation, domain knowledge, company policies, detailed workflow guides
  • Benefits: Keeps SKILL.md lean, loaded only when Claude determines it's needed
  • Best practice: If files are large (>10k words), include grep search patterns in SKILL.md
  • Avoid duplication: Information should live in either SKILL.md or references files, not both. Prefer references files for detailed information unless it's truly core to the skill—this keeps SKILL.md lean while making information discoverable without hogging the context window. Keep only essential procedural instructions and workflow guidance in SKILL.md; move detailed reference material, schemas, and examples to references files.
用于按需加载到上下文,为Claude的流程和思考提供信息的文档和参考材料。
  • 添加时机:当Claude在工作中需要参考的文档
  • 示例
    references/finance.md
    用于财务架构、
    references/mnda.md
    用于公司NDA模板、
    references/policies.md
    用于公司政策、
    references/api_docs.md
    用于API规范
  • 适用场景:数据库架构、API文档、领域知识、公司政策、详细工作流指南
  • 优势:保持SKILL.md简洁,仅在Claude判定需要时加载
  • 最佳实践:若文件较大(超过10000字),在SKILL.md中添加grep搜索模式
  • 避免重复:信息应仅存于SKILL.md或参考文件中,不可重复。除非是Skill的核心内容,否则优先将详细信息放入参考文件——这能保持SKILL.md简洁,同时让信息可被发现且不占用上下文窗口。仅在SKILL.md中保留必要的流程说明和工作流指导;将详细参考材料、架构和示例移至参考文件。
Assets (
assets/
)
资产(
assets/
Files not intended to be loaded into context, but rather used within the output Claude produces.
  • When to include: When the skill needs files that will be used in the final output
  • Examples:
    assets/logo.png
    for brand assets,
    assets/slides.pptx
    for PowerPoint templates,
    assets/frontend-template/
    for HTML/React boilerplate,
    assets/font.ttf
    for typography
  • Use cases: Templates, images, icons, boilerplate code, fonts, sample documents that get copied or modified
  • Benefits: Separates output resources from documentation, enables Claude to use files without loading them into context
无需加载到上下文,而是用于Claude生成的输出中的文件。
  • 添加时机:当Skill需要用于最终输出的文件时
  • 示例
    assets/logo.png
    用于品牌资产、
    assets/slides.pptx
    用于PowerPoint模板、
    assets/frontend-template/
    用于HTML/React模板、
    assets/font.ttf
    用于字体
  • 适用场景:模板、图片、图标、样板代码、字体、可复制或修改的示例文档
  • 优势:将输出资源与文档分离,使Claude无需加载即可使用文件

Progressive Disclosure Design Principle

渐进式披露设计原则

Skills use a three-level loading system to manage context efficiently:
  1. Metadata (name + description) - Always in context (~100 words)
  2. SKILL.md body - When skill triggers (<5k words)
  3. Bundled resources - As needed by Claude (Unlimited*)
*Unlimited because scripts can be executed without reading into context window.
Skill采用三级加载系统以高效管理上下文:
  1. 元数据(name + description) - 始终在上下文中(约100词)
  2. SKILL.md主体 - Skill触发时加载(少于5000词)
  3. 捆绑资源 - Claude按需加载(无限制*)
*无限制是因为脚本无需读取到上下文窗口即可执行。

Claude Search Optimization (CSO)

Claude搜索优化(CSO)

Critical for discovery: Future Claude needs to FIND your skill
**对发现至关重要:**未来的Claude需要能找到你的Skill

1. Rich Description Field

1. 丰富的描述字段

Purpose: Claude reads description to decide which skills to load for a given task. Make it answer: "Should I read this skill right now?"
Format: Start with "Use when..." to focus on triggering conditions, then explain what it does
Content:
  • Use concrete triggers, symptoms, and situations that signal this skill applies
  • Describe the problem (race conditions, inconsistent behavior) not language-specific symptoms (setTimeout, sleep)
  • Keep triggers technology-agnostic unless the skill itself is technology-specific
  • If skill is technology-specific, make that explicit in the trigger
  • Write in third person (injected into system prompt)
yaml
undefined
**目的:**Claude通过描述字段决定为特定任务加载哪些Skill。需明确回答:"我现在应该阅读这个Skill吗?"
**格式:**以"Use when..."开头,聚焦触发条件,然后说明功能
内容:
  • 使用具体的触发条件、症状和场景来表明Skill适用
  • 描述问题(竞态条件、不一致行为)而非特定技术症状(setTimeout、sleep)
  • 除非Skill本身是技术专属的,否则触发条件应保持技术无关
  • 若Skill是技术专属的,在触发条件中明确说明
  • 使用第三人称表述(会注入到系统提示词中)
yaml
undefined

❌ BAD: Too abstract, vague, doesn't include when to use

❌ 不佳:过于抽象、模糊,未包含适用场景

description: For async testing
description: 用于异步测试

❌ BAD: First person

❌ 不佳:第一人称表述

description: I can help you with async tests when they're flaky
description: 当异步测试不稳定时,我可以帮你解决

❌ BAD: Mentions technology but skill isn't specific to it

❌ 不佳:提及技术但Skill并非专属该技术

description: Use when tests use setTimeout/sleep and are flaky
description: 当测试使用setTimeout/sleep且不稳定时使用

✅ GOOD: Starts with "Use when", describes problem, then what it does

✅ 良好:以"Use when"开头,描述问题和功能

description: Use when tests have race conditions, timing dependencies, or pass/fail inconsistently - replaces arbitrary timeouts with condition polling for reliable async tests
description: Use when tests have race conditions, timing dependencies, or pass/fail inconsistently - replaces arbitrary timeouts with condition polling for reliable async tests

✅ GOOD: Technology-specific skill with explicit trigger

✅ 良好:技术专属Skill且触发条件明确

description: Use when using React Router and handling authentication redirects - provides patterns for protected routes and auth state management
undefined
description: Use when using React Router and handling authentication redirects - provides patterns for protected routes and auth state management
undefined

2. Keyword Coverage

2. 关键词覆盖

Use words Claude would search for:
  • Error messages: "Hook timed out", "ENOTEMPTY", "race condition"
  • Symptoms: "flaky", "hanging", "zombie", "pollution"
  • Synonyms: "timeout/hang/freeze", "cleanup/teardown/afterEach"
  • Tools: Actual commands, library names, file types
使用Claude会搜索的词汇:
  • 错误信息:"Hook timed out"、"ENOTEMPTY"、"race condition"
  • 症状:"flaky"、"hanging"、"zombie"、"pollution"
  • 同义词:"timeout/hang/freeze"、"cleanup/teardown/afterEach"
  • 工具:实际命令、库名称、文件类型

3. Descriptive Naming

3. 描述性命名

Use active voice, verb-first:
  • creating-skills
    not
    skill-creation
  • testing-skills-with-subagents
    not
    subagent-skill-testing
使用主动语态,动词开头:
  • creating-skills
    而非
    skill-creation
  • testing-skills-with-subagents
    而非
    subagent-skill-testing

4. Token Efficiency (Critical)

4. Token效率(至关重要)

Problem: getting-started and frequently-referenced skills load into EVERY conversation. Every token counts.
Target word counts:
  • getting-started workflows: <150 words each
  • Frequently-loaded skills: <200 words total
  • Other skills: <500 words (still be concise)
Techniques:
Move details to tool help:
bash
undefined
**问题:**入门级和频繁引用的Skill会加载到每一次对话中,每个Token都很关键。
目标字数:
  • 入门工作流:每个少于150词
  • 频繁加载的Skill:总字数少于200词
  • 其他Skill:少于500词(仍需保持简洁)
技巧:
将细节移至工具帮助:
bash
undefined

❌ BAD: Document all flags in SKILL.md

❌ 不佳:在SKILL.md中记录所有标志

search-conversations supports --text, --both, --after DATE, --before DATE, --limit N
search-conversations supports --text, --both, --after DATE, --before DATE, --limit N

✅ GOOD: Reference --help

✅ 良好:参考--help

search-conversations supports multiple modes and filters. Run --help for details.

**Use cross-references:**

```markdown
search-conversations supports multiple modes and filters. Run --help for details.

**使用交叉引用:**

```markdown

❌ BAD: Repeat workflow details

❌ 不佳:重复工作流细节

When searching, dispatch subagent with template... [20 lines of repeated instructions]
搜索时,使用模板调度子Agent... [20行重复说明]

✅ GOOD: Reference other skill

✅ 良好:引用其他Skill

Always use subagents (50-100x context savings). REQUIRED: Use [other-skill-name] for workflow.

**Compress examples:**

```markdown
Always use subagents (50-100x context savings). REQUIRED: Use [other-skill-name] for workflow.

**压缩示例:**

```markdown

❌ BAD: Verbose example (42 words)

❌ 不佳:冗长示例(42词)

your human partner: "How did we handle authentication errors in React Router before?" You: I'll search past conversations for React Router authentication patterns. [Dispatch subagent with search query: "React Router authentication error handling 401"]
your human partner: "How did we handle authentication errors in React Router before?" You: I'll search past conversations for React Router authentication patterns. [Dispatch subagent with search query: "React Router authentication error handling 401"]

✅ GOOD: Minimal example (20 words)

✅ 良好:极简示例(20词)

Partner: "How did we handle auth errors in React Router?" You: Searching... [Dispatch subagent → synthesis]

**Eliminate redundancy:**

- Don't repeat what's in cross-referenced skills
- Don't explain what's obvious from command
- Don't include multiple examples of same pattern

**Verification:**

```bash
wc -w skills/path/SKILL.md
Partner: "How did we handle auth errors in React Router?" You: Searching... [Dispatch subagent → synthesis]

**消除冗余:**

- 不要重复交叉引用Skill中的内容
- 不要解释从命令中可明显得知的信息
- 不要包含同一模式的多个示例

**验证:**

```bash
wc -w skills/path/SKILL.md

getting-started workflows: aim for <150 each

入门工作流:目标少于150词

Other frequently-loaded: aim for <200 total

其他频繁加载的Skill:目标总字数少于200词


**Name by what you DO or core insight:**

- ✅ `condition-based-waiting` > `async-test-helpers`
- ✅ `using-skills` not `skill-usage`
- ✅ `flatten-with-flags` > `data-structure-refactoring`
- ✅ `root-cause-tracing` > `debugging-techniques`

**Gerunds (-ing) work well for processes:**

- `creating-skills`, `testing-skills`, `debugging-with-logs`
- Active, describes the action you're taking

**按操作或核心洞察命名:**

- ✅ `condition-based-waiting` > `async-test-helpers`
- ✅ `using-skills` 而非 `skill-usage`
- ✅ `flatten-with-flags` > `data-structure-refactoring`
- ✅ `root-cause-tracing` > `debugging-techniques`

**动名词(-ing)适合命名流程:**

- `creating-skills`, `testing-skills`, `debugging-with-logs`
- 主动语态,描述正在执行的动作

4. Cross-Referencing Other Skills

4. 交叉引用其他Skill

When writing documentation that references other skills:
Use skill name only, with explicit requirement markers:
  • ✅ Good:
    **REQUIRED SUB-SKILL:** Use superpowers:test-driven-development
  • ✅ Good:
    **REQUIRED BACKGROUND:** You MUST understand superpowers:systematic-debugging
  • ❌ Bad:
    See skills/testing/test-driven-development
    (unclear if required)
  • ❌ Bad:
    @skills/testing/test-driven-development/SKILL.md
    (force-loads, burns context)
Why no @ links:
@
syntax force-loads files immediately, consuming 200k+ context before you need them.
当编写引用其他Skill的文档时:
仅使用Skill名称,并添加明确的要求标记:
  • ✅ 良好:
    **REQUIRED SUB-SKILL:** Use superpowers:test-driven-development
  • ✅ 良好:
    **REQUIRED BACKGROUND:** You MUST understand superpowers:systematic-debugging
  • ❌ 不佳:
    See skills/testing/test-driven-development
    (未明确是否为必填)
  • ❌ 不佳:
    @skills/testing/test-driven-development/SKILL.md
    (强制加载,消耗上下文)
为何不使用@链接:
@
语法会立即强制加载文件,在需要前就消耗200k+上下文。

Flowchart Usage

流程图使用

dot
digraph when_flowchart {
    "Need to show information?" [shape=diamond];
    "Decision where I might go wrong?" [shape=diamond];
    "Use markdown" [shape=box];
    "Small inline flowchart" [shape=box];

    "Need to show information?" -> "Decision where I might go wrong?" [label="yes"];
    "Decision where I might go wrong?" -> "Small inline flowchart" [label="yes"];
    "Decision where I might go wrong?" -> "Use markdown" [label="no"];
}
Use flowcharts ONLY for:
  • Non-obvious decision points
  • Process loops where you might stop too early
  • "When to use A vs B" decisions
Never use flowcharts for:
  • Reference material → Tables, lists
  • Code examples → Markdown blocks
  • Linear instructions → Numbered lists
  • Labels without semantic meaning (step1, helper2)
See graphviz-conventions.dot for graphviz style rules.
dot
digraph when_flowchart {
    "Need to show information?" [shape=diamond];
    "Decision where I might go wrong?" [shape=diamond];
    "Use markdown" [shape=box];
    "Small inline flowchart" [shape=box];

    "Need to show information?" -> "Decision where I might go wrong?" [label="yes"];
    "Decision where I might go wrong?" -> "Small inline flowchart" [label="yes"];
    "Decision where I might go wrong?" -> "Use markdown" [label="no"];
}
仅在以下情况使用流程图:
  • 非直观的决策点
  • 可能提前终止的流程循环
  • "何时使用A vs B"的决策
绝不在以下情况使用流程图:
  • 参考资料 → 使用表格、列表
  • 代码示例 → 使用Markdown块
  • 线性说明 → 使用编号列表
  • 无语义的标签(step1、helper2)
查看graphviz-conventions.dot获取graphviz样式规则。

Code Examples

代码示例

One excellent example beats many mediocre ones
Choose most relevant language:
  • Testing techniques → TypeScript/JavaScript
  • System debugging → Shell/Python
  • Data processing → Python
Good example:
  • Complete and runnable
  • Well-commented explaining WHY
  • From real scenario
  • Shows pattern clearly
  • Ready to adapt (not generic template)
Don't:
  • Implement in 5+ languages
  • Create fill-in-the-blank templates
  • Write contrived examples
You're good at porting - one great example is enough.
一个优秀的示例胜过多个平庸的示例
选择最相关的语言:
  • 测试技术 → TypeScript/JavaScript
  • 系统调试 → Shell/Python
  • 数据处理 → Python
优秀示例的特点:
  • 完整且可运行
  • 带有详细注释说明原因
  • 来自真实场景
  • 清晰展示模式
  • 可直接适配(非通用模板)
请勿:
  • 使用5种以上语言实现
  • 创建填空式模板
  • 编写虚构示例
你擅长移植代码——一个优秀的示例足够。

File Organization

文件组织

Self-Contained Skill

独立Skill

defense-in-depth/
  SKILL.md    # Everything inline
When: All content fits, no heavy reference needed
defense-in-depth/
  SKILL.md    # 所有内容内联
适用场景:所有内容可容纳,无需大型参考资料

Skill with Reusable Tool

带可复用工具的Skill

condition-based-waiting/
  SKILL.md    # Overview + patterns
  example.ts  # Working helpers to adapt
When: Tool is reusable code, not just narrative
condition-based-waiting/
  SKILL.md    # 概述 + 模式
  example.ts  # 可适配的实用工具
适用场景:工具为可复用代码,而非叙事内容

Skill with Heavy Reference

带大型参考资料的Skill

pptx/
  SKILL.md       # Overview + workflows
  pptxgenjs.md   # 600 lines API reference
  ooxml.md       # 500 lines XML structure
  scripts/       # Executable tools
When: Reference material too large for inline
pptx/
  SKILL.md       # 概述 + 工作流
  pptxgenjs.md   # 600行API参考
  ooxml.md       # 500行XML结构
  scripts/       # 可执行工具
适用场景:参考资料过大,无法内联

The Iron Law (Same as TDD)

铁律(与TDD相同)

Testing All Skill Types

所有Skill类型的测试

Different skill types need different test approaches:
不同类型的Skill需要不同的测试方法:

Discipline-Enforcing Skills (rules/requirements)

纪律约束型Skill(规则/要求)

Examples: TDD, verification-before-completion, designing-before-coding
Test with:
  • Academic questions: Do they understand the rules?
  • Pressure scenarios: Do they comply under stress?
  • Multiple pressures combined: time + sunk cost + exhaustion
  • Identify rationalizations and add explicit counters
Success criteria: Agent follows rule under maximum pressure
**示例:**TDD、完成前验证、先设计再编码
测试方式:
  • 学术问题:他们是否理解规则?
  • 压力场景:他们在压力下是否合规?
  • 多重压力组合:时间 + 沉没成本 + 疲劳
  • 识别合理化借口并添加明确的应对措施
**成功标准:**Agent在最大压力下仍遵循规则

Technique Skills (how-to guides)

技术型Skill(操作指南)

Examples: condition-based-waiting, root-cause-tracing, defensive-programming
Test with:
  • Application scenarios: Can they apply the technique correctly?
  • Variation scenarios: Do they handle edge cases?
  • Missing information tests: Do instructions have gaps?
Success criteria: Agent successfully applies technique to new scenario
**示例:**condition-based-waiting、root-cause-tracing、防御性编程
测试方式:
  • 应用场景:他们能否正确应用技术?
  • 变体场景:他们能否处理边缘情况?
  • 信息缺失测试:说明是否存在漏洞?
**成功标准:**Agent能成功将技术应用于新场景

Pattern Skills (mental models)

模式型Skill(思维模型)

Examples: reducing-complexity, information-hiding concepts
Test with:
  • Recognition scenarios: Do they recognize when pattern applies?
  • Application scenarios: Can they use the mental model?
  • Counter-examples: Do they know when NOT to apply?
Success criteria: Agent correctly identifies when/how to apply pattern
**示例:**reducing-complexity、信息隐藏概念
测试方式:
  • 识别场景:他们能否识别模式的适用时机?
  • 应用场景:他们能否使用该思维模型?
  • 反例测试:他们是否知道何时不适用?
**成功标准:**Agent能正确识别模式的适用时机和方式

Reference Skills (documentation/APIs)

参考型Skill(文档/API)

Examples: API documentation, command references, library guides
Test with:
  • Retrieval scenarios: Can they find the right information?
  • Application scenarios: Can they use what they found correctly?
  • Gap testing: Are common use cases covered?
Success criteria: Agent finds and correctly applies reference information
**示例:**API文档、命令参考、库指南
测试方式:
  • 检索场景:他们能否找到正确的信息?
  • 应用场景:他们能否正确使用找到的信息?
  • 漏洞测试:是否覆盖了常见用例?
**成功标准:**Agent能找到并正确应用参考信息

Bulletproofing Skills Against Rationalization

抵御合理化借口的Skill加固

Skills that enforce discipline (like TDD) need to resist rationalization. Agents are smart and will find loopholes when under pressure.
Psychology note: Understanding WHY persuasion techniques work helps you apply them systematically. See persuasion-principles.md for research foundation (Cialdini, 2021; Meincke et al., 2025) on authority, commitment, scarcity, social proof, and unity principles.
执行纪律约束的Skill(如TDD)需要抵御合理化借口。Agent很聪明,在压力下会找到漏洞。
**心理学提示:**理解说服技巧的原理有助于系统地应用它们。请查看persuasion-principles.md获取研究基础(Cialdini, 2021; Meincke et al., 2025),涵盖权威、承诺、稀缺、社会认同和统一原则。

Close Every Loophole Explicitly

明确填补每个漏洞

Don't just state the rule - forbid specific workarounds:
<Bad> ```markdown Write code before test? Delete it. ``` </Bad> <Good> ```markdown Write code before test? Delete it. Start over.
No exceptions:
  • Don't keep it as "reference"
  • Don't "adapt" it while writing tests
  • Don't look at it
  • Delete means delete
</Good>
不要只陈述规则——禁止特定的变通方法:
<Bad> ```markdown 先写代码再写测试?删除它。 ``` </Bad> <Good> ```markdown 先写代码再写测试?删除它,重新开始。
无例外:
  • 不要将其保留为“参考”
  • 不要在编写测试时“适配”它
  • 不要查看它
  • 删除就是彻底删除
</Good>

Address "Spirit vs Letter" Arguments

应对“精神vs文字”争论

Add foundational principle early:
markdown
**Violating the letter of the rules is violating the spirit of the rules.**
This cuts off entire class of "I'm following the spirit" rationalizations.
提前添加基本原则:
markdown
**违反规则的文字表述就是违反规则的精神。**
这能杜绝一类“我遵循了精神”的合理化借口。

Build Rationalization Table

构建合理化借口表

Capture rationalizations from baseline testing (see Testing section below). Every excuse agents make goes in the table:
markdown
| Excuse | Reality |
|--------|---------|
| "Too simple to test" | Simple code breaks. Test takes 30 seconds. |
| "I'll test after" | Tests passing immediately prove nothing. |
| "Tests after achieve same goals" | Tests-after = "what does this do?" Tests-first = "what should this do?" |
记录基准测试中发现的合理化借口(见下文测试部分)。Agent提出的每个借口都应放入表格:
markdown
| 借口 | 事实 |
|--------|---------|
| "太简单无需测试" | 简单代码也会出错,测试只需30秒。 |
| "我之后再测试" | 测试立即通过无法证明任何问题。 |
| "之后测试能达到相同目标" | 后测试=“这能做什么?” 先测试=“这应该做什么?” |

Create Red Flags List

创建红旗列表

Make it easy for agents to self-check when rationalizing:
markdown
undefined
让Agent能轻松自检是否在找借口:
markdown
undefined

Red Flags - STOP and Start Over

红旗信号 - 停止操作并重新开始

  • Code before test
  • "I already manually tested it"
  • "Tests after achieve the same purpose"
  • "It's about spirit not ritual"
  • "This is different because..."
All of these mean: Delete code. Start over with TDD.
undefined
  • 先写代码再写测试
  • “我已经手动测试过了”
  • “之后测试能达到相同目的”
  • “这关乎精神而非形式”
  • “这次情况不同因为...”
出现以上任何一种情况:删除代码,从TDD重新开始。
undefined

Update CSO for Violation Symptoms

更新CSO以包含违规症状

Add to description: symptoms of when you're ABOUT to violate the rule:
yaml
description: use when implementing any feature or bugfix, before writing implementation code
在描述中添加即将违规的症状:
yaml
description: use when implementing any feature or bugfix, before writing implementation code

RED-GREEN-REFACTOR for Skills

Skill的RED-GREEN-REFACTOR流程

Follow the TDD cycle:
遵循TDD循环:

RED: Write Failing Test (Baseline)

RED:编写失败测试(基准)

Run pressure scenario with subagent WITHOUT the skill. Document exact behavior:
  • What choices did they make?
  • What rationalizations did they use (verbatim)?
  • Which pressures triggered violations?
This is "watch the test fail" - you must see what agents naturally do before writing the skill.
在无Skill的情况下,用子Agent运行压力场景。记录确切行为:
  • 他们做出了哪些选择?
  • 他们使用了哪些合理化借口(逐字记录)?
  • 哪些压力触发了违规?
这就是“观察测试失败”——在编写Skill前,你必须了解Agent的自然行为。

GREEN: Write Minimal Skill

GREEN:编写最小化Skill

Write skill that addresses those specific rationalizations. Don't add extra content for hypothetical cases.
Run same scenarios WITH skill. Agent should now comply.
编写Skill以解决这些特定的合理化借口。不要为假设情况添加额外内容。
在有Skill的情况下运行相同场景。Agent现在应合规。

REFACTOR: Close Loopholes

REFACTOR:填补漏洞

Agent found new rationalization? Add explicit counter. Re-test until bulletproof.
REQUIRED SUB-SKILL: Use superpowers:testing-skills-with-subagents for the complete testing methodology:
  • How to write pressure scenarios
  • Pressure types (time, sunk cost, authority, exhaustion)
  • Plugging holes systematically
  • Meta-testing techniques
Agent发现了新的合理化借口?添加明确的应对措施。重新测试直至无懈可击。
**必备子Skill:**使用superpowers:testing-skills-with-subagents获取完整的测试方法:
  • 如何编写压力场景
  • 压力类型(时间、沉没成本、权威、疲劳)
  • 系统性填补漏洞
  • 元测试技术

Anti-Patterns

反模式

❌ Narrative Example

❌ 叙事示例

"In session 2025-10-03, we found empty projectDir caused..." Why bad: Too specific, not reusable
“在2025-10-03的会话中,我们发现空projectDir导致...” **为何不佳:**过于具体,无法复用

❌ Multi-Language Dilution

❌ 多语言稀释

example-js.js, example-py.py, example-go.go Why bad: Mediocre quality, maintenance burden
example-js.js, example-py.py, example-go.go **为何不佳:**质量平庸,维护负担重

❌ Code in Flowcharts

❌ 流程图中包含代码

dot
step1 [label="import fs"];
step2 [label="read file"];
Why bad: Can't copy-paste, hard to read
dot
step1 [label="import fs"];
step2 [label="read file"];
**为何不佳:**无法复制粘贴,难以阅读

❌ Generic Labels

❌ 通用标签

helper1, helper2, step3, pattern4 Why bad: Labels should have semantic meaning
helper1, helper2, step3, pattern4 **为何不佳:**标签应具有语义

STOP: Before Moving to Next Skill

停止:进入下一个Skill前

After writing ANY skill, you MUST STOP and complete the deployment process.
Do NOT:
  • Create multiple skills in batch without testing each
  • Move to next skill before current one is verified
  • Skip testing because "batching is more efficient"
The deployment checklist below is MANDATORY for EACH skill.
Deploying untested skills = deploying untested code. It's a violation of quality standards.
编写任何Skill后,你必须停止并完成部署流程。
请勿:
  • 批量创建多个Skill而不逐个测试
  • 当前Skill未验证就进入下一个Skill
  • 以“批量更高效”为由跳过测试
以下部署检查清单对每个Skill都是强制性的。
部署未测试的Skill等同于部署未测试的代码,违反质量标准。

Skill Creation Checklist (TDD Adapted)

Skill创建检查清单(适配TDD)

IMPORTANT: Use TodoWrite to create todos for EACH checklist item below.
RED Phase - Write Failing Test:
  • Create pressure scenarios (3+ combined pressures for discipline skills)
  • Run scenarios WITHOUT skill - document baseline behavior verbatim
  • Identify patterns in rationalizations/failures
GREEN Phase - Write Minimal Skill:
  • Name uses only letters, numbers, hyphens (no parentheses/special chars)
  • YAML frontmatter with only name and description (max 1024 chars)
  • Description starts with "Use when..." and includes specific triggers/symptoms
  • Description written in third person
  • Keywords throughout for search (errors, symptoms, tools)
  • Clear overview with core principle
  • Address specific baseline failures identified in RED
  • Code inline OR link to separate file
  • One excellent example (not multi-language)
  • Run scenarios WITH skill - verify agents now comply
REFACTOR Phase - Close Loopholes:
  • Identify NEW rationalizations from testing
  • Add explicit counters (if discipline skill)
  • Build rationalization table from all test iterations
  • Create red flags list
  • Re-test until bulletproof
Quality Checks:
  • Small flowchart only if decision non-obvious
  • Quick reference table
  • Common mistakes section
  • No narrative storytelling
  • Supporting files only for tools or heavy reference
Deployment:
  • Commit skill to git and push to your fork (if configured)
  • Consider contributing back via PR (if broadly useful)
**重要提示:**使用TodoWrite为以下每个检查项创建待办事项。
RED阶段 - 编写失败测试:
  • 创建压力场景(纪律约束型Skill需3种以上组合压力)
  • 在无Skill的情况下运行场景——逐字记录基准行为
  • 识别合理化借口/失败的模式
GREEN阶段 - 编写最小化Skill:
  • 名称仅使用字母、数字和连字符(无括号/特殊字符)
  • YAML前置元数据仅包含name和description(总字符数≤1024)
  • 描述以"Use when..."开头,包含具体触发条件/症状
  • 描述使用第三人称
  • 全文包含用于搜索的关键词(错误、症状、工具)
  • 清晰的概述及核心原则
  • 解决RED阶段识别的特定基准失败问题
  • 代码内联或链接到单独文件
  • 一个优秀示例(非多语言)
  • 在有Skill的情况下运行场景——验证Agent现在已合规
REFACTOR阶段 - 填补漏洞:
  • 从测试中识别新的合理化借口
  • 添加明确的应对措施(若为纪律约束型Skill)
  • 从所有测试迭代中构建合理化借口表
  • 创建红旗列表
  • 重新测试直至无懈可击
质量检查:
  • 仅在决策不直观时使用小型流程图
  • 快速参考表格
  • 常见错误部分
  • 无叙事内容
  • 仅为工具或大型参考资料添加支持文件
部署:
  • 将Skill提交到git并推送到你的分支(若已配置)
  • 考虑通过PR贡献给官方仓库(若具有广泛适用性)

Discovery Workflow

发现流程

How future Claude finds your skill:
  1. Encounters problem ("tests are flaky")
  2. Finds SKILL (description matches)
  3. Scans overview (is this relevant?)
  4. Reads patterns (quick reference table)
  5. Loads example (only when implementing)
Optimize for this flow - put searchable terms early and often.
未来的Claude如何找到你的Skill:
  1. 遇到问题(“测试不稳定”)
  2. 找到SKILL(描述匹配)
  3. 浏览概述(是否相关?)
  4. 阅读模式(快速参考表格)
  5. 加载示例(仅在实现时)
针对此流程优化——尽早且频繁地放置可搜索的术语。

The Bottom Line

底线

Creating skills IS TDD for process documentation.
Same Iron Law: No skill without failing test first. Same cycle: RED (baseline) → GREEN (write skill) → REFACTOR (close loopholes). Same benefits: Better quality, fewer surprises, bulletproof results.
If you follow TDD for code, follow it for skills. It's the same discipline applied to documentation.
创建Skill就是将TDD应用于流程文档。
相同的铁律:没有失败测试就不要编写Skill。 相同的循环:RED(基准)→ GREEN(编写Skill)→ REFACTOR(填补漏洞)。 相同的优势:更高质量、更少意外、无懈可击的结果。
如果你在代码中遵循TDD,那么在Skill创建中也应遵循。这是将同一纪律应用于文档编写。

Skill Creation Process

Skill创建流程

To create a skill, follow the "Skill Creation Process" in order, skipping steps only if there is a clear reason why they are not applicable.
创建Skill时,请按“Skill创建流程”顺序执行,仅在明确不适用时跳过步骤。

Step 1: Understanding the Skill with Concrete Examples

步骤1:通过具体示例理解Skill

Skip this step only when the skill's usage patterns are already clearly understood. It remains valuable even when working with an existing skill.
To create an effective skill, clearly understand concrete examples of how the skill will be used. This understanding can come from either direct user examples or generated examples that are validated with user feedback.
For example, when building an image-editor skill, relevant questions include:
  • "What functionality should the image-editor skill support? Editing, rotating, anything else?"
  • "Can you give some examples of how this skill would be used?"
  • "I can imagine users asking for things like 'Remove the red-eye from this image' or 'Rotate this image'. Are there other ways you imagine this skill being used?"
  • "What would a user say that should trigger this skill?"
To avoid overwhelming users, avoid asking too many questions in a single message. Start with the most important questions and follow up as needed for better effectiveness.
Conclude this step when there is a clear sense of the functionality the skill should support.
仅当Skill的使用模式已清晰理解时跳过此步骤。即使处理现有Skill,此步骤仍有价值。
要创建有效的Skill,需清晰理解Skill的具体使用示例。这种理解可来自直接的用户示例,或经用户反馈验证的生成示例。
例如,构建image-editor Skill时,相关问题包括:
  • “image-editor Skill应支持哪些功能?编辑、旋转,还是其他?”
  • “你能给出一些使用该Skill的示例吗?”
  • “我能想象用户会要求‘去除这张图片的红眼’或‘旋转这张图片’。你认为还有其他使用场景吗?”
  • “用户说什么话应该触发这个Skill?”
为避免使用户负担过重,不要在一条消息中问太多问题。从最重要的问题开始,根据需要跟进以提高有效性。
当明确Skill应支持的功能时,结束此步骤。

Step 2: Planning the Reusable Skill Contents

步骤2:规划可复用Skill内容

To turn concrete examples into an effective skill, analyze each example by:
  1. Considering how to execute on the example from scratch
  2. Identifying what scripts, references, and assets would be helpful when executing these workflows repeatedly
Example: When building a
pdf-editor
skill to handle queries like "Help me rotate this PDF," the analysis shows:
  1. Rotating a PDF requires re-writing the same code each time
  2. A
    scripts/rotate_pdf.py
    script would be helpful to store in the skill
Example: When designing a
frontend-webapp-builder
skill for queries like "Build me a todo app" or "Build me a dashboard to track my steps," the analysis shows:
  1. Writing a frontend webapp requires the same boilerplate HTML/React each time
  2. An
    assets/hello-world/
    template containing the boilerplate HTML/React project files would be helpful to store in the skill
Example: When building a
big-query
skill to handle queries like "How many users have logged in today?" the analysis shows:
  1. Querying BigQuery requires re-discovering the table schemas and relationships each time
  2. A
    references/schema.md
    file documenting the table schemas would be helpful to store in the skill
To establish the skill's contents, analyze each concrete example to create a list of the reusable resources to include: scripts, references, and assets.
要将具体示例转化为有效的Skill,需逐个分析示例:
  1. 考虑如何从头开始执行示例
  2. 识别重复执行这些工作流时需要的脚本、参考资料和资产
示例:构建
pdf-editor
Skill以处理“帮我旋转这个PDF”等查询时,分析显示:
  1. 旋转PDF需要重复编写相同的代码
  2. scripts/rotate_pdf.py
    脚本存储在Skill中会很有帮助
示例:设计
frontend-webapp-builder
Skill以处理“帮我构建一个待办事项应用”或“帮我构建一个步数跟踪仪表盘”等查询时,分析显示:
  1. 构建前端Web应用需要重复编写相同的HTML/React样板代码
  2. 将包含HTML/React项目样板文件的
    assets/hello-world/
    模板存储在Skill中会很有帮助
示例:构建
big-query
Skill以处理“今天有多少用户登录?”等查询时,分析显示:
  1. 查询BigQuery需要重复查找表架构和关系
  2. 将记录表架构的
    references/schema.md
    文件存储在Skill中会很有帮助
要确定Skill的内容,需分析每个具体示例,创建要包含的可复用资源列表:脚本、参考资料和资产。

Step 3: Creating the Skill Directory

步骤3:创建Skill目录

Skip this step if the skill already exists and only needs iteration.
Create the skill directory and required files:
  1. Create the skill folder:
    mkdir -p skills/<skill-name>
  2. Create
    SKILL.md
    with YAML frontmatter:
markdown
---
name: skill-name
description: Use when [triggering conditions] - [what the skill does]
---
仅当Skill已存在且只需迭代时跳过此步骤。
创建Skill目录和必填文件:
  1. 创建Skill文件夹:
    mkdir -p skills/<skill-name>
  2. 创建带YAML前置元数据的
    SKILL.md
markdown
---
name: skill-name
description: Use when [触发条件] - [Skill功能]
---

Skill Name

Skill名称

Critical Guidlines

关键指南

[Core principle in 1-2 sentences. Each start wit "You MUST ..."]
[核心原则,1-2句话。每句以"You MUST ..."开头]

How to Use

使用方法

[Think in steps, use problem decomposition, etc.]
[按步骤思考,使用问题分解等方法]

Guide

指南

[Procedures, patterns]
[流程、模式]

Examples

示例

[Examples of how to use the skill, include agent input and output]
[Skill使用示例,包含Agent输入和输出]

Troubleshooting

故障排除

[Common mistakes and how to avoid them]
[常见错误及避免方法]

Resources

资源

[Scripts, references, assets]

3. Add resource subdirectories only if needed:
   - `scripts/` — reusable executable code
   - `references/` — documentation loaded on demand
   - `assets/` — files used in output (templates, images)
[脚本、参考资料、资产]

3. 仅在需要时添加资源子目录:
   - `scripts/` — 可复用可执行代码
   - `references/` — 按需加载的文档
   - `assets/` — 输出中使用的文件(模板、图片)

Step 4: Edit the Skill

步骤4:编辑Skill

When editing the (newly-generated or existing) skill, remember that the skill is being created for another instance of Claude to use. Focus on including information that would be beneficial and non-obvious to Claude. Consider what procedural knowledge, domain-specific details, or reusable assets would help another Claude instance execute these tasks more effectively.
编辑(新生成或现有)Skill时,请记住Skill是为其他Claude实例创建的。重点包含对Claude有益且非直观的信息。考虑哪些流程知识、领域特定细节或可复用资产能帮助其他Claude实例更有效地执行这些任务。

Start with Reusable Skill Contents

从可复用Skill内容开始

To begin implementation, start with the reusable resources identified above:
scripts/
,
references/
, and
assets/
files. Note that this step may require user input. For example, when implementing a
brand-guidelines
skill, the user may need to provide brand assets or templates to store in
assets/
, or documentation to store in
references/
.
Remove any resource subdirectories not needed for the skill. Most skills need only SKILL.md.
开始实现时,先处理上述识别的可复用资源:
scripts/
references/
assets/
文件。注意此步骤可能需要用户输入。例如,实现
brand-guidelines
Skill时,用户可能需要提供品牌资产或模板以存储在
assets/
中,或提供文档以存储在
references/
中。
删除Skill不需要的资源子目录。大多数Skill只需SKILL.md。

Update SKILL.md

更新SKILL.md

Writing Style: Write the entire skill using imperative/infinitive form (verb-first instructions), not second person. Use objective, instructional language (e.g., "To accomplish X, do Y" rather than "You should do X" or "If you need to do X"). This maintains consistency and clarity for AI consumption.
To complete SKILL.md, answer the following questions:
  1. What is the purpose of the skill, in a few sentences?
  2. When should the skill be used?
  3. In practice, how should Claude use the skill? All reusable skill contents developed above should be referenced so that Claude knows how to use them.
写作风格:整个Skill使用祈使/不定式形式(动词开头的指令),而非第二人称。使用客观的说明性语言(例如:"要完成X,请执行Y"而非"你应该做X"或"如果你需要做X")。这能保持AI消费的一致性和清晰度。
要完成SKILL.md,请回答以下问题:
  1. Skill的目的是什么?用几句话说明。
  2. 何时应使用该Skill?
  3. 实际上,Claude应如何使用该Skill?应引用上述开发的所有可复用Skill内容,以便Claude知道如何使用它们。

Step 5: Validating the Skill

步骤5:验证Skill

Before deploying, verify the skill meets requirements:
  1. Frontmatter — YAML contains only
    name
    and
    description
    (max 1024 chars total)
  2. Name — uses only letters, numbers, and hyphens
  3. Description — starts with "Use when...", written in third person, includes specific triggers
  4. Structure
    SKILL.md
    exists at
    skills/<skill-name>/SKILL.md
  5. Resources — any referenced scripts, references, or assets exist at their declared paths
部署前,验证Skill符合要求:
  1. 前置元数据 — YAML仅包含
    name
    description
    (总字符数≤1024)
  2. 名称 — 仅使用字母、数字和连字符
  3. 描述 — 以"Use when..."开头,第三人称表述,包含具体触发条件
  4. 结构
    SKILL.md
    位于
    skills/<skill-name>/SKILL.md
  5. 资源 — 所有引用的脚本、参考资料或资产都存在于声明的路径

Step 6: Iterate

步骤6:迭代

After testing the skill, users may request improvements. Often this happens right after using the skill, with fresh context of how the skill performed.
Iteration workflow:
  1. Use the skill on real tasks
  2. Notice struggles or inefficiencies
  3. Identify how SKILL.md or bundled resources should be updated
  4. Implement changes and test again
测试Skill后,用户可能会要求改进。这通常发生在使用Skill后不久,此时用户对Skill的表现有清晰的上下文。
迭代流程:
  1. 在实际任务中使用Skill
  2. 注意遇到的困难或低效之处
  3. 确定应如何更新SKILL.md或捆绑资源
  4. 实施更改并重新测试