Apply SOLID principles (SRP, OCP, LSP, ISP, DIP) for tactical class design, method extraction, and interface definition. Use when reviewing class design, refactoring code for maintainability, or designing interfaces and abstractions.
64
77%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./skills/software-engineering/design-principles/solid-principles/SKILL.mdTactical design principles for class-level decisions, interface design, and dependency management.
Apply during code review or design:
| Principle | Check | Refactor Signal |
|---|---|---|
| SRP | Does this class have one reason to change? | Multiple concerns → split into focused classes |
| OCP | Can you extend behavior without modifying existing code? | Adding features requires editing stable code → use abstraction |
| LSP | Do subtypes preserve base behavior contracts? | Subtype breaks parent assumptions → redesign hierarchy |
| ISP | Do clients depend only on methods they use? | Clients ignore many interface methods → split interface |
| DIP | Do you depend on abstractions, not concrete details? | Direct concrete coupling → introduce interface/port |
Output: List of classes with multiple reasons to change.
Ask for each class:
Example:
SRP violation: UserService handles auth, persistence, and notifications.
Refactor: Extract NotificationService and PersistenceGateway.
Validation: Each class now has one reason to change.Output: List of areas where new features require modifying stable code.
Ask:
Example:
OCP violation: Adding payment processor requires editing PaymentService.
Refactor: Extract PaymentProcessor interface + implementations.
Validation: New processors added without touching existing code.Output: Subtypes that break base type contracts.
Check:
Example:
LSP violation: CachedRepository.save() throws exception when cache is full.
Refactor: Base Repository contract promises no exceptions; use Result type instead.Output: Interfaces split by client needs.
Check:
Example:
ISP violation: IUserRepository has save(), find(), and sendNotification().
Refactor: Split into IUserRepository and INotificationService.Output: Abstractions introduced at module boundaries.
Check:
Example:
DIP violation: OrderService instantiates PostgresRepository.
Refactor: OrderService depends on IOrderRepository interface.
Injection: Container provides PostgresRepository implementation.# Find SRP violations (multiple concerns)
rg -n "class.*Service.*Repository|class.*Manager.*Handler" src# Find OCP violations (type checks)
rg -n "instanceof|typeof.*==|switch.*type" src# Find DIP violations (concrete instantiation)
rg -n "new [A-Z].*Repository\(|new [A-Z].*Service\(" srcUserManager class that handles authentication, profile editing, email notifications, and audit logging — violating SRP by having four distinct reasons to change.AuthService, UserProfileService, NotificationService, and AuditLog with clear single responsibilities and independent change trajectories.ICanSave, ICanFind, ICanDelete) that are always implemented and injected together.class PremiumUser extends AuthenticatedUser extends User extends BaseUser to add behavior, creating a four-level hierarchy where changing any layer risks breaking all subclasses.new User(new PremiumFeatureSet()) — open for extension by adding new feature sets, closed for modification of the User class itself.SOLID principles are tactical class-level design rules. For architectural decisions (boundaries, modules, dependencies), use the clean-architecture skill.
For detailed SOLID guidance, see the software-design-principles hub (references/detailed-examples.md, references/anti-patterns-and-frameworks.md).
a1083f4
Also appears in
since Mar 16, 2026
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.