solid-principles

Validate PHP/Laravel codebases for SOLID design principle conformance.

Updated Jul 13, 2023
One-click install
npx skills add https://github.com/changgenglu/changgenglu-blog --skill solid-principles-changgenglu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: solid-principles
Source: https://github.com/changgenglu/changgenglu-blog/tree/main/prompt_engineering/agents/skills/solid-principles
Command: npx skills add https://github.com/changgenglu/changgenglu-blog --skill solid-principles-changgenglu

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

協助開發團隊在 PHP/Laravel 專案中檢查是否符合 SOLID 原則,提供一致的設計評估與重構建議。

Core Features & Use Cases

  • SRP、OCP、LSP、ISP、DIP 等原則的檢查清單與實作建議,協助識別高耦合與責任不清的模組。
  • 提供可操作的重構範例,分離關注點、提升擴展性與可維護性。
  • Use Case:在中大型 Laravel 專案中審查現有架構,制定改善計畫與代碼風格規範。

Quick Start

在代碼審查中應用 SOLID 原則檢查要點,對發現的耦合與責任不清之處給出具體重構建議。

Frequently Asked Questions about solid-principles

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

FAQPage Schema
How do I check if my Laravel code follows SOLID design principles during a code review?

To check Laravel code for SOLID design principles during a code review, validate SRP, OCP, LSP, ISP, and DIP conformance to identify high coupling and unclear responsibilities, then apply actionable refactoring guidance to separate concerns.

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

The best way to refactor PHP code violating the Single Responsibility Principle is to separate concerns by splitting the class into distinct modules, ensuring each handles a single responsibility to improve maintainability and reduce coupling.

Can I use SOLID principles to assess architecture quality in mid-to-large PHP projects?

Yes, you can use SOLID principles to assess architecture quality in mid-to-large PHP projects by evaluating conformance to SRP, OCP, LSP, ISP, and DIP, identifying design flaws, and formulating actionable improvement plans.

How do I enforce the Open-Closed Principle in a Laravel codebase to improve extensibility?

To enforce the Open-Closed Principle in a Laravel codebase, extend module behavior through abstraction rather than modifying existing code, ensuring your design allows scalability without altering previously tested functionality.

When should I apply SOLID refactoring guidance to my existing Laravel modules?

Apply SOLID refactoring guidance to existing Laravel modules during code reviews or architectural assessments when you need to resolve high coupling, separate responsibilities, and improve overall design quality and maintainability.