design-patterns

Explain common design patterns with practical Java code examples.

70|22|Updated Jun 10, 2020
One-click install
npx skills add https://github.com/piomin/spring-boot-istio --skill design-patterns-piomin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: design-patterns
Source: https://github.com/piomin/spring-boot-istio/tree/main/.claude/skills/design-patterns
Command: npx skills add https://github.com/piomin/spring-boot-istio --skill design-patterns-piomin

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides clear, practical Java examples for common design patterns, helping developers write more maintainable, flexible, and robust code.

Core Features & Use Cases

  • Pattern Explanations: Understand creational, behavioral, and structural patterns.
  • Code Examples: See modern Java implementations for patterns like Factory, Builder, Strategy, Observer, Decorator, and Adapter.
  • Use Case: When designing a system that needs to handle multiple payment methods interchangeably, use this Skill to implement the Strategy pattern.

Quick Start

Show me the Java code for the Builder pattern.

Frequently Asked Questions about design-patterns

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

FAQPage Schema
How do I implement the Strategy pattern in Java for handling multiple payment methods?

To implement the Strategy pattern in Java for flexible payment methods, this Skill provides practical code examples demonstrating how to define interchangeable algorithms, allowing dynamic behavior selection at runtime without altering existing classes.

What is the difference between creational, behavioral, and structural design patterns?

Creational patterns handle flexible object creation, structural patterns manage dynamic behavior addition and object composition, while behavioral patterns focus on decoupled communication between objects. The Skill provides Java examples for each category.

How do I write Java code for the Builder pattern to construct complex objects?

To write Java code for the Builder pattern, this Skill offers modern implementations demonstrating step-by-step construction of complex objects, ensuring maintainable and robust code creation without telescoping constructor anti-patterns.

When should I use the Decorator pattern instead of inheritance in software design?

Use the Decorator pattern in software design when you need dynamic behavior addition without modifying existing classes. This Skill explains how to wrap objects flexibly, avoiding the rigid class hierarchy explosion caused by static inheritance.

Can I find practical Java examples for the Observer and Adapter patterns here?

Yes, you can find practical Java examples for the Observer and Adapter patterns here. The Skill provides modern implementations to achieve decoupled communication and interface compatibility between otherwise incompatible classes.