solid

Analyze object-oriented code for SOLID principle violations and suggest refactoring steps.

Updated Jun 5, 2026
One-click install
npx skills add https://github.com/hung-phan/system-skills --skill solid-hung-phan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: solid
Source: https://github.com/hung-phan/system-skills/tree/main/skills/system-review/references/code-design/solid
Command: npx skills add https://github.com/hung-phan/system-skills --skill solid-hung-phan

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps developers implement SOLID principles in their object-oriented code, improving maintainability and scalability.

Core Features & Use Cases

  • Single Responsibility Principle (SRP): Ensures a class has only one reason to change, reducing the risk of bugs and making the code easier to maintain.
  • Open/Closed Principle (OCP): Allows for code extension without modification, ensuring that the codebase remains stable over time.
  • Liskov Substitution Principle (LSP): Ensures that subclasses can be substituted for their base classes without altering the correctness of the program.
  • Interface Segregation Principle (ISP): Reduces unnecessary dependencies between classes, leading to more modular and flexible code.
  • Dependency Inversion Principle (DIP): Inverts the dependency relationship between high-level and low-level modules, promoting better code structure.
  • Use Case: Refactoring a class that violates one or more of the SOLID principles to adhere to them, improving the overall design and maintainability of the codebase.

Quick Start

Analyze the class 'PaymentService' for SOLID principles violations and suggest refactoring steps.

Frequently Asked Questions about solid

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I analyze object-oriented code for SOLID principles violations?

Analyzing object-oriented code for SOLID principles violations involves evaluating class structure and method interactions against SRP, OCP, LSP, ISP, and DIP. This identifies design flaws and guides specific refactoring steps to improve overall maintainability and scalability.

What is the best way to refactor a class that violates the Single Responsibility Principle?

The best way to refactor a class violating the Single Responsibility Principle is to ensure it has only one reason to change. This reduces bug risks and makes the codebase easier to maintain by isolating distinct responsibilities into separate, focused classes.

How does the Liskov Substitution Principle affect subclass design?

The Liskov Substitution Principle affects subclass design by ensuring subclasses can be substituted for their base classes without altering program correctness. This requires careful analysis of method interactions to prevent unexpected behaviors during polymorphic execution.

Can I use this approach to improve code extension without modifying existing modules?

Yes, applying the Open/Closed Principle allows code extension without modification. By evaluating your object-oriented design, you can structure modules to be open for extension and closed for modification, ensuring the codebase remains stable over time.

When do I need to apply the Dependency Inversion Principle in software architecture?

You need to apply the Dependency Inversion Principle when high-level modules depend directly on low-level modules. Inverting this relationship promotes better code structure by introducing abstractions, leading to more modular and flexible object-oriented design.

Why does interface segregation reduce unnecessary dependencies between classes?

Interface segregation reduces unnecessary dependencies by splitting large interfaces into smaller, more specific ones. Evaluating class structure against this principle ensures classes only implement methods they actually use, leading to more modular and flexible code.