Five principles for building software that is easy to understand, extend, and maintain. They reduce coupling, increase cohesion, and make code testable.
| SRP | One reason to change | "This class handles X and Y and Z" | | OCP | Add, don't modify | Growing if/else or switch chains for types | | LSP | Subtypes are substitutable | Type-checking or special-casing in calling code | | ISP | Small, focused interfaces | Empty method implementations or throw new Error("Not implemented") |
| DIP | Depend on abstractions | new ConcreteClass() inside business logic |
Apply SOLID principles to write flexible, maintainable, and testable code. Use when designing classes, interfaces, and module boundaries. Covers Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion with practical TypeScript examples and detection heuristics. Source: fellipeutaka/leon.