← ClaudeAtlas

design-patternslisted

Common design patterns with Java examples (Factory, Builder, Strategy, Observer, Decorator, etc.). Use when user asks "implement pattern", "use factory", "strategy pattern", or when designing extensible components.
decebals/claude-code-java · ★ 599 · Web & Frontend · score 82
Install: claude install-skill decebals/claude-code-java
# Design Patterns Skill Practical design patterns reference for Java with modern examples. ## When to Use - User asks to implement a specific pattern - Designing extensible/flexible components - Refactoring rigid code structures - Code review suggests pattern usage --- ## Quick Reference: When to Use What | Problem | Pattern | |---------|---------| | Complex object construction | **Builder** | | Create objects without specifying class | **Factory** | | Multiple algorithms, swap at runtime | **Strategy** | | Add behavior without changing class | **Decorator** | | Notify multiple objects of changes | **Observer** | | Ensure single instance | **Singleton** | | Convert incompatible interfaces | **Adapter** | | Define algorithm skeleton | **Template Method** | --- ## Creational Patterns ### Builder **Use when:** Object has many parameters, some optional. ```java // ❌ Telescoping constructor antipattern public class User { public User(String name) { } public User(String name, String email) { } public User(String name, String email, int age) { } public User(String name, String email, int age, String phone) { } // ... explosion of constructors } // ✅ Builder pattern public class User { private final String name; // required private final String email; // required private final int age; // optional private final String phone; // optional private final String address; // optional private User(Builder builde