跳到正文
Skillpedia
通用编程91k · #1320

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/storybookjs/storybook/blob/next/.agents/skills/principle-encode-lessons-in-structure/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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:

  1. Ask: can this be a lint rule, a metadata flag, a runtime check, or a script?
  2. If yes, encode it. Delete the instruction
  3. 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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能