open-closed-principle
Installation
SKILL.md
Open/Closed Principle (OCP)
Overview
Software entities should be open for extension, but closed for modification.
When new functionality is needed, extend the system with new code rather than modifying existing code. If adding a feature requires changing existing if/else chains, you're violating OCP.
When to Use
- Adding a new payment method, notification channel, export format, etc.
- Tempted to add another
if/elseorswitchcase - Existing code works but needs new variants
- Feature request: "add support for X"