Java design pattern
Skill limited-grisaille833/claude-java-plugins/plugins/java-core/skills/java-design-pattern
Boost Claude Code with Java plugins for Java 8–21 projects, including core, Spring, and quality checks tailored to your target version
npx -y skills add limited-grisaille833/claude-java-plugins --skill java-design-patternAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Detects GoF patterns in Java code or recommends the right pattern for a problem. Use when user asks to "what pattern is this", "detect design patterns", "suggest a pattern", "should I use factory", "which design pattern", or "recommend a pattern for".
SKILL.md
3.4 KB, as published. Nobody here has run it
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
volatileorenum) - Factory Method — static
create()orof()returning an interface type - Builder — inner static
Builderclass with fluent setters andbuild() - 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,@Asyncare all proxies; flag manual proxies - Adapter — converts one interface to another (often with
*Adapteror*Wrapperclass 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/@EventListeneror manual listener list - Template Method — abstract class with
finalalgorithm method calling overridable steps - Command — encapsulates a request as an object (common in undo/redo, queuing)
- Chain of Responsibility — Spring Security filter chain, Servlet filters
- State — object behaviour changes based on internal state enum/object
For each detected pattern: name it, show the key code that reveals it, explain how it's used here.
Mode B — Recommend a pattern for a problem
When the user describes a problem, recommend the most appropriate pattern:
| Problem | Recommended Pattern |
|---|---|
| Need multiple algorithms interchangeable at runtime | Strategy |
| Object creation is complex, many optional fields | Builder |
| Need to add behaviour without modifying existing class | Decorator |
| Need to notify multiple objects when state changes | Observer |
| Complex subsystem needs a simple interface | Facade |
| Same operation on tree structures | Composite |
| Object has distinct lifecycle states | State |
| Need only one instance globally | Singleton (or Spring @Component) |
Show a minimal Java implementation for the recommended pattern, appropriate for the detected Java version:
- Java 8+: use functional interfaces (Strategy can be a lambda
Function<T,R>) - Java 17+: use sealed classes for State pattern
- Java 16+: use records for value objects in patterns
Output format
Mode A: List each detected pattern with: name + location + explanation + any concerns (e.g., non-thread-safe Singleton) Mode B: Recommend pattern + minimal before/after code + when to use vs alternatives
Next Steps
- After identifying patterns → run
/java-solidto check if patterns are applied correctly - For implementation help → ask the
java-architectagent for full design guidance