java-adr
Creates, lists, and manages Architecture Decision Records for Java projects. Use when user asks to "create an ADR", "documentโฆ
Reviews Spring Data JPA for N+1 queries, fetch strategies, projections, and Specifications. Use when user asks to "review JPA", "check for N+1", "JPA performance", "review my entities", "check fetch strategy", or "review my repositories".
Claude Code
$ npx -y skills add ducpm2303/claude-java-plugins --skill java-jpa --agent claude-code
Codex
$ npx skills add ducpm2303/claude-java-plugins --skill java-jpa -a codex -y
Cursor
$ npx skills add ducpm2303/claude-java-plugins --skill java-jpa -a cursor -y
Gemini CLI
$ npx skills add ducpm2303/claude-java-plugins --skill java-jpa -a gemini-cli -y
GitHub Copilot
$ npx skills add ducpm2303/claude-java-plugins --skill java-jpa -a github-copilot -y
OpenCode
$ npx skills add ducpm2303/claude-java-plugins --skill java-jpa -a opencode -y
Windsurf
$ npx skills add ducpm2303/claude-java-plugins --skill java-jpa -a windsurf -y
description: Reviews Spring Data JPA for N+1 queries, fetch strategies, projections, and Specifications. Use when user asks to "review JPA", "check for N+1", "JPA performance", "review my entities", "check fetch strategy", or "review my repositories". argument-hint: "[file or class to review, optional]"
You are a Spring Data JPA specialist. Review JPA code for common performance and correctness problems.
Check `pom.xml` or `build.gradle` for:
If neither is found, ask the user.
If the user provided a file or class name, focus on that. Otherwise, scan for:
Look for:
For each N+1 found, show:
โ ๏ธ N+1 DETECTED: UserService.getUsersWithOrders()
Problem: orders collection loaded lazily inside a loop (line 42)
Fix:
Option A โ @EntityGraph on the repository method:
@EntityGraph(attributePaths = {"orders"})
List<User> findAll();
Option B โ JOIN FETCH in JPQL:
@Query("SELECT u FROM User u JOIN FETCH u.orders")
List<User> findAllWithOrders();Check if entities are returned where only a subset of fields is needed:
๐ก PROJECTION OPPORTUNITY: UserRepository.findAllForList()
Returns full User entity but only id, name, email are used in UserListDto.
Fix: Use an interface projection or record projection (Java 16+):
// Interface projection (Java 8+)
public interface UserSummary {
Long getId();
String getName();
String getEmail();
}
List<UserSummary> findAllBy();
// Record projection (Java 16+, Spring Boot 2.6+)
public record UserSummary(Long id, String name, String email) {}
@Query("SELECT new com.example.UserSummary(u.id, u.name, u.email) FROM User u")
List<UserSummary> findAllSummaries();If dynamic queries are constructed with string concatenation or if/else JPQL building:
๐ก SPECIFICATION OPPORTUNITY: ProductRepository
Dynamic query built with string concatenation is brittle and not type-safe.
Fix: Use JpaSpecificationExecutor<Product> + Specification<Product>:
public static Specification<Product> hasCategory(String category) {
return (root, query, cb) ->
category == null ? null : cb.equal(root.get("category"), category);
}
public static Specification<Product> priceBetween(BigDecimal min, BigDecimal max) {
return (root, query, cb) ->
cb.between(root.get("price"), min, max);
}
// Usage:
repo.findAll(hasCategory(cat).and(priceBetween(min, max)));Produce a structured report:
## JPA Review โ [ClassName or scope] ### Critical Issues [N+1 problems, missing transactions on writes] ### Performance Improvements [Fetch strategies, projections, pagination] ### Design Suggestions [Entity design, Specifications, equals/hashCode] ### Minor Notes [readOnly transactions, GenerationType, etc.] ### Summary X critical ยท Y performance ยท Z design ยท W minor
For each issue include: what was found, why it matters, and the exact fix with code.
After the report, offer:
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.
Creates, lists, and manages Architecture Decision Records for Java projects. Use when user asks to "create an ADR", "documentโฆ
Reviews Java REST API design including HTTP methods, status codes, naming, and versioning. Use when user asks to "review my API",โฆ
Reviews or implements Clean Architecture / Hexagonal Architecture (Ports & Adapters) and DDD tactical patterns for Java projects.โฆ
Generates a Conventional Commits message for staged Java changes. Use when user asks to "write a commit message", "help meโฆ
Reviews Java code for thread safety, race conditions, deadlocks, and Java 21 virtual thread compatibility. Use when user asks toโฆ
Detects GoF patterns in Java code or recommends the right pattern for a problem. Use when user asks to "what pattern is this",โฆ
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, orโฆ
Ask which skill or flow fits your situation. A router over the skills in this repo.