principle-encode-lessons-in-structure
What it does
This skill guides the AI to stop repeating the same correction in notes. It turns the lesson into a lint rule, a check or a script that enforces it. It is for teams that want fewer repeated mistakes.
When to use it
- ✓When the same instruction has been written down twice or more.
- ✓When a recurring correction from a reviewer keeps coming back.
- ✓When a test failure reveals a pattern that could be checked automatically.
Skill link
https://github.com/storybookjs/storybook/blob/next/.agents/skills/principle-encode-lessons-in-structure/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“We keep making the same mistake in code reviews. Turn that rule into an automatic check instead of another reminder.”
5 new skills a week. 1 minute to read.
How it works
The AI asks whether the rule can be enforced by a lint rule, a metadata flag, a runtime check or a script. It prefers the strongest mechanism available and removes the text reminder once the check exists.
Technical content (original SKILL.md)
Original text by the author, straight from 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)
FAQ
Why not just write a better reminder?
The skill says reminders are easy to miss, while automatic checks enforce the rule without anyone having to remember it.
What if a rule needs human judgment?
The skill says to make the instruction more prominent and add an example of the failure instead.
Which mechanism is preferred?
The strongest one the situation allows, such as a rule that makes the mistake impossible or fails the build.
Details
Original description by the author
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
Popularity
- GitHub stars
- 91k
- Ranking position
- #1320
- License
- MIT
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
handle-pr-comments
91kHelps your agent work through GitHub pull request review comments one at a time, suggesting a fix, applying your choice and resolving the thread.
storybook-startup-benchmark
91kHelps your agent measure how long Storybook takes to start and show its first story, with repeat runs for fair comparisons.
storybook-upgrade
91kShows your agent how to upgrade all Storybook packages in a project to a chosen version, one major version at a time.
update-pr-description
91kHelps your agent check whether a pull request's title and description still match the code changes, then suggest accurate updates.
Similar skills
diffs
394kLets your agent produce a real, shareable diff of edits as a viewer link or image file, instead of a hand-written summary.
coding-agent
394kHelps your agent hand a larger coding job to Codex, Claude Code, or OpenCode as a background worker, then check on its progress.
gh-issues
394kHelps your agent find GitHub issues, pick the ones to work on, and open pull requests with fixes, including follow-up on review comments.