feat(pouch): add skill structure audit to cut token waste

Teach pouch to optimize a named skill's loading layout: keep SKILL.md as a
router, move mode-specific steps to references, and measure footprint with
an audit script instead of dumping the whole skill into context.
This commit is contained in:
2026-08-26 10:36:24 +08:00
parent 681aa9e237
commit 2be0964d73
6 changed files with 465 additions and 5 deletions
+14
View File
@@ -9,6 +9,7 @@
- 想完善、校验、转正或发布已有 skill。
- 想把自研 skill 安装到当前项目或全局 Agent。
- 想检查并修复 skill 软链接。
- 想优化某个已有 skill 的结构,减少点中后灌进上下文的内容。
## 创建一个 skill
@@ -31,6 +32,18 @@ pouch check my-skill
pouch finalize my-skill
```
## 优化已有 skill 的结构
skill 能用但正文太长、所有模式写在一份 `SKILL.md` 里,或点中后把用不到的参考一并读进上下文时:
```text
pouch 帮忙优化 ack 这个 skill 结构,减少 token 浪费
```
Agent 会先测量该 skill 的体积,再按分层加载改 SSOT:`SKILL.md` 只留路由和全模式边界,细节按条件读 `references/`。不会为了缩字删掉发版/部署一类的安全限制。改完仍需 `pouch check` 通过。
不要对社区 catalog skill 的安装目录直接改;那些不是本仓库的 SSOT。
## 提交和发布
只提交:
@@ -64,4 +77,5 @@ pouch add my-skill -a codex -g -y
- `pouch check <name>` 输出校验通过。
- 正式 skill 同时包含 `SKILL.md``README.md`
- `pouch status``pouch doctor` 显示目标软链接正常。
- 优化结构时:审计报告有前后体积,安全限制仍在 `SKILL.md`,没有为缩字删掉模式。