Java Best Practice Checker

Expert Java code auditor for SE 8–24, flagging performance leaks, threading risks, and modernization gaps.

Install
cmdop skills install agensi-java-best-practice-checker

Java Best Practice Checker is a skill that performs automated static analysis of Java source code across versions SE 8 through SE 24. It is designed for developers and PR reviewers who need structured, context-rich feedback rather than bare lint warnings.

The skill audits code across several domains. For modern syntax, it identifies opportunities to adopt pattern matching (SE 21), unnamed variables (SE 22), and Stream Gatherers (SE 24). For performance, it flags String handling mistakes, wrapper class caching misuse, and JIT-unfriendly patterns. It performs deep analysis of the Collections Framework including the SequencedCollection API introduced in recent Java releases. On the architectural side, it checks dependency injection correctness, OOP encapsulation violations, and Design Pattern implementations. At the JVM level, it looks for garbage collection anti-patterns, memory leaks, and improper resource management. Concurrency hazards covered include thread-safety bugs in Singletons and String Pool bypasses.

Output is a structured report with severity-coded findings using three levels (critical, warning, informational), root-cause analysis for each issue, and side-by-side before/after code blocks. Reports conclude with a Summary Table intended for quick triage by lead developers or PR reviewers. The skill is particularly useful when modernizing legacy codebases toward Java 21+ idioms such as Record Patterns and Virtual Threads.

Use cases

  • Audit a legacy Java 8 codebase for modernization opportunities before a Java 21 migration
  • Detect thread-safety bugs in Singleton implementations during a code review
  • Identify String Pool bypass patterns causing performance degradation
  • Check Collections Framework usage for SequencedCollection API adoption gaps
  • Generate a severity-ranked report for PR review of Java microservices
  • Find memory leaks and resource management issues before a production release

When to use it

  • When reviewing Java code that spans multiple SE versions and needs version-aware guidance
  • When preparing a legacy codebase for migration to Java 21 or later features
  • When a code review requires structured, severity-coded output rather than plain lint output
  • When concurrency correctness and JVM internals need explicit scrutiny alongside style checks

When not to use it

  • When the codebase is not Java — this skill does not cover other JVM languages such as Kotlin or Scala
  • When CI pipeline integration with machine-readable lint formats such as Checkstyle XML is required, as output is a structured prose report
  • When real-time IDE inline suggestions are needed rather than a batch audit report