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/else or switch case
  • Existing code works but needs new variants
  • Feature request: "add support for X"

The Iron Rule

Installs
27
GitHub Stars
12
First Seen
Jan 22, 2026
open-closed-principle — yanko-belov/code-craft