Skip to content
Skillpedia
General coding91k · #1320

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.md

Copy 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

Use this skill to help me: https://github.com/storybookjs/storybook/blob/next/.agents/skills/principle-encode-lessons-in-structure/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

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:

  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)
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

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills