software-principles
Installation
SKILL.md
Software Principles
Fundamental design principles, testing strategies, and code quality standards for building maintainable software.
Core Design Principles
DRY — Don't Repeat Yourself
Every piece of knowledge must have a single, unambiguous, authoritative representation within the system. DRY applies to knowledge and intent, not just code text.
Rule of Three: Wait until code appears three times before extracting an abstraction. Premature extraction creates wrong abstractions. Two instances of similar code may be coincidental — three confirms a real pattern.
Key distinctions:
- Real duplication — Same logic, same intent. Extract it into a shared function or module.
- Coincidental duplication — Similar code, different intent. Leave it alone. Two functions formatting strings for different purposes should not be merged just because they look alike.
- Over-abstraction — Forced generalization that obscures meaning. A 5-parameter generic function is worse than two clear, specific functions.
Prevention strategies: extract common logic into named functions, use configuration-driven approaches for repeated patterns, prefer composition over inheritance for code reuse.
Related skills