skill设计技巧

skill系统教程

一、先建立一个核心模型:Skill 到底是什么?

                    Skill Engineering
                           │
          ┌────────────────┼────────────────┐
          ↓                ↓                ↓
       WHAT             HOW             QUALITY
     定义什么           如何工作          如何保证
          │                │                │
       Scope           Workflow        Validation
       Trigger         Context         Safety
       Contract        Disclosure      Maintainability
          │                │                │
          └────────────────┼────────────────┘
                           ↓
                     OPERATING MODEL
                      Agent 如何执行

不要把 Skill 理解成“一个 Markdown 文件”。

更准确的抽象是:

Skill = 面向 Agent 的能力包

它至少包含:

Skill
├── Identity        我是谁?
├── Scope           我负责什么?
├── Knowledge       我知道什么?
├── Procedure       我怎么做?
├── Constraints     我不能怎么做?
├── Resources       我需要读取什么?
├── Tools           我可以执行什么?
└── Validation      我怎么证明完成?

进一步,标准skill应该包含以下内容

                    Skill Engineering
                           │
       ┌───────────┬───────┼────────┬───────────┐
       ↓           ↓       ↓        ↓           ↓
   Boundary     Context  Execution Constraint Verification
       │           │       │        │           │
      Scope       P.D.    Workflow  Never      Tests
      Trigger     Context Inspect    Must       DoD
      SRP         Economy Plan       Shouldn't  Review

二、第一层:Capability Boundary —— Skill 的边界

这一层回答:

这个 Skill 到底负责什么?

实用原则:

1、 Single Responsibility
一个 Skill 应该有清晰能力边界。
2.、Scope
明确作用范围
3、Triggering
什么时候触发,什么时候应该使用它?
4、Preconditions
使用之前需要什么条件?
例如:
需要:

  • 一个 Git repository
  • 项目已经安装依赖

不适用于:

  • 没有源码的架构咨询

三、第二层:Information Architecture —— Skill 如何组织知识

这一层回答:

Agent 应该在什么时候看到什么信息?

这是非常重要的一层,因为 Skill 不只是“知识”,还是一个 Context Management System。

可以建立:

Knowledge Architecture
│
├── Core Instructions
│      └── SKILL.md
│
├── Detailed Knowledge
│      └── references/
│
├── Examples
│      └── examples/
│
├── Executable Knowledge
│      └── scripts/
│
└── External Resources
       └── tools / APIs

实用原则:

1、Progressive Disclosure渐进式披露原则

渐进式披露原则,可以减少skill未完全加载时的上下文

例如:
读到xx特性时,再去读取xx.md

四、第三层:Execution Model —— Skill 如何让 Agent 工作

执行model即使workflow

回答:

Agent 拿到 Skill 后到底应该怎么行动?

标准模型可以是:

Understand
    ↓
Inspect
    ↓
Plan
    ↓
Execute
    ↓
Validate
    ↓
Review
    ↓
Report

实用原则:

1、 Inspect Before Act

不要没看代码就开始改。

2、Existing Convention First

优先遵循项目约定

3、Minimal Necessary Change

只做必要修改。

4、Incremental Execution

小步执行,而不是一次性大改。---最小化修改


五、第四层:Constraint Model —— Agent 应该被什么约束

这是很多 Skill 写作者容易漏掉的。

Skill 不只是告诉 Agent:

“你应该做什么。”

还必须告诉它:

“你绝对不能做什么。”

可以分:

Constraints
├── Must
├── Should
├── May
├── Should Not
└── Must Not

六、第五层:Verification —— 怎么知道 Skill 工作了?

这一层解决:

Agent 说“完成了”,凭什么相信?

这是 Engineering Skill 和普通 Prompt 最大的区别之一。

可以建立:

Verification
├── Preconditions
├── Invariants
├── Tests
├── Static Checks
├── Diff Review
└── Definition of Done

skill工程实践

skill多大时才能分拆skill

1、<< 150行/8kb
2、150300行/820KB 观察是否场景混杂
3、>300行/20KB 资源文件多

一个skill覆盖3个以上工作流、可拆

工程问题:
1、基准实现与本用例头冲突时 ---- 冲突裁决,默认基准更好
2、基准实现中用例头无校验步骤---基准校验、
3、基准与同族两个参照,主次不明-参照主次
基准优先
4、移植对标 -- 利用已移植对齐改动幅度标尺
5、代码阅读清单 --- 不阅读其他过时、非业务代码,多组件时,代码混杂,需要明确阅读清单,否则会出问题(比如时间很长,浪费上下文)

posted @ 2026-10-12 00:02  LemHou  阅读(14)  评论(0)    收藏  举报