skills/knowledge/solid/SKILL.md
SOLID principles for object-oriented design with multi-language examples (PHP, Java, Python, TypeScript, C++). Use when the user asks to review SOLID compliance, fix a SOLID violation, evaluate class design, reduce coupling, improve extensibility, or apply Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, or Dependency Inversion principles. Covers motivation, violation detection, refactoring fixes, and real-world trade-offs for each principle.
npx skillsauth add krzysztofsurdy/code-virtuoso solidInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Five core principles of object-oriented design that lead to systems which are simpler to maintain, test, and extend. Robert C. Martin (Uncle Bob) formalized these ideas, and Michael Feathers coined the SOLID acronym.
| Principle | Summary | Reference | |---|---|---| | S — Single Responsibility | A class should have only one reason to change | reference | | O — Open/Closed | Open for extension, closed for modification | reference | | L — Liskov Substitution | Subtypes must be substitutable for their base types | reference | | I — Interface Segregation | Prefer many specific interfaces over one general-purpose interface | reference | | D — Dependency Inversion | Depend on abstractions, not concretions | reference |
Without SOLID, codebases gradually develop these problems:
SOLID tackles each of these by defining clear boundaries, explicit contracts, and flexible points for extension.
| Symptom | Likely Violated Principle | Fix | |---|---|---| | Class does too many things | SRP | Split into focused classes | | Adding a feature requires editing existing classes | OCP | Introduce polymorphism or strategy | | Subclass breaks when used in place of parent | LSP | Fix inheritance hierarchy or use composition | | Classes forced to implement unused methods | ISP | Break interface into smaller ones | | High-level module imports low-level details | DIP | Introduce an abstraction layer |
// BEFORE: Class handles both user data AND email sending
class UserService {
public function createUser(string $name, string $email): void { /* ... */ }
public function sendWelcomeEmail(string $email): void { /* ... */ }
}
// AFTER: Each class has one responsibility
class UserService {
public function __construct(private UserNotifier $notifier) {}
public function createUser(string $name, string $email): void {
// persist user...
$this->notifier->welcomeNewUser($email);
}
}
class UserNotifier {
public function welcomeNewUser(string $email): void { /* ... */ }
}
interface DiscountPolicy {
public function calculate(float $total): float;
}
class PercentageDiscount implements DiscountPolicy {
public function __construct(private float $rate) {}
public function calculate(float $total): float {
return $total * $this->rate;
}
}
// Adding a new discount type requires NO changes to existing code
class FlatDiscount implements DiscountPolicy {
public function __construct(private float $amount) {}
public function calculate(float $total): float {
return min($this->amount, $total);
}
}
// High-level policy depends on abstraction, not on database details
interface OrderRepository {
public function save(Order $order): void;
}
class PlaceOrderHandler {
public function __construct(private OrderRepository $repository) {}
public function handle(PlaceOrderCommand $cmd): void {
$order = Order::create($cmd->items);
$this->repository->save($order);
}
}
The five principles complement and reinforce one another:
development
Spawn and coordinate a pre-composed agent team from a team definition file. Reads team files from teams/, resolves agents and skills, picks the best spawning mode (peer or sequential), and runs the workflow. Use when the user asks to run a team, dispatch a development team, start a feature delivery, or coordinate multiple agents for a multi-phase task.
development
Pre-composed agent team library. Use when the user asks which teams are available, what a team does, when to pick one team over another, or to browse multi-agent compositions. Catalogs ready-to-run teams (development team, review squad, war room) with their purpose, agent roster, workflow type, and when to use each. The actual dispatching is handled by the dispatching-agent-teams skill.
tools
Ecosystem discovery advisor. Use when the user asks 'what skill should I use', 'what agent should I delegate to', 'which team fits this task', or when onboarding to available skills, agents, and teams. Scans ALL installed skills at runtime -- not limited to any single plugin or vendor. Triggers: 'which skill', 'which agent', 'what do I use for', 'orient me', 'what tools do I have'.
tools
Interactive tool to scaffold a complete Claude Code plugin -- plugin.json manifest, skills, agents, hooks, MCP servers, LSP servers, and an optional marketplace.json catalog entry. Use when the user asks to create a plugin, build a Claude Code plugin, scaffold a plugin marketplace, convert an existing .claude/ configuration into a plugin, or package skills and agents for distribution. Runs a guided questionnaire, writes all required files to disk, and prints test instructions.