design-patterns

Identify and apply GoF and Laravel design patterns to PHP codebases.

20|5|Updated Feb 27, 2026
One-click install
npx skills add https://github.com/nasrulhazim/agent-skills --skill design-patterns-nasrulhazim
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: design-patterns
Source: https://github.com/nasrulhazim/agent-skills/tree/main/skills/design-patterns
Command: npx skills add https://github.com/nasrulhazim/agent-skills --skill design-patterns-nasrulhazim

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

PHP and Laravel developers need a structured approach to selecting and applying design patterns to improve architecture, maintainability, and code quality.

Core Features & Use Cases

  • GoF pattern mappings and Laravel-idiomatic implementations (Factory, Builder, Repository, Decorator, Adapter, Strategy, Observer, Pipeline, Command, State Machine)
  • Laravel-specific patterns (Action, Service, DTO, Value Object, Query Scope, Form Request, API Resource) with practical guidance and examples
  • Guidance for pattern-based code reviews and refactoring to reduce smells and improve testability

Quick Start

Evaluate a real-world problem and map it to a suitable GoF or Laravel pattern, then implement a guided example following the pattern.

Frequently Asked Questions about design-patterns

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

FAQPage Schema
How do I apply GoF design patterns to refactor a Laravel codebase?

Select Laravel design patterns by evaluating your specific architecture challenge against GoF principles and Laravel idioms, mapping problems like complex data mapping to DTOs or multi-step processing to Pipelines for structured implementation.

What is the difference between a Laravel Action class and a Repository pattern?

Use Laravel-specific design patterns when standard GoF patterns feel too generic or when leveraging framework idioms like Form Requests for validation, API Resources for response formatting, or Query Scopes for reusable query constraints provides more native, testable solutions.

How do I use the Strategy pattern in PHP to replace large switch statements?

Review pattern-based implementations by checking for reduced code smells, improved testability through dependency injection, and proper adherence to GoF principles and Laravel idioms like Action classes, DTOs, and API Resources across the project.

When should I not use design patterns in my PHP application?

Avoid using design patterns in PHP applications when the architectural complexity they introduce does not justify the benefit, as forcing patterns into simple logic can increase code smells and reduce maintainability rather than solving the core problem.