solid-principles

Explain SOLID principles with PHP and TypeScript code examples.

8|Updated Feb 9, 2026
One-click install
npx skills add https://github.com/zb-ss/opencode-workflows --skill solid-principles-zb-ss
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: solid-principles
Source: https://github.com/zb-ss/opencode-workflows/tree/main/skill/solid-principles
Command: npx skills add https://github.com/zb-ss/opencode-workflows --skill solid-principles-zb-ss

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers understand and apply the SOLID principles of object-oriented design, leading to more maintainable, scalable, and robust codebases.

Core Features & Use Cases

  • Principle Explanations: Clear definitions and real-world analogies for each SOLID principle.
  • Code Examples: Demonstrates violations and refactored solutions in PHP and TypeScript.
  • Refactoring Patterns: Illustrates common design patterns used to adhere to SOLID.
  • Use Case: Refactor a monolithic class that violates the Single Responsibility Principle into smaller, more manageable classes.

Quick Start

Explain the Single Responsibility Principle and show a PHP example.

Frequently Asked Questions about solid-principles

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

FAQPage Schema
How do I refactor a monolithic class that violates the Single Responsibility Principle in PHP?

To refactor a monolithic class violating the Single Responsibility Principle, decompose it into smaller, manageable classes where each handles only one specific behavior. This refactoring pattern ensures your PHP object-oriented design remains maintainable and scalable.

What is the Open/Closed Principle in object-oriented design and how does it work?

The Open/Closed Principle dictates that software entities should be open for extension but closed for modification. It works by allowing you to add new functionality through new derived classes or interfaces rather than altering existing source code.

How do I detect Liskov Substitution Principle violations in TypeScript?

Detect Liskov Substitution Principle violations by checking if derived TypeScript classes alter expected base class behaviors or throw unexpected errors. Subtypes must be completely substitutable for their base types without breaking application logic.

Does applying SOLID principles work with both PHP and TypeScript codebases?

Applying SOLID principles works effectively with both PHP and TypeScript codebases. The principles use object-oriented design patterns and refactoring techniques that are fully compatible with strongly typed and dynamically typed languages.

When should I use the Interface Segregation Principle during refactoring?

Use the Interface Segregation Principle during refactoring when clients are forced to depend on methods they do not use. Split large interfaces into smaller, specific ones to prevent bloated classes and reduce the impact of changes.