writing-skills

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Writing 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 tdd before using this skill. That skill defines the fundamental RED-GREEN-REFACTOR cycle. This skill adapts TDD to documentation.
Official guidance: For Anthropic's official skill authoring best practices, see anthropic-best-practices.md. This 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遵循要求),然后重构(填补漏洞)。
核心原则: 如果你没有观察到Agent在没有该Skill时的失败表现,就无法确定这个Skill是否传授了正确的内容。
必备背景知识: 使用本Skill前,你必须理解TDD。TDD技能定义了基础的RED-GREEN-REFACTOR循环,本Skill将TDD适配到文档编写场景。
官方指引: 关于Anthropic官方的Skill创作最佳实践,请参考anthropic-best-practices.md。本文档提供了额外的模式和指南,作为本Skill中TDD核心方法的补充。

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的非定位: 关于你某次问题解决过程的叙事记录

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创作对应操作
Test case(测试用例)包含子Agent的压力场景
Production code(生产代码)Skill文档(SKILL.md)
Test fails (RED)(测试失败)Agent在无Skill时违反规则(基准行为)
Test passes (GREEN)(测试通过)Agent在有Skill时遵循要求
Refactor(重构)在保持合规性的同时填补漏洞
Write test first(先写测试)在编写Skill前先运行基准场景
Watch it fail(观察失败)记录Agent使用的具体合理化理由
Minimal code(最小化代码)编写Skill以解决那些特定的违规问题
Watch it pass(观察通过)验证Agent现在已遵循要求
Refactor cycle(重构循环)发现新的合理化理由 -> 填补漏洞 -> 重新验证
整个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)
  • Mechanical constraints (if it's enforceable with regex/validation, automate it - save documentation for judgment calls)
建议创建的场景:
  • 该技术对你而言并非直观易懂
  • 你会在多个项目中反复参考该内容
  • 该模式具有广泛适用性(而非仅适用于特定项目)
  • 其他使用者也能从中受益
不建议创建的场景:
  • 一次性解决方案
  • 已有完善文档记录的标准实践
  • 项目特定的约定(应放入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文档、语法指南、工具文档(如office docs)

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. 可复用工具 - 脚本、实用程序、模板
以下内容应内联在SKILL.md中:
  • 原则和概念
  • 代码模式(少于50行)
  • 其他所有内容

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, describes ONLY when to use (NOT what it does)
    • Start with "Use when..." to focus on triggering conditions
    • Include specific symptoms, situations, and contexts
    • NEVER summarize the skill's process or workflow (see CSO section for why)
    • Keep under 500 characters if possible
markdown
---
name: Skill-Name-With-Hyphens
description: Use when [specific triggering conditions and symptoms]
---
前置元数据(YAML格式):
  • 仅支持两个字段:
    name
    description
  • 总字符数不超过1024
  • name
    :仅使用字母、数字和连字符(不允许括号、特殊字符)
  • description
    :使用第三人称,仅描述何时使用(而非功能)
    • 以"Use when..."开头,聚焦触发条件
    • 包含具体的症状、场景和上下文
    • 绝对不要总结Skill的流程或工作流(原因请参考CSO部分)
    • 尽可能控制在500字符以内
markdown
---
name: Skill-Name-With-Hyphens
description: Use when [specific triggering conditions and symptoms]
---

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

Claude Search Optimization (CSO)

Claude搜索优化(CSO)

Critical for discovery: Future Claude needs to FIND your skill
对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
CRITICAL: Description = When to Use, NOT What the Skill Does
The description should ONLY describe triggering conditions. Do NOT summarize the skill's process or workflow in the description.
Why this matters: Testing revealed that when a description summarizes the skill's workflow, Claude may follow the description instead of reading the full skill content. A description saying "code review between tasks" caused Claude to do ONE review, even though the skill's flowchart clearly showed TWO reviews (spec compliance then code quality).
When the description was changed to just "Use when executing implementation plans with independent tasks" (no workflow summary), Claude correctly read the flowchart and followed the two-stage review process.
The trap: Descriptions that summarize workflow create a shortcut Claude will take. The skill body becomes documentation Claude skips.
yaml
undefined
目的: Claude会通过描述字段决定为当前任务加载哪些Skill。描述需要回答:"我现在应该阅读这个Skill吗?"
格式: 以"Use when..."开头,聚焦触发条件
关键规则:描述=何时使用,而非Skill的功能
描述字段应仅描述触发条件,绝对不要在描述中总结Skill的流程或工作流。
原因: 测试发现,当描述中总结了Skill的工作流时,Claude可能会直接遵循描述内容,而跳过阅读完整的Skill文档。例如,描述中写"code review between tasks"会导致Claude只进行一次代码审查,尽管Skill中的流程图明确显示需要进行两次审查(先合规性验证,再代码质量检查)。
当描述改为仅包含触发条件"Use when executing implementation plans with independent tasks"(无工作流总结)时,Claude会正确阅读流程图并遵循两阶段审查流程。
陷阱: 总结工作流的描述会成为Claude的捷径,导致Skill正文被忽略。
yaml
undefined

X BAD: Summarizes workflow - Claude may follow this instead of reading skill

❌ 错误:总结了工作流 - Claude可能会直接遵循描述而非阅读Skill

description: Use when executing plans - dispatches subagent per task with code review between tasks
description: Use when executing plans - dispatches subagent per task with code review between tasks

X BAD: Too much process detail

❌ 错误:包含过多流程细节

description: Use for TDD - write test first, watch it fail, write minimal code, refactor
description: Use for TDD - write test first, watch it fail, write minimal code, refactor

V GOOD: Just triggering conditions, no workflow summary

✅ 正确:仅包含触发条件,无工作流总结

description: Use when executing implementation plans with independent tasks in the current session
description: Use when executing implementation plans with independent tasks in the current session

V GOOD: Triggering conditions only

✅ 正确:仅包含触发条件

description: Use when implementing any feature or bugfix, before writing implementation code

**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)
- **NEVER summarize the skill's process or workflow**

```yaml
description: Use when implementing any feature or bugfix, before writing implementation code

**内容要求:**

- 使用具体的触发条件、症状和场景来表明该Skill适用
- 描述**问题本身**(如竞态条件、行为不一致),而非**特定语言的症状**(如setTimeout、sleep)
- 除非Skill本身是技术特定的,否则触发条件应与技术无关
- 如果Skill是技术特定的,需在触发条件中明确说明
- 使用第三人称(会注入到系统提示词中)
- **绝对不要总结Skill的流程或工作流**

```yaml

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

❌ 错误:过于抽象、模糊,未说明何时使用

description: For async testing
description: For async testing

X BAD: First person

❌ 错误:使用第一人称

description: I can help you with async tests when they're flaky
description: I can help you with async tests when they're flaky

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

❌ 错误:提到了特定技术,但Skill本身并非技术特定

description: Use when tests use setTimeout/sleep and are flaky
description: Use when tests use setTimeout/sleep and are flaky

V GOOD: Starts with "Use when", describes problem, no workflow

✅ 正确:以"Use when"开头,描述问题,无工作流内容

description: Use when tests have race conditions, timing dependencies, or pass/fail inconsistently
description: Use when tests have race conditions, timing dependencies, or pass/fail inconsistently

V GOOD: Technology-specific skill with explicit trigger

✅ 正确:技术特定Skill,触发条件明确

description: Use when using React Router and handling authentication redirects
undefined
description: Use when using React Router and handling authentication redirects
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:
  • V
    creating-skills
    not
    skill-creation
  • V
    condition-based-waiting
    not
    async-test-helpers
使用主动语态,动词开头:
  • creating-skills
    优于
    skill-creation
  • condition-based-waiting
    优于
    async-test-helpers

4. Token Efficiency (Critical)

4. 令牌效率(至关重要)

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会加载到每一次对话中,每一个令牌都很重要。
目标字数:
  • 入门工作流:每个不超过150词
  • 频繁加载的Skill:总字数不超过200词
  • 其他Skill:不超过500词(仍需保持简洁)
优化技巧:
将细节转移到工具的帮助文档中:
bash
undefined

X 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

V 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

X BAD: Repeat workflow details

❌ 错误:重复工作流细节

When searching, dispatch subagent with template... [20 lines of repeated instructions]
When searching, dispatch subagent with template... [20行重复的说明]

V 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

X 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"]

V 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:**

- V `condition-based-waiting` > `async-test-helpers`
- V `using-skills` not `skill-usage`
- V `flatten-with-flags` > `data-structure-refactoring`
- V `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形式)适合命名流程类Skill:**

- `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:
  • V Good:
    **REQUIRED SUB-SKILL:** Use tdd
  • V Good:
    **REQUIRED BACKGROUND:** You MUST understand debugging
  • X Bad:
    See skills/testing/test-driven-development
    (unclear if required)
  • X 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 tdd
  • ✅ 正确:
    **REQUIRED BACKGROUND:** You MUST understand 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.
Visualizing for your human partner: Use
render-graphs.js
in this directory to render a skill's flowcharts to SVG:
bash
./render-graphs.js ../some-skill           # Each diagram separately
./render-graphs.js ../some-skill --combine # All diagrams in one SVG
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而非B"的决策场景
绝对不要在以下场景使用流程图:
  • 参考资料 -> 使用表格、列表
  • 代码示例 -> 使用Markdown代码块
  • 线性指令 -> 使用编号列表
  • 无语义的标签(如step1、helper2)
流程图的样式规则请参考@graphviz-conventions.dot。
为人类伙伴可视化流程图: 使用本目录中的
render-graphs.js
将Skill中的流程图渲染为SVG格式:
bash
./render-graphs.js ../some-skill           # 单独渲染每个图表
./render-graphs.js ../some-skill --combine # 将所有图表合并为一个SVG

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一致)

NO SKILL WITHOUT A FAILING TEST FIRST
This applies to NEW skills AND EDITS to existing skills.
Write skill before testing? Delete it. Start over. Edit skill without testing? Same violation.
No exceptions:
  • Not for "simple additions"
  • Not for "just adding a section"
  • Not for "documentation updates"
  • Don't keep untested changes as "reference"
  • Don't "adapt" while running tests
  • Delete means delete
REQUIRED BACKGROUND: The tdd skill explains why this matters. Same principles apply to documentation.
NO SKILL WITHOUT A FAILING TEST FIRST
这一规则适用于新Skill现有Skill的编辑
先写Skill再测试?删除它,重新开始。 编辑Skill但未测试?同样违反规则。
无例外:
  • 不适用于"简单添加内容"
  • 不适用于"仅添加一个章节"
  • 不适用于"文档更新"
  • 不要将未测试的变更保留为"参考内容"
  • 不要在测试过程中"适配"Skill
  • 删除意味着彻底删除
必备背景知识: TDD Skill解释了这一规则的重要性,同样的原则适用于文档编写。

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、defensive-programming
测试方式:
  • 应用场景测试:他们能否正确应用该技术?
  • 变体场景测试:他们能否处理边缘情况?
  • 信息缺失测试:说明文档是否存在漏洞?
成功标准: 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、information-hiding concepts
测试方式:
  • 识别场景测试:他们能否识别模式适用的场景?
  • 应用场景测试:他们能否使用该思维模型?
  • 反例测试:他们是否知道何时不适用该模式?
成功标准: 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能找到并正确应用参考信息

Common Rationalizations for Skipping Testing

跳过测试的常见合理化理由

ExcuseReality
"Skill is obviously clear"Clear to you != clear to other agents. Test it.
"It's just a reference"References can have gaps, unclear sections. Test retrieval.
"Testing is overkill"Untested skills have issues. Always. 15 min testing saves hours.
"I'll test if problems emerge"Problems = agents can't use skill. Test BEFORE deploying.
"Too tedious to test"Testing is less tedious than debugging bad skill in production.
"I'm confident it's good"Overconfidence guarantees issues. Test anyway.
"Academic review is enough"Reading != using. Test application scenarios.
"No time to test"Deploying untested skill wastes more time fixing it later.
All of these mean: Test before deploying. No exceptions.
借口实际情况
"Skill的内容显然很清晰"对你清晰≠对其他Agent清晰。必须测试。
"这只是参考资料"参考资料也可能存在漏洞、表述不清的部分。测试信息检索能力。
"测试小题大做"未测试的Skill必然存在问题。15分钟的测试能节省数小时的后续工作。
"等出现问题再测试"问题=Agent无法使用Skill。在部署前测试。
"测试太繁琐"测试比在生产环境中调试有问题的Skill更轻松。
"我确信内容没问题"过度自信必然导致问题。无论如何都要测试。
"学术审查就足够了"阅读≠使用。测试应用场景。
"没时间测试"部署未测试的Skill会在后续修复上浪费更多时间。
所有这些借口都指向同一个结论:部署前必须测试,无例外。

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.
在Skill早期添加基础原则:
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使用的合理化理由(请参考下方测试部分)。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.
Testing methodology: See @testing-skills-with-subagents.md 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无懈可击。
测试方法论: 完整的测试方法论请参考@testing-skills-with-subagents.md:
  • 如何编写压力场景
  • 压力类型(时间、沉没成本、权威、疲劳)
  • 系统性填补漏洞
  • 元测试技巧

Anti-Patterns

反模式

X Narrative Example

❌ 叙事性示例

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

X 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 问题: 质量平庸,维护成本高

X 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"];
问题: 无法复制粘贴,可读性差

X 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. 查看示例(仅在实现时)
针对此流程优化Skill——将可搜索的词汇提前并多次出现。

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创作中也请遵循它。这是将同一纪律应用于文档编写。

Writing Style Guidelines

写作风格指南

When writing skill content, follow these prose guidelines for clear, direct communication:
编写Skill内容时,请遵循以下文风指南,确保沟通清晰直接:

Voice and Tone

语气和语态

  • Write like humans speak. Avoid corporate jargon and marketing fluff.
  • Be confident and direct. Avoid softening phrases like "I think," "maybe," or "could."
  • Use active voice instead of passive voice.
  • Use positive phrasing - say what something IS rather than what it isn't.
  • Say "you" more than "we" when addressing external audiences.
  • Use contractions like "I'll," "won't," and "can't" for a warmer tone.
  • 像人类说话一样写作,避免企业行话和营销话术。
  • 自信且直接,避免使用"我认为"、"也许"、"可能"这类弱化语气的词。
  • 使用主动语态而非被动语态。
  • 使用肯定表述——说明事物是什么而非不是什么
  • 面向外部受众时,多用"你"而非"我们"。
  • 使用 contractions(如"I'll"、"won't"、"can't")以营造更亲切的语气。

Specificity and Evidence

具体性和证据

  • Be specific with facts and data instead of vague superlatives.
  • Back up claims with concrete examples or metrics.
  • Highlight customers and community members over company achievements.
  • Use realistic, product-based examples instead of
    foo/bar/baz
    in code.
  • Make content concrete, visual, and falsifiable.
  • 使用具体的事实和数据,而非模糊的最高级。
  • 用具体的示例或指标支持你的主张。
  • 突出客户和社区成员的成果,而非公司成就。
  • 使用基于产品的真实示例,而非代码中的
    foo/bar/baz
  • 内容要具体、可视化、可证伪。

Title Creation

标题创作

  • Make a promise in the title so readers know exactly what they'll get if they click.
  • Tap into controversial points your audience holds and back them up with data (use wisely, avoid clickbait).
  • Share something uniquely helpful that makes readers better at meaningful aspects of their lives.
  • Avoid vague titles like "My Thoughts On XYZ." Titles should be opinions or shareable facts.
  • Write placeholder titles first, complete the content, then spend time iterating on titles at the end.
  • 在标题中做出承诺,让读者点击前就知道能获得什么。
  • 抓住受众有争议的观点,并用数据支持(谨慎使用,避免标题党)。
  • 分享独特且有用的内容,帮助读者在有意义的领域提升能力。
  • 避免模糊的标题如"我对XYZ的看法"。标题应是观点或可分享的事实。
  • 先写占位符标题,完成内容后,再花时间迭代优化标题。

Banned Words (Replace With)

禁用词汇(替换为)

  • a bit
    -> remove
  • a little
    -> remove
  • actually/actual
    -> remove
  • agile
    -> remove
  • arguably
    -> remove
  • assistance
    -> "help"
  • attempt
    -> "try"
  • battle tested
    -> remove
  • best practices
    -> "proven approaches"
  • blazing fast/lightning fast
    -> "build XX% faster"
  • business logic
    -> remove
  • cognitive load
    -> remove
  • commence
    -> "start"
  • delve
    -> "go into"
  • disrupt/disruptive
    -> remove
  • facilitate
    -> "help" or "ease"
  • game-changing
    -> specific benefit
  • great
    -> remove or be specific
  • implement
    -> "do"
  • individual
    -> "man" or "woman"
  • initial
    -> "first"
  • innovative
    -> remove
  • just
    -> remove
  • leverage
    -> "use"
  • mission-critical
    -> "important"
  • modern/modernized
    -> remove
  • numerous
    -> "many"
  • out of the box
    -> remove
  • performant
    -> "fast and reliable"
  • pretty/quite/rather/really/very
    -> remove
  • referred to as
    -> "called"
  • remainder
    -> "rest"
  • robust
    -> "strong"
  • seamless/seamlessly
    -> "automatic"
  • sufficient
    -> "enough"
  • that
    -> often removable, context dependent
  • thing
    -> be specific
  • utilize
    -> "use"
  • webinar
    -> "online event"
  • a bit
    -> 删除
  • a little
    -> 删除
  • actually/actual
    -> 删除
  • agile
    -> 删除
  • arguably
    -> 删除
  • assistance
    -> "help"
  • attempt
    -> "try"
  • battle tested
    -> 删除
  • best practices
    -> "proven approaches"
  • blazing fast/lightning fast
    -> "build XX% faster"
  • business logic
    -> 删除
  • cognitive load
    -> 删除
  • commence
    -> "start"
  • delve
    -> "go into"
  • disrupt/disruptive
    -> 删除
  • facilitate
    -> "help"或"ease"
  • game-changing
    -> 具体的收益
  • great
    -> 删除或具体化
  • implement
    -> "do"
  • individual
    -> "man"或"woman"
  • initial
    -> "first"
  • innovative
    -> 删除
  • just
    -> 删除
  • leverage
    -> "use"
  • mission-critical
    -> "important"
  • modern/modernized
    -> 删除
  • numerous
    -> "many"
  • out of the box
    -> 删除
  • performant
    -> "fast and reliable"
  • pretty/quite/rather/really/very
    -> 删除
  • referred to as
    -> "called"
  • remainder
    -> "rest"
  • robust
    -> "strong"
  • seamless/seamlessly
    -> "automatic"
  • sufficient
    -> "enough"
  • that
    -> 通常可删除,视上下文而定
  • thing
    -> 具体化
  • utilize
    -> "use"
  • webinar
    -> "online event"

Banned Phrases

禁用短语

  • I think/I believe/we believe
    -> state directly
  • it seems
    -> remove
  • sort of/kind of
    -> remove
  • pretty much
    -> remove
  • a lot/a little
    -> be specific
  • By developers, for developers
    -> remove
  • We can't wait to see what you'll build
    -> remove
  • We obsess over ___
    -> remove
  • The future of ___
    -> remove
  • We're excited
    -> "We look forward"
  • Today, we're excited to
    -> remove
  • I think/I believe/we believe
    -> 直接陈述
  • it seems
    -> 删除
  • sort of/kind of
    -> 删除
  • pretty much
    -> 删除
  • a lot/a little
    -> 具体化
  • By developers, for developers
    -> 删除
  • We can't wait to see what you'll build
    -> 删除
  • We obsess over ___
    -> 删除
  • The future of ___
    -> 删除
  • We're excited
    -> "We look forward"
  • Today, we're excited to
    -> 删除

Avoid LLM Patterns

避免LLM模式

  • Replace em dashes (—) with semicolons, commas, or sentence breaks.
  • Avoid starting responses with "Great question!", "You're right!", or "Let me help you."
  • Don't use phrases like "Let's dive into..."
  • Skip cliché intros like "In today's fast-paced digital world" or "In the ever-evolving landscape of."
  • Avoid phrases like "it's not just [x], it's [y]."
  • Avoid self-referential disclaimers like "As an AI" or "I'm here to help you with."
  • Don't use high-school essay closers: "In conclusion," "Overall," or "To summarize."
  • Avoid numbered lists in cases where bullets work better.
  • Don't end with "Hope this helps!" or similar closers.
  • Avoid overusing transition words like "Furthermore," "Additionally," or "Moreover."
  • Replace "In conclusion" with direct statements.
  • Avoid hedge words: "might," "perhaps," "potentially" unless uncertainty is real.
  • Don't stack hedging phrases: "may potentially," "it's important to note that."
  • Don't create perfectly symmetrical paragraphs or lists that start with "Firstly... Secondly..."
  • Avoid title-case headings; prefer sentence casing.
  • Remove Unicode artifacts when copy-pasting: smart quotes ("), em-dashes, non-breaking spaces.
  • Use `` instead of ''.
  • Delete empty citation placeholders like "[1]" with no actual source.
  • 将破折号(—)替换为分号、逗号或句号。
  • 避免以"Great question!"、"You're right!"或"Let me help you."开头。
  • 不要使用"Let's dive into..."这类短语。
  • 跳过陈词滥调的引言,如"在当今快节奏的数字世界中"或"在不断演变的...领域中"。
  • 避免使用"这不仅仅是[x],更是[y]"这类句式。
  • 避免自我指涉的免责声明,如"作为AI"或"我可以帮你..."。
  • 不要使用高中作文式的结尾:"In conclusion,"、"Overall,"或"To summarize."
  • 在项目符号列表更合适的情况下,避免使用编号列表。
  • 不要以"Hope this helps!"或类似的结束语结尾。
  • 避免过度使用过渡词如"Furthermore,"、"Additionally,"或"Moreover."
  • 用直接陈述替换"In conclusion"。
  • 避免使用模糊词:"might"、"perhaps"、"potentially",除非确实存在不确定性。
  • 不要堆叠模糊短语:"may potentially"、"it's important to note that."
  • 不要创建完美对称的段落或以"Firstly... Secondly..."开头的列表。
  • 避免标题式大小写;优先使用句子式大小写。
  • 复制粘贴时删除Unicode伪影:智能引号(")、破折号、非断空格。
  • 使用``而非''。
  • 删除空的引用占位符如"[1]",如果没有实际来源的话。

Punctuation and Formatting

标点和格式

  • Use Oxford commas consistently.
  • Use exclamation points sparingly.
  • Sentences can start with "But" and "And" - but don't overuse.
  • Use periods instead of commas when possible for clarity.

  • 始终使用牛津逗号。
  • 谨慎使用感叹号。
  • 句子可以以"But"和"And"开头——但不要过度使用。
  • 尽可能使用句号而非逗号以提高清晰度。

Memory Protocol (MANDATORY)

记忆协议(强制性)

Before starting: Read
.claude/context/memory/learnings.md
After completing:
  • New pattern ->
    .claude/context/memory/learnings.md
  • Issue found ->
    .claude/context/memory/issues.md
  • Decision made ->
    .claude/context/memory/decisions.md
ASSUME INTERRUPTION: If it's not in memory, it didn't happen.
开始前: 阅读
.claude/context/memory/learnings.md
完成后:
  • 新模式 -> 写入
    .claude/context/memory/learnings.md
  • 发现的问题 -> 写入
    .claude/context/memory/issues.md
  • 做出的决策 -> 写入
    .claude/context/memory/decisions.md
假设会被中断:如果没有记录在记忆中,就相当于没发生过。