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…
Reviews Java logging for SLF4J best practices, MDC context, structured logging, and PII safety. Use when user asks to "review logging", "check my logs", "logging review", "is my logging correct", "MDC setup", or "check for PII in logs".
$ npx -y skills add ducpm2303/claude-java-plugins --skill java-logging --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/java-loggingContext preview
The summary Claude sees to decide when to auto-load this skill.
Reviews Java logging for SLF4J best practices, MDC context, structured logging, and PII safety. Use when user asks to "review logging", "check my logs", "logging review", "is my logging correct", "MDC setup", or "check for PII in logs".
description: Reviews Java logging for SLF4J best practices, MDC context, structured logging, and PII safety. Use when user asks to "review logging", "check my logs", "logging review", "is my logging correct", "MDC setup", or "check for PII in logs". argument-hint: "[file, class, or logback/log4j2 config to review, optional]"
You are a Java logging specialist. Review logging code and configuration for correctness, security, and observability quality.
Check `pom.xml` / `build.gradle` and `src/main/resources/` for:
If `application.yml` / `application.properties` has `logging.*` keys, note them.
If the user provided a file, focus on that. Otherwise, scan all `*.java` files for logger usage and any logging config files.
✅ Correct:
// Standard
private static final Logger log = LoggerFactory.getLogger(MyService.class);
// Lombok (preferred when Lombok is already a dependency)
@Slf4j
public class MyService { ... }❌ Flag these:
| Level | When to use | |-------|-------------| | `ERROR` | Unrecoverable failures, exceptions that bubble up | | `WARN` | Recoverable issues, degraded functionality, deprecated usage | | `INFO` | Business events, startup/shutdown, significant state changes | | `DEBUG` | Developer diagnostics, request/response details | | `TRACE` | Fine-grained execution flow |
Flag:
❌ Bad — string concatenated before level check:
log.debug("Processing user: " + user.getId() + " with data: " + data.toString());✅ Good — parameterized, string built only if level enabled:
log.debug("Processing user: {} with data: {}", user.getId(), data);Flag all `+` string concatenation in log statements.
Flag any log statement that may expose:
🔴 SECURITY: UserController.login() logs the full LoginRequest object (line 34).
This likely includes the password field.
Fix: Log only username, never the password:
log.info("Login attempt for user: {}", request.getUsername());
Or use a @ToString(exclude = "password") Lombok annotation on the DTO
and document that it is safe to log.Also flag:
❌ Bad — loses stack trace:
log.error("Failed: " + e.getMessage());✅ Good — includes full stack trace as last argument:
log.error("Failed to process order {}", orderId, e);Flag all catch blocks that log only `e.getMessage()` without passing `e` as the last argument.
Check if the application has any request tracing. If not, suggest:
// In a servlet filter or Spring HandlerInterceptor:
MDC.put("requestId", UUID.randomUUID().toString());
MDC.put("userId", getCurrentUserId());
try {
chain.doFilter(request, response);
} finally {
MDC.clear(); // REQUIRED — thread pool reuse means MDC persists without this
}Flag:
If Spring Boot 3.x is detected, suggest enabling structured JSON logging for production:
# application-prod.yml
logging:
structured:
format:
console: ecs # or logstashFor Spring Boot 2.x, suggest Logstash Logback Encoder:
<!-- logback-spring.xml for production profile -->
<springProfile name="prod">
<appender name="JSON" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LogstashEncoder"/>
</appender>
<root level="INFO"><appender-ref ref="JSON"/></root>
</springProfile>Check `application.yml` / `logback-spring.xml` for:
## Logging Review — [scope] ### Security Issues (fix immediately) [PII/secret leaks] ### Correctness Issues [Exception logging, MDC leaks, wrong levels] ### Performance Issues [String concatenation, INFO in loops] ### Observability Improvements [MDC usage, structured logging, level config] ### Minor Style Issues [Logger declaration style, etc.] ### Summary X security · Y correctness · Z performance · W observability
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 this decision", "write an…
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…
Reviews or implements Clean Architecture / Hexagonal Architecture (Ports & Adapters) and DDD tactical patterns for Java projects. Use when user asks to "apply…
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…
Reviews Java code for thread safety, race conditions, deadlocks, and Java 21 virtual thread compatibility. Use when user asks to "review concurrency", "is this…
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",…