feat(skills): spec-2.1 SKILL.md format (schema + parse + validate + namespace)#92
Merged
Conversation
added 2 commits
June 4, 2026 00:32
spec-2.1 T-3 实现(纯无-I/O,leaf 包 internal/app/skills)。
- schema.go: Schema 镜像 CC 4 字段(name/description/allowed-tools/model)+
Extra(forward-compat,0 opendbx 显式字段,Q6=B)+ AllowedToolsList(trim/filter)
- skill.go: Skill 不可变 + SkillSource{Kind,Precedence,Path,PluginID} + Key()
- parse.go: 全程 yaml.Node 解析 frontmatter;column-0 fence 检测(YAML doc
分隔语义,block-scalar 内 --- 不误判);1 MiB cap + 本地深度≤32;Extra 经
反射 known-key set 收集(防漂移);body 字节保真
- validate.go: Validate→(ValidationReport,error);warning 当数据返(不引
logger,纯叶子);loose name(禁危险字符,kebab 仅 warn,Q5);multi-error
errcode.Wrap(SKILL.VALIDATION_FAILED, errors.Join)(Q7)
- namespace.go: Resolve→Resolution{Active,Shadowed,Conflicts};Precedence 仲裁;
ConflictKind(Shadowed/Unresolvable);空 name 隔离;不变入参
- errors.go: 10 SKILL.* errcode 三件套(English,规则 13)
- 中心 frozen manifest append + gen-error-codes blank-import(SKILL.* 入 All())
覆盖率 94.3%(>85% gate);0 新依赖;errcode-lint/import-rules/manifest 全绿。
Spec: spec-2.1-skill-md-format.md
三路 post-impl review absorb(code-reviewer + go-reviewer + codex;trace
docs/reviews/spec-2.1-postimpl-review.md)。两 HIGth 多路独立命中:
- HIGH: collectExtra 在 value Decode 失败时静默丢字段 → 改返 SKILL.PARSE_ERROR
(不静默丢,honors Q6/规则7)+ 回归测
- HIGH: Resolve 输出与入参共享 Schema.Extra map → cloneSkill 递归深拷贝 Extra,
Active/Shadowed/Winner/Unresolvable 全用 clone + output→input 隔离回归测
- fence 尾空白 ---␠ 不匹配 → isFence TrimRight(" \t\r")(leading 仍禁保 column-0)
- ErrNamespaceConflict 死代码 → Conflict.Err() 返 SKILL.NAMESPACE_CONFLICT(Unresolvable)
- yamlNodeDepth 死分支 → Parse 传 &node;knownSchemaKeys → 包级 var
- 补 root.Decode 错误路径测(sequence-not-mapping)
覆盖率 94.3%→96.7%;-race -count=5 + errcode-lint + manifest + gate 全绿。
Spec: spec-2.1-skill-md-format.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
spec-2.1-skill-md-format T-3 实现。窄范围纯无-I/O leaf 包
internal/app/skills:frontmatter schema + parse + 校验 + namespace 规则。discovery→2.2 / invocation→2.3 / improvement→2.4。1:1 CC 兼容(baselinedocs/surveys/cc-ecosystem/skills.md@ CC SHA 3da94d5)。实现(D-1..D-8)
---不误判,解 review HIGH-3);1 MiB cap + 本地深度≤32(不 import config);Extra 经反射 known-key set 收集(防漂移);body 字节保真Validate→(ValidationReport,error)warning 当数据返(纯叶子不引 logger);loose name(Q5);multi-errorerrcode.Wrap(SKILL.VALIDATION_FAILED, errors.Join)(Q7)Resolve→Resolution{Active,Shadowed,Conflicts};Precedence 仲裁;ConflictKind;空 name 隔离;不变入参质量
make gate全绿(race + coverage + golangci + errcode-lint + import-rules + manifest)code-reviewer.md逐字段(含 block-scalar 尾换行)+ fence-in-block-scalar + BOM/CRLF + depth/size bomb + loose-name 矩阵 + multi-error errors.Is + namespace 不变性 reflect.DeepEqual调用方(规则 21)
新 leaf 包,无下游生产消费者(discovery/invocation 是后继 spec);唯一改的共用件 = gen-error-codes blank-import(+1 行)+ 中心 manifest append(append-only)。
Spec: spec-2.1-skill-md-format.md