Skill Wiki v0.1.0

文档 / spec / atoms

本页目录

Atoms · 28 种 kind

知识的单元。每个原子都声明 idversion、对应 kind 的 body 字段, 以及一组带类型的边。28 种 kind 分布在 5 个层里;按你的领域挑,剩下的不用管。

原子的解剖

一个原子是一个 .prime 源文件。形态都长这样:

<kind> <PascalCaseName> {
  id: "@scope/kind-kebab-name"
  version: "1.0.0"
  description: "One sentence — appears in summary projection."
  domain: <domain>

  // kind-specific body fields
  // ...

  // edges out (any subset of 14 verbs)
  related:        [@scope/...]
  requires:       [@scope/...]
  validates-with: [@scope/...]
}

每个 kind 都必填:idversiondescriptiondomain。 每种 kind 还会加上自己的必填字段(比如 rule 必填 claimmethod 必填 steps)。

5 个层

Kinds角色
Data fact term value category example counter-example source metric "是什么"。可验证的断言、定义、样本、引用。
Behaviour step check transform tool method "怎么做"。流程、校验、转换。
Composition rule taxonomy pattern anti-pattern type constraint "什么跟什么搭"。约束、分类、复发形态。
Meta collection scope tradeoff principle feedback "关于 corpus 本身"。打包、scope 声明、设计张力。
Voice & style (领域风格相关) persona voice template provocation "怎么表达"。各 corpus 使用程度不同 —— 实测样本:creative-writing 约 10 种 kind、security 约 12 种、frontend-design 22 种(当前上限)。

Kind 完整索引

Kind一句话必填字段
fact带 confidence 的可验证断言。statement, confidence
term对一个词汇单元的定义。definition
value一个具体的常量值。value, unit?
category分类体系里的一个类别槽位。category, parent?
example某条 rule 或 pattern 的具体实例。shows, illustrates?
counter-example违反某条 rule 或 pattern 的实例。fails, why
source对权威材料的引用。title, url?doi?
metric可度量的量(如对比度 ≥ 4.5:1)。name, threshold?
step流程里的一步。action
check一个校验关卡(yes / no / details)。check
transform一个 input → output 的过程。input, output
toolmethod 调用的可执行工具。signature
method多步流程,带输入、输出和 contract。steps, contract?
rule带 severity 和 applies-to 的约束。claim, severity
taxonomy一套分类方案。axis, buckets
pattern对反复出现问题的可复用解。problem, solution
anti-pattern常见错误及其失败原因。shape, fails-because
type协议中流转的对象的 schema。fields
constraint硬限制或不变量。limit, applies-to
collection一组精选原子的 bundle。members
scopecorpus 中聚焦的一个子集。focus, members
tradeoff两个价值彼此拉扯的决策。tension
principle支撑 rule 的更高层信念。statement
feedback对历史决策的回顾观察。observation
persona对一组风格的具名集合(设计流派、写作风格、品牌系等),表征连贯的声音 / 姿态。posture
voice书写声音(节奏、语域)。register
template可复用的输出脚手架。template
provocation用来推 agent 的创意性 prompt。prompt

两个完整例子

1. 一条 rule

rule SqlInjectionPrevention {
  id: "@security/rule-sql-injection-prevention"
  version: "1.0.0"
  description: "Always use parameterised queries — never concatenate strings."
  domain: security

  claim:    "Use parameterised queries; never concatenate user input."
  applies-to: [api-endpoint, data-pipeline]
  severity: critical

  validates-with: [
    @security/source-owasp-input-validation,
    @security/check-sqlmap-scan,
  ]

  contradicts: [
    @security/anti-pattern-string-concat-query,
  ]
}

2. 一个 method

method MakeTea {
  id: "@hello-world/method-make-tea"
  version: "1.0.0"
  description: "Boil water, steep tea, optional milk and sugar."
  domain: cooking

  steps: [
    @hello-world/step-boil-water,
    @hello-world/step-steep-tea,
    @hello-world/step-add-milk,
  ]

  contract: {
    must-include: [
      @hello-world/fact-water-boils-at-100c,
      @hello-world/term-steep,
    ]
    must-avoid: [
      @hello-world/anti-pattern-microwave-tea,
    ]
  }

  enhances: [
    @hello-world/voice-british-tea-time,
  ]
}

怎么挑 kind

一个小 corpus 一般用 5–8 种 kind。来自真实 corpus 的数据点: 一个创意写作 Prime 可能用约 10 种(偏 Voice & Style); 一个安全 Prime 约 12 种(偏 Data + Composition + Behaviour); frontend-design Prime 用了 22 种(当前上限)。没用上的 kind,干脆不出现。

需要一个我们没有的 kind?看 自定义 kind —— 给协议加一个 kind 是 4 文件 patch + 一份 Tier-2 RFC。