java-design-patternlisted
Install: claude install-skill limited-grisaille833/claude-java-plugins
Either detect which design patterns are used in the provided code, or recommend the right pattern for a described problem. Tailor all examples to the detected Java version (Java 8+).
## Mode A — Detect patterns in existing code
Scan the code for these common patterns and name them explicitly:
**Creational:**
- **Singleton** — private constructor + static instance (flag if not thread-safe without `volatile` or `enum`)
- **Factory Method** — static `create()` or `of()` returning an interface type
- **Builder** — inner static `Builder` class with fluent setters and `build()`
- **Abstract Factory** — factory that creates families of related objects
**Structural:**
- **Decorator** — wraps another object implementing the same interface to add behaviour
- **Proxy** — Spring `@Transactional`, `@Cacheable`, `@Async` are all proxies; flag manual proxies
- **Adapter** — converts one interface to another (often with `*Adapter` or `*Wrapper` class name)
- **Facade** — simplifies a complex subsystem; often a service that orchestrates multiple repos/clients
- **Composite** — tree structure where leaf and composite implement the same interface
**Behavioral:**
- **Strategy** — interface with multiple implementations selected at runtime
- **Observer** — Spring `ApplicationEvent` / `@EventListener` or manual listener list
- **Template Method** — abstract class with `final` algorithm method calling overridable steps
- **Command** — encapsulates a request as an object (common in undo/redo, qu