Strategic architecture, tactical design, and testable code principles (SOLID, Clean Architecture, Design Patterns, Testable Design)
97
97%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Passed
No known issues
Tactical 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).
clean-architecture
evals
references
design-patterns
solid-principles
testable-design