
Design Patterns
A solid reference for the patterns you actually use: Factory, Builder, Strategy, Observer, and the rest. It shows both the classic Java approach and modern alternatives with Spring and Lombok, which is helpful since you probably don't want to write boilerplate builders by hand in 2024. The examples are practical, like swapping payment methods at runtime with Strategy or avoiding telescoping constructors with Builder. It's opinionated in the right ways, steering you toward dependency injection over Singleton and showing antipatterns alongside solutions. Best for when you know a pattern would help but can't remember the exact implementation, or when you're teaching someone why their seven-parameter constructor is a code smell.
- skills.sh installs
- 372
- GitHub stars
- 771
- last updated
- Feb 8, 2026
Install
$ npx -y skills add decebals/claude-code-java --skill design-patterns --agent claude-codeInstalls into .claude/skills of the current project.
Files
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.
// ❌ 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
}
Sponsors
Details
- Repository
- github.com/decebals/claude-code-java
- Categories
- Java & JVM, Design & UI/UX
- License
- MIT
- First seen
- Jun 11, 2026
More from decebals/claude-code-java
All 18- Spring Boot Patterns358
- Java Migration357
- Security Audit347
- Performance Smell Detection341
- Test Quality336
- Api Contract Review315
- Maven Dependency Audit308
- Logging Patterns300
- Jpa Patterns297
- Changelog Generator251
- Git Commit249
- Issue Triage240
- Java Code Review1.1K
- Clean Code427
- Concurrency Review384
- Solid Principles384
- Architecture Review374