principle-encode-lessons-in-structure
About principle-encode-lessons-in-structure
A development principle for turning recurring fixes into structural mechanisms such as lint rules, metadata, runtime checks, or scripts. It favors enforceable changes over repeated textual instructions and calls for routing and applying lessons from errors and corrections.
Key features
- 01Encode recurring fixes in mechanisms
- 02Prefer enforceable structure to instructions
- 03Choose the strongest available guard
- 04Route one-off and recurring lessons
- 05Apply fixes and close the loop
Use cases
- 01Prevent repeated mistakes with lint rules
- 02Replace repeated guidance with metadata or checks
- 03Turn recurring corrections into a skill
- 04Track and apply lessons from test failures
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ mdsmithaustin/ pstack --skill principle-encode-lessons-in-structureAfter installing, type/principle-encode-lessons-in-structurein Claude Code to confirm it loaded.
Bundled filesagents/openai.yaml
Details
From the project READMEEncode 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.
Textual instructions are easy to miss. Structural mechanisms 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.
When the human intervenes or tests fail, decide if it's a one-off or a pattern. Route it: 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)