/java-solid
Checks Java code for SOLID principles violations with Java-specific patterns. Use when user asks to "check SOLID principles", "is this good OOP", "single responsibility", "SOLID violations", "open closed principle", or "dependency inversion".
$ npx -y skills add ducpm2303/claude-java-plugins --skill java-solid --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/java-solid
Context preview
The summary Claude sees to decide when to auto-load this skill.
Checks Java code for SOLID principles violations with Java-specific patterns. Use when user asks to "check SOLID principles", "is this good OOP", "single responsibility", "SOLID violations", "open closed principle", or "dependency inversion".
SKILL.md
java-solid.SKILL.mddescription: Checks Java code for SOLID principles violations with Java-specific patterns. Use when user asks to "check SOLID principles", "is this good OOP", "single responsibility", "SOLID violations", "open closed principle", or "dependency inversion".
argument-hint: "[paste class or paste multiple related classes]"
allowed-tools: Read, Grep, Glob
Review the provided Java code for SOLID principles violations. For each principle, check for violations and suggest targeted improvements. Tailor suggestions to the detected Java version.
S — Single Responsibility Principle
A class should have one reason to change.
**Violations to flag:**
- Classes named `*Manager`, `*Helper`, `*Utils` with more than 3 unrelated methods
- Service classes that also contain validation logic, email sending, AND database calls
- Classes with more than ~200 lines (often a signal of multiple responsibilities)
- Methods that do multiple distinct things (parse + validate + persist + notify)
**Fix pattern:** Extract each responsibility into its own class. Show the split.
O — Open/Closed Principle
Open for extension, closed for modification.
**Violations to flag:**
- `if/else` or `switch` chains on type/status that would require modification to add new types
- Hard-coded behaviour that should be configurable
- Direct instantiation of concrete classes in business logic (use interfaces)
**Fix pattern:** Introduce Strategy, Template Method, or polymorphism. Show the refactoring.
L — Liskov Substitution Principle
Subtypes must be substitutable for their base types.
**Violations to flag:**
- Subclass overrides a method by throwing `UnsupportedOperationException`
- Subclass weakens preconditions (accepts nulls when parent doesn't)
- Subclass strengthens postconditions (returns more restricted type)
- Square extends Rectangle anti-pattern
**Fix pattern:** Use composition over inheritance, or restructure the hierarchy.
I — Interface Segregation Principle
Clients should not depend on interfaces they don't use.
**Violations to flag:**
- Interfaces with more than ~5 methods where implementors only use some
- `implements` classes that leave methods empty or throw `UnsupportedOperationException`
- Fat service interfaces used by clients that only call 1–2 methods
**Fix pattern:** Split the fat interface into focused role interfaces.
D — Dependency Inversion Principle
Depend on abstractions, not concretions.
**Violations to flag:**
- Field or constructor takes a concrete class (`new UserServiceImpl`) instead of an interface (`UserService`)
- `new ConcreteClass()` inside business logic instead of dependency injection
- Static utility method calls deep in business logic that prevent testing
- `@Autowired` on a concrete class field instead of an interface
**Fix pattern:** Introduce interface + constructor injection. Show the change.
Output format
For each violation: 1. **Principle violated:** (S/O/L/I/D) 2. **Location:** class + method 3. **Problem:** what rule is broken and why it matters 4. **Fix:** before/after code
End with: **SOLID Score** — how many of the 5 principles are cleanly satisfied (e.g., "3/5 — S, I, D pass; O and L need attention").
Next Steps
- For O violations → run `/java-design-pattern` to find the right pattern
- For D violations → run `/java-refactor` to extract interfaces
- For SRP violations → run `/java-refactor` to split classes
Read more
description: Checks Java code for SOLID principles violations with Java-specific patterns. Use when user asks to "check SOLID principles", "is this good OOP", "single responsibility", "SOLID violations", "open closed principle", or "dependency inversion". argument-hint: "[paste class or paste multiple related classes]" allowed-tools: Read, Grep, Glob
Review the provided Java code for SOLID principles violations. For each principle, check for violations and suggest targeted improvements. Tailor suggestions to the detected Java version.
S — Single Responsibility Principle
A class should have one reason to change.
**Violations to flag:**
- Classes named `*Manager`, `*Helper`, `*Utils` with more than 3 unrelated methods
- Service classes that also contain validation logic, email sending, AND database calls
- Classes with more than ~200 lines (often a signal of multiple responsibilities)
- Methods that do multiple distinct things (parse + validate + persist + notify)
**Fix pattern:** Extract each responsibility into its own class. Show the split.
O — Open/Closed Principle
Open for extension, closed for modification.
**Violations to flag:**
- `if/else` or `switch` chains on type/status that would require modification to add new types
- Hard-coded behaviour that should be configurable
- Direct instantiation of concrete classes in business logic (use interfaces)
**Fix pattern:** Introduce Strategy, Template Method, or polymorphism. Show the refactoring.
L — Liskov Substitution Principle
Subtypes must be substitutable for their base types.
**Violations to flag:**
- Subclass overrides a method by throwing `UnsupportedOperationException`
- Subclass weakens preconditions (accepts nulls when parent doesn't)
- Subclass strengthens postconditions (returns more restricted type)
- Square extends Rectangle anti-pattern
**Fix pattern:** Use composition over inheritance, or restructure the hierarchy.
I — Interface Segregation Principle
Clients should not depend on interfaces they don't use.
**Violations to flag:**
- Interfaces with more than ~5 methods where implementors only use some
- `implements` classes that leave methods empty or throw `UnsupportedOperationException`
- Fat service interfaces used by clients that only call 1–2 methods
**Fix pattern:** Split the fat interface into focused role interfaces.
D — Dependency Inversion Principle
Depend on abstractions, not concretions.
**Violations to flag:**
- Field or constructor takes a concrete class (`new UserServiceImpl`) instead of an interface (`UserService`)
- `new ConcreteClass()` inside business logic instead of dependency injection
- Static utility method calls deep in business logic that prevent testing
- `@Autowired` on a concrete class field instead of an interface
**Fix pattern:** Introduce interface + constructor injection. Show the change.
Output format
For each violation: 1. **Principle violated:** (S/O/L/I/D) 2. **Location:** class + method 3. **Problem:** what rule is broken and why it matters 4. **Fix:** before/after code
End with: **SOLID Score** — how many of the 5 principles are cleanly satisfied (e.g., "3/5 — S, I, D pass; O and L need attention").
Next Steps
- For O violations → run `/java-design-pattern` to find the right pattern
- For D violations → run `/java-refactor` to extract interfaces
- For SRP violations → run `/java-refactor` to split classes
A Claude Code plugin marketplace with 3 focused plugins for Java developers. All plugins support Java 8 through Java 21 and tailor advice to your target Java version.
Other skills on claude-java-plugins.
- /java-adr
Creates, lists, and manages Architecture Decision Records for Java projects. Use when user asks to "create an ADR", "document this decision", "write an architecture decision", "add ADR", "list decisions", "show ADRs", or "record this architectural choice".
Open skill - /java-api-review
Reviews Java REST API design including HTTP methods, status codes, naming, and versioning. Use when user asks to "review my API", "check REST design", "is this good REST", "review endpoints", "API design review", "check my controller", or "review HTTP API".
Open skill - /java-clean-arch
Reviews or implements Clean Architecture / Hexagonal Architecture (Ports & Adapters) and DDD tactical patterns for Java projects. Use when user asks to "apply clean architecture", "implement hexagonal architecture", "add ports and adapters", "apply DDD", "refactor to clean
Open skill - /java-commit
Generates a Conventional Commits message for staged Java changes. Use when user asks to "write a commit message", "help me commit", "what should my commit say", "summarize my changes", "draft a commit", or "create commit message".
Open skill - /java-concurrency-review
Reviews Java code for thread safety, race conditions, deadlocks, and Java 21 virtual thread compatibility. Use when user asks to "review concurrency", "is this thread safe", "check for race conditions", "concurrency issues", or "virtual thread compatible".
Open skill - /java-design-pattern
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".
Open skill

