| name | solid-principles |
| description | Apply SOLID principles to write maintainable, extensible object-oriented code. Outputs principle-by-principle analysis, refactoring examples, and design decision guidelines. |
| argument-hint | ["codebase language","identified violations","team OOP experience level"] |
| allowed-tools | Read, Write |
SOLID Principles
SOLID is five design principles that make object-oriented code easier to understand, extend, and maintain. Each principle targets a specific category of design rot: rigidity, fragility, immobility, viscosity, and needless complexity.
S — Single Responsibility Principle
A class should have one reason to change. One responsibility, one axis of change.
class UserService:
def create_user(self, data): ...
def send_welcome_email(self, user): ...
def generate_report(self, users): ...
(): ...
(): ...
:
():
._repo = user_repo
._email = email_service
() -> User:
user = User(**data)
._repo.save(user)
._email.send_welcome(user)
user
:
(): ...
:
() -> Report: ...
:
() -> : ...