principle-encode-lessons-in-structure
它能做什么
这个技能引导 AI 停止在笔记中重复同样的纠正。它把经验教训变成 lint 规则、检查或脚本来强制执行。适合希望减少重复错误的团队。
适用场景
- ✓当同一条指令已被写下两次或更多次的时候。
- ✓当审阅者反复提出的同一类纠正一再出现的时候。
- ✓当一次测试失败揭示出一种可以被自动检查的模式的时候。
技能链接
https://github.com/storybookjs/storybook/blob/next/.agents/skills/principle-encode-lessons-in-structure/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我们在代码审查中总是犯同样的错误。请把这条规则变成自动检查,而不是再写一条提醒。”
每周 5 个新技能,1 分钟读完。
工作原理
AI 会询问这条规则能否由 lint 规则、元数据标记、运行时检查或脚本来强制执行。它优先选择可用的最强机制,并在检查建立后删除文字提醒。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Encode Lessons in Structure
Encode recurring fixes in mechanisms (tools, code, metadata, automation) instead of textual instructions. Every error, human correction, and unexpected outcome is a learning signal. Capture it, route it, and close the loop.
Why: Textual instructions are easy to miss. They require the reader to notice, remember, and comply. Structural mechanisms (lint rules, metadata flags, runtime checks, automation scripts) enforce the rule without cooperation.
Pattern: When you catch yourself writing the same instruction a second time:
- Ask: can this be a lint rule, a metadata flag, a runtime check, or a script?
- If yes, encode it. Delete the instruction
- If no (requires judgment), make the instruction more prominent and add an example of the failure mode
Pick the strongest mechanism. When more than one mechanism would work, choose the strongest the situation allows (an unrepresentable state that cannot compile, then a lint or banned API that fails CI, then a canonical helper, then a runtime check), because agents copy whatever the surrounding code already does and a weaker guard becomes the next template.
Corollary: If the fix is structural, only use the structural fix. The instruction is the symptom.
Feedback loop:
- Capture every correction. When the human intervenes or tests fail, decide if it's a one-off or a pattern.
- Route to the right layer. One-off -> brain note. Recurring fix -> skill or lint rule. Systemic issue -> principle.
- Close the loop. Don't just record. Apply now or create a concrete todo.
Anti-patterns:
- Acknowledging without recording ("I'll keep that in mind" does not persist)
- Recording without routing (a brain note about a lint rule that should exist is wasted unless the lint rule gets implemented)
- Fixing without generalizing (fixing one instance while leaving the recurring pattern intact)
常见问题
为什么不直接写一条更好的提醒?
该技能说明,提醒容易被忽略,而自动检查无需任何人记住,就能强制执行规则。
如果某条规则需要人工判断怎么办?
该技能说明,应把这条指令写得更加醒目,并附上一个错误示例。
优先选择哪种机制?
在情况允许的前提下选择最强的一种,例如让错误无法发生或导致构建失败的规则。
详情
作者的原始描述
Apply when you catch yourself writing the same instruction a second time, or notice a recurring correction. Encode the rule as a lint, metadata flag, runtime check, or script instead of more text.
repo: storybookjs/storybook
热度
- GitHub 星标
- 91k
- 排名
- #1320
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
handle-pr-comments
91k帮你的智能体逐条处理 GitHub 拉取请求的审查意见,建议修复方案,应用你的选择,并把讨论串标为已解决。
storybook-startup-benchmark
91k帮你的智能体测量 Storybook 的启动时间,以及显示第一个 story 所需的时间,并通过重复运行进行公平比较。
storybook-upgrade
91k教你的智能体把项目中的所有 Storybook 包升级到指定版本,每次只升级一个大版本。
update-pr-description
91k帮你的智能体检查拉取请求的标题和描述是否仍与代码改动相符,然后提出准确的更新建议。