skillZs
★ LIVE SKILL TAGS ★
>>> LIVE SKILLS INDEX <<<
* OPEN SOURCE *
NO LOGIN, NO TRACKING
※ REAL INSTALL DATA ※
← back to all skills
krzysztofsurdy/code-virtuoso68 installs

solid

SOLID principles for object-oriented design, with violation detection, fixes, and trade-offs for each principle. Use to review class design, reduce coupling, or improve extensibility.

How do I install this agent skill?

npx skills add https://github.com/krzysztofsurdy/code-virtuoso --skill solid
view source ↗

Is this agent skill safe to install?

  • Gen Agent Trust Hubpass

    This skill provides educational documentation and multi-language code examples for the SOLID principles of object-oriented design. It contains no malicious patterns, obfuscation, or security vulnerabilities.

  • Socketpass

    No alerts

  • Snykpass

    Risk: LOW · No issues

  • Runlayerpass

    6 files scanned · No issues

What does this agent skill do?

SOLID Principles

Five core principles of object-oriented design that make systems simpler to maintain, test, and extend. Robert C. Martin (Uncle Bob) formalized these ideas, and Michael Feathers coined the SOLID acronym.

Principle index

PrincipleSummaryReference
S: Single ResponsibilityA class should have only one reason to changereference
O: Open/ClosedOpen for extension, closed for modificationreference
L: Liskov SubstitutionSubtypes must be substitutable for their base typesreference
I: Interface SegregationPrefer many specific interfaces over one general-purpose interfacereference
D: Dependency InversionDepend on abstractions, not concretionsreference

Why SOLID matters

Without SOLID, codebases gradually develop these problems:

  • Rigidity: one change ripples through many unrelated modules
  • Fragility: modifying one area breaks another, seemingly unconnected area
  • Immobility: components are so intertwined that extracting them for reuse is impractical
  • Viscosity: doing things correctly is harder than hacking around the design

SOLID addresses each of these with clear boundaries, explicit contracts, and defined points for extension.

Quick decision guide

SymptomLikely violated principleFix
Class does too many thingsSRPSplit into focused classes
Adding a feature requires editing existing classesOCPIntroduce polymorphism or strategy
Subclass breaks when used in place of parentLSPFix inheritance hierarchy or use composition
Classes forced to implement unused methodsISPBreak interface into smaller ones
High-level module imports low-level detailsDIPIntroduce an abstraction layer

Quick examples

SRP: before and after

// 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 { /* ... */ }
}

OCP: extend without modifying

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);
    }
}

DIP: depend on abstractions

// 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);
    }
}

Relationships between principles

The five principles reinforce one another:

  • SRP + ISP: Both narrow a class or interface to a single concern
  • OCP + DIP: Abstractions are what make extension without modification possible
  • LSP + OCP: Polymorphic extension only works if subtypes are correctly substitutable
  • ISP + DIP: Well-segregated interfaces make it easier to depend on exactly the right abstraction

Common misconceptions

  • "One method per class": SRP means one reason to change, not one method. A class can have many methods as long as they serve the same responsibility.
  • "Never modify existing code": OCP does not prohibit bug fixes. It means new behavior should be addable without changing existing working code.
  • "Always use interfaces": DIP calls for depending on abstractions. Sometimes a base class is the right abstraction. Do not create interfaces for classes that will never have a second implementation.
  • "Inheritance is bad": LSP does not discourage inheritance. It sets rules for correct inheritance so that subtypes stay substitutable.

Best practices

  • Adopt SOLID incrementally. Do not refactor everything in one pass
  • Treat SOLID as a diagnostic tool: when code resists change, check which principle is being violated
  • Pair with design patterns: Strategy (OCP), Adapter (DIP), and Decorator (OCP) are direct implementations of SOLID ideas
  • Write tests first. TDD steers designs toward SOLID compliance
  • Use your language's strict typing and immutability features (readonly or final fields, immutable value types, enums or sealed types) so the design is enforced by the compiler

Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.

<a href="https://skillzs.dev/skills/krzysztofsurdy/code-virtuoso/solid">View solid on skillZs</a>