skill-laws

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Skill Laws(设计法则)

Skill Laws (Design Principles)

最高法则:所有 Skill 是 AI 的指令集,人类只说自然语言,AI 解析意图、调用 Skill、完成操作。

Supreme Law: All Skills are instruction sets for AI. Humans only speak natural language, and AI parses intentions, calls Skills, and completes operations.

🎯 触发映射:用户说 → AI 做

🎯 Trigger Mapping: User Says → AI Does

用户输入触发词AI 执行动作
"创建 skill" / "新建 skill" / "添加 skill" / "初始化 skill"按【创建模式】执行
"优化 skill" / "skill 有问题" / "检查 skill" / "review skill" / "诊断 skill"按【优化模式】执行
"这个 skill 怎么样" / "评估 skill" / "skill 设计得好吗"按【评估模式】执行

User Input Trigger PhrasesAI Execution Action
"Create skill" / "New skill" / "Add skill" / "Initialize skill"Execute in [Creation Mode]
"Optimize skill" / "Skill has issues" / "Check skill" / "Review skill" / "Diagnose skill"Execute in [Optimization Mode]
"How is this skill?" / "Evaluate skill" / "Is the skill well-designed?"Execute in [Evaluation Mode]

创建模式

Creation Mode

触发:用户要创建新 Skill
Trigger: User wants to create a new Skill

执行步骤

Execution Steps

步骤执行动作具体命令/操作
1确定 skill 目录名使用格式
skill-{功能名}
,全小写,连字符分隔
2创建目录结构运行
mkdir -p .skills/{skill-name}/{references,scripts}
3创建 SKILL.md运行
Write
工具创建文件,路径:
.skills/{skill-name}/SKILL.md
4写入 frontmatter复制下方模板,替换变量:
{skill-name}
{功能描述}
{触发条件}
5添加触发映射表在 frontmatter 后添加"触发映射"区块
6添加执行步骤用表格列出步骤、动作、具体命令
7检查核心法则对照【核心法则检查表】逐项验证,全部通过才算完成
8创建 references如内容 > 500 行,将详细内容移到
references/
目录
StepExecution ActionSpecific Command/Operation
1Determine Skill Directory NameUse the format
skill-{function-name}
, all lowercase, separated by hyphens
2Create Directory StructureRun
mkdir -p .skills/{skill-name}/{references,scripts}
3Create SKILL.mdRun the
Write
tool to create the file, path:
.skills/{skill-name}/SKILL.md
4Write FrontmatterCopy the template below and replace variables:
{skill-name}
{function description}
{trigger conditions}
5Add Trigger Mapping SectionAdd the "Trigger Mapping" section after the frontmatter
6Add Execution StepsList steps, actions, and specific commands in a table
7Check Core PrinciplesVerify item by item against the [Core Principles Checklist]; creation is only complete when all items pass
8Create referencesIf content > 500 lines, move detailed content to the
references/
directory

Frontmatter 模板

Frontmatter Template

yaml
---
name: {skill-name}
description: {功能描述}。何时使用:当用户{说/需要/遇到}{触发条件}时。
metadata:
  author: "{作者名}"
  updated: "{YYYY-MM-DD HH:MM:SS}"
  version: "1.0.0"
---
yaml
---
name: {skill-name}
description: {function description}. When to use: When users {say/need/encounter} {trigger conditions}.
metadata:
  author: "{author-name}"
  updated: "{YYYY-MM-DD HH:MM:SS}"
  version: "1.0.0"
---

核心法则检查表(创建时必须全部通过)

Core Principles Checklist (Must Pass All During Creation)

法则检查标准通过?如果不通过
⭐⭐⭐ 人类中心用户只需说自然语言,不需要手动操作文件或运行命令添加 AI 执行步骤,删除用户手动操作
⭐⭐⭐ AI 优先使用祈使句指令(运行/检查/调用/执行),表格展示决策逻辑将"你可以..."改为"运行...",长段落改为表格
⭐⭐⭐ 即调即用顶部有"触发映射"区块,用户输入 → AI 动作一一对应添加触发映射表
渐进披露核心内容 < 500 行,详细内容放
references/
将超过 500 行的内容移到 references
错误处理包含常见错误场景和处理方式表格添加错误处理表格
PrincipleInspection StandardPass?If Not Passing
⭐⭐⭐ Human-CentricUsers only need to speak natural language; no manual file operations or command execution requiredAdd AI execution steps and remove manual user operations
⭐⭐⭐ AI-FirstUse imperative instructions (run/check/call/execute) and present decision logic in tablesChange "You can..." to "Run..." and convert long paragraphs to tables
⭐⭐⭐ Ready-to-UseHas a "Trigger Mapping" section at the top, with one-to-one correspondence between user input and AI actionsAdd trigger mapping table
Progressive DisclosureCore content < 500 lines; detailed content stored in
references/
Move content exceeding 500 lines to references
Error HandlingIncludes a table of common error scenarios and handling methodsAdd error handling table

错误处理

Error Handling

错误场景错误表现处理方式
目录已存在
mkdir
报错目录已存在
运行
LS
检查目录内容,如为空则继续,如有内容则询问用户是否覆盖
文件写入失败
Write
返回错误
检查路径是否正确,如路径含空格需用引号包裹,重试写入
变量未替换SKILL.md 含
{skill-name}
等占位符
运行
SearchReplace
替换所有占位符为实际值
内容超过 500 行SKILL.md 行数 > 500将详细内容移到
references/
目录,核心内容保留精简版

Error ScenarioError PerformanceHandling Method
Directory Already Exists
mkdir
reports error that directory already exists
Run
LS
to check directory content; continue if empty, ask user whether to overwrite if there is content
File Write Failure
Write
returns an error
Check if the path is correct; if the path contains spaces, wrap it in quotes, then retry writing
Variables Not ReplacedSKILL.md contains placeholders like
{skill-name}
Run
SearchReplace
to replace all placeholders with actual values
Content Exceeds 500 LinesSKILL.md has > 500 linesMove detailed content to the
references/
directory and keep a streamlined version of the core content

优化模式

Optimization Mode

触发:用户要优化现有 Skill 或指出 Skill 有问题
Trigger: User wants to optimize an existing Skill or points out issues with a Skill

执行步骤

Execution Steps

步骤执行动作具体命令
1读取目标 Skill运行
Read
工具读取
{skill-path}/SKILL.md
2逐项检查对照【核心法则检查表】和【文档规范检查表】逐项标记 ✅/❌
3统计问题统计 ❌ 项数量,按优先级排序(核心法则优先)
4执行修复运行
SearchReplace
Write
修复问题,参考【正反对照】
5输出报告按【优化报告模板】输出结果
StepExecution ActionSpecific Command
1Read Target SkillRun the
Read
tool to read
{skill-path}/SKILL.md
2Item-by-Item InspectionMark ✅/❌ item by item against the [Core Principles Checklist] and [Documentation Specification Checklist]
3Count IssuesCount the number of ❌ items and sort by priority (core principles first)
4Execute FixesRun
SearchReplace
or
Write
to fix issues, refer to [Positive and Negative Comparisons]
5Output ReportOutput results according to the [Optimization Report Template]

文档规范检查表

Documentation Specification Checklist

检查项符合标准当前状态修复命令
description包含"何时使用:当用户说/需要/遇到..."
SearchReplace
添加触发条件
指令语气使用祈使句(运行/检查/调用/执行)
SearchReplace
"你可以"→"运行"
决策逻辑复杂任务使用表格展示条件分支将长段落改为条件表格
输出格式明确说明执行后输出什么、如何展示添加输出示例代码块
错误处理包含错误场景和处理方式表格添加错误处理表格
文件引用使用 Markdown 链接格式
[名](路径)
SearchReplace
改为可点击链接
渐进披露核心指令 < 500 行将详细内容移到
references/
触发映射顶部有"用户说 → AI 做"映射表添加触发映射区块
Inspection ItemCompliance StandardCurrent StatusFix Command
descriptionIncludes "When to use: When users say/need/encounter..."
SearchReplace
to add trigger conditions
Instruction ToneUses imperative sentences (run/check/call/execute)
SearchReplace
to change "You can" to "Run"
Decision LogicUse tables to display conditional branches for complex tasksConvert long paragraphs to conditional tables
Output FormatClearly states what to output after execution and how to display itAdd output example code blocks
Error HandlingIncludes a table of error scenarios and handling methodsAdd error handling table
File ReferencesUses Markdown link format
[name](path)
SearchReplace
to convert to clickable links
Progressive DisclosureCore instructions < 500 linesMove detailed content to
references/
Trigger MappingHas a "User Says → AI Does" mapping table at the topAdd trigger mapping section

正反对照(快速修复参考)

Positive and Negative Comparisons (Quick Fix Reference)

❌ 错误示例✅ 正确示例修复操作
"你可以运行...""运行..."
SearchReplace
删除"你可以"
"建议检查...""检查..."
SearchReplace
删除"建议"
"如果需要可以...""如果 X 则执行 Y"改为条件表格
"请参考文档了解详情""参考 文件名 执行..."
SearchReplace
添加链接
长段落描述表格/列表 + 具体命令重构为表格格式
"确保 xxx""运行
命令
检查 xxx"
添加具体检查命令
❌ Incorrect Example✅ Correct ExampleFix Operation
"You can run...""Run..."
SearchReplace
to remove "You can"
"It is recommended to check...""Check..."
SearchReplace
to remove "It is recommended to"
"You can... if needed""If X, execute Y"Convert to conditional table
"Please refer to the documentation for details""Refer to File Name to execute..."
SearchReplace
to add links
Long paragraph descriptionTable/list + specific commandsRestructure into table format
"Ensure xxx""Run
command
to check xxx"
Add specific check commands

错误处理

Error Handling

错误场景错误表现处理方式
文件不存在
Read
报错文件不存在
检查路径是否正确,如 skill-name 拼写错误,询问用户正确名称
无问题可优化所有检查项都是 ✅输出"该 Skill 已符合所有法则,无需优化",按【评估模式】输出评估报告
修复后引入新问题修复 A 问题导致 B 问题回滚更改,分步修复,每步修复后重新检查
用户不认可修复用户说"不要改这个"记录用户反馈,跳过该项,继续优化其他项
Error ScenarioError PerformanceHandling Method
File Does Not Exist
Read
reports error that file does not exist
Check if the path is correct; if the skill-name is misspelled, ask the user for the correct name
No Issues to OptimizeAll inspection items are ✅Output "This Skill complies with all principles and does not need optimization" and output an evaluation report according to [Evaluation Mode]
New Issues Introduced After FixFixing issue A causes issue BRoll back changes, fix step by step, and recheck after each fix
User Disapproves of FixUser says "Don't change this"Record user feedback, skip this item, and continue optimizing other items

优化报告模板

Optimization Report Template

undefined
undefined

优化报告:{skill-name}

Optimization Report: {skill-name}

评分:{通过数}/13 项符合(核心法则 5 项 + 文档规范 8 项)
Score: {Number of Passed Items}/13 Items Complied (5 Core Principles + 8 Documentation Specifications)

主要问题

Key Issues

  1. {问题描述}
    • 修复操作:{具体操作}
    • 使用工具:{Read/SearchReplace/Write}
  2. {问题描述}
    • 修复操作:{具体操作}
    • 使用工具:{Read/SearchReplace/Write}
  1. {Issue Description}
    • Fix Operation: {Specific Operation}
    • Tools Used: {Read/SearchReplace/Write}
  2. {Issue Description}
    • Fix Operation: {Specific Operation}
    • Tools Used: {Read/SearchReplace/Write}

已修复

Fixed Issues

  • {修复内容}
  • {修复内容}
  • {Fixed Content}
  • {Fixed Content}

后续建议

Follow-Up Suggestions

  • {建议内容}

---
  • {Suggestion Content}

---

评估模式

Evaluation Mode

触发:用户问 skill 设计得怎么样或要求评估 Skill 质量
Trigger: User asks how well a skill is designed or requests a Skill quality evaluation

执行步骤

Execution Steps

步骤执行动作具体命令
1读取目标 Skill运行
Read
工具读取
{skill-path}/SKILL.md
2核心法则评估检查是否符合【核心法则检查表】5 条法则
3文档规范评估检查是否符合【文档规范检查表】8 项规范
4计算评分统计符合项数,确定等级
5输出评估按【评估报告模板】输出结果
StepExecution ActionSpecific Command
1Read Target SkillRun the
Read
tool to read
{skill-path}/SKILL.md
2Core Principles EvaluationCheck compliance with the 5 principles in the [Core Principles Checklist]
3Documentation Specification EvaluationCheck compliance with the 8 specifications in the [Documentation Specification Checklist]
4Calculate ScoreCount the number of compliant items and determine the rating
5Output EvaluationOutput results according to the [Evaluation Report Template]

评估标准

Evaluation Criteria

等级分数说明
🏆 完美13/13完全符合 Skill Laws,可直接使用
✅ 优秀11-12/13基本符合,少量细节可优化
⚠️ 良好8-10/13有明显改进空间
❌ 需优化< 8/13需要大幅重构
RatingScoreDescription
🏆 Perfect13/13Fully complies with Skill Laws and can be used directly
✅ Excellent11-12/13Basically compliant; minor details can be optimized
⚠️ Good8-10/13Has obvious room for improvement
❌ Needs Optimization< 8/13Requires major restructuring

错误处理

Error Handling

错误场景错误表现处理方式
文件不存在
Read
报错文件不存在
询问用户正确的 skill 名称或路径
非 Skill 文件文件不含 SKILL.md 结构输出"该文件不是 Skill,无法评估",说明 Skill 文件结构要求
评分边界得分恰好在边界(如 10 分或 12 分)向下取整,按较低等级评定,鼓励继续优化
Error ScenarioError PerformanceHandling Method
File Does Not Exist
Read
reports error that file does not exist
Ask the user for the correct skill name or path
Non-Skill FileFile does not have SKILL.md structureOutput "This file is not a Skill and cannot be evaluated" and explain the Skill file structure requirements
Score BoundaryScore is exactly at the boundary (e.g., 10 points or 12 points)Round down and rate at the lower level to encourage further optimization

评估报告模板

Evaluation Report Template

undefined
undefined

Skill 质量评估:{skill-name}

Skill Quality Evaluation: {skill-name}

总体评分

Overall Score

符合度:{X}/13 项 ✅
等级:{🏆/✅/⚠️/❌}
Compliance: {X}/13 Items ✅
Rating: {🏆/✅/⚠️/❌}

核心问题(如等级不为 🏆)

Key Issues (If Rating is Not 🏆)

  • {问题描述} → {改进建议}
  • {问题描述} → {改进建议}
  • {Issue Description} → {Improvement Suggestion}
  • {Issue Description} → {Improvement Suggestion}

建议操作

Recommended Actions

  • 如等级为 ❌ 需优化:按【优化模式】执行全面优化
  • 如等级为 ⚠️ 良好:针对核心问题逐一修复
  • 如等级为 ✅ 优秀:微调细节即可达到 🏆 完美
undefined
  • If rating is ❌ Needs Optimization: Perform full optimization according to [Optimization Mode]
  • If rating is ⚠️ Good: Fix core issues one by one
  • If rating is ✅ Excellent: Fine-tune details to reach 🏆 Perfect
undefined