design-patterns

Map software design problems to recommended patterns like Strategy, Factory, Observer, and Composition using SOLID principles.

Updated Apr 10, 2026
One-click install
npx skills add https://github.com/erichugy/agentic.skills --skill design-patterns-erichugy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: design-patterns
Source: https://github.com/erichugy/agentic.skills/tree/main/design-patterns
Command: npx skills add https://github.com/erichugy/agentic.skills --skill design-patterns-erichugy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Helps engineers and architects identify which software design pattern to apply when code organization, object creation, or runtime behavior selection becomes difficult, reducing misapplied abstractions and brittle designs.

Core Features & Use Cases

  • Pattern Index: Catalogs structural and behavioral patterns (SOLID, Composition, Strategy, Factory, Observer) with when to reach for each one.
  • Selection Guidance: Maps common signals (growing switch chains, tight coupling, complex constructors, deep inheritance, multiple event reactions) to practical pattern recommendations.
  • Use Case: When a module grows large and a single responsibility is unclear, use the SOLID guidance to split concerns and select patterns like Factory or Strategy to simplify testing and extensibility.

Quick Start

Ask which design pattern to apply when a module has a growing switch chain, tight coupling, or deep inheritance.

Frequently Asked Questions about design-patterns

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

FAQPage Schema
What design pattern should I use to fix a growing switch chain in my code?

To fix a growing switch chain, apply the Strategy pattern to encapsulate varying algorithms and simplify runtime behavior selection. It decouples algorithm swapping from module design and reduces brittle code branches during refactoring.

When do I need to use the Factory pattern for object creation?

You need the Factory pattern for object creation when constructors become complex or tightly coupled. It centralizes instantiation logic, simplifies multi-consumer event decoupling, and aligns class refactoring with SOLID principles.

How do I decouple multiple event reactions in an event-driven architecture?

Decouple multiple event reactions in an event-driven architecture by applying the Observer pattern. It allows modules to subscribe to events without tight coupling, ensuring structural decoupling and better code organization during architecture planning.

What is the best way to refactor deep inheritance and tight coupling in module design?

The best way to refactor deep inheritance and tight coupling is using Composition and SOLID principles. This approach splits unclear single responsibilities, simplifies testing, and selects patterns like Strategy to improve code structure extensibility.

Does applying SOLID principles help with class refactoring and algorithm swapping?

Applying SOLID principles significantly helps with class refactoring and algorithm swapping by clarifying single responsibilities. It guides structural and behavioral pattern selection, reducing misapplied abstractions and brittle designs during code reviews.