Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

java-code-reviewJava 代码审查

Agent Skill

用于辅助 Java 项目开发、面向对象设计、Spring 生态、Maven 或 Gradle 依赖和后端工程实践。它适合让 Agent 分析类结构、设计接口、整理服务分层、生成测试或检查常见代码坏味道。使用时需要结合项目已有架构、包结构和依赖版本,不应只按通用教程改代码;涉及数据库、事务、并发或框架配置时,应先确认运行环境和回归测试范围。

总安装

297

周安装

12

GitHub Stars

1

下载量

93
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:java-code-review(Java 代码审查)
来源仓库:https://github.com/theepan/ai-agent-skills
仓库路径:skills/java-code-review
安装命令:
npx skills add https://github.com/theepan/ai-agent-skills --skill java-code-review
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/theepan/ai-agent-skills --skill java-code-review

简介

提供 2-3 句话的概述:代码的用途、整体质量

  • 评估,以及最重要的发现。
  • 研究结果
  • 使用以下结构列出每个发现:
  • [S{n}] {类别}:{简短标题}
  • 位置:文件和行号(如果行未知,则为方法名称)
  • 问题:出了什么问题以及为什么它很重要
  • 建议:具体修复,有帮助时提供代码片段
  • 按严重性(首先是 S1)对结果进行排序,然后按每个严重性中的位置排序。
  • 积极的观察
  • 请注意代码做得很好的 1-3 件事。好的图案、干净的设计或彻底的
  • 错误处理值得肯定。
  • 汇总表
  • 以计数表结束:
  • 严重性
  • 计数
  • S1 关键
  • n
  • S2 高
  • n
  • S3 中型
  • n
  • S4低
  • n
  • 指南
  • 具体一点。引用准确的行号、方法名称和变量名称。
  • 提供具体的修复建议,而不是模糊的建议。
  • 当建议修复时,显示一个简短的代码片段来演示
  • 改善。
  • 不要标记没有正确性或可读性的样式首选项
  • 影响(例如,大括号放置样式),除非代码混合样式
  • 不一致。
  • 对于差异,重点审查更改的行。仅标记预先存在的问题
  • 如果他们与变化相互作用。
  • 如果代码对于单次审查来说太大,请将其分为逻辑部分
  • 部分并进行审查,提供综合摘要。
  • 当不确定意图时,明确陈述假设而不是
  • 做出无声的判断。
  • 每周安装量
  • 12
  • 存储库
  • theepan/ai-Agent Skill
  • GitHub 之星
  • 1
  • 第一次看到
  • 2026 年 2 月 28 日
  • 安全审计
  • Gen Agent Trust Hub 通行证
  • 套接字通行证
  • 斯尼克通行证

SKILL.md

Java Code Review

Review Java source code systematically for correctness, security, performance, and maintainability.

Input Handling

Determine the input type and gather code accordingly:

  1. Direct code -- Code provided in the conversation. Review as-is.
  2. File path(s) -- Read the specified .java files.
  3. Directory path -- Find all .java files recursively. For large codebases (>50 files), ask the user which packages or files to focus on.
  4. Diff/patch content -- Review only the changed lines plus sufficient surrounding context. Focus findings on the changed code.

Review Process

Execute these phases in order. For each finding, assign a severity.

Phase 1: Correctness and Bug Detection

Examine code for:

  • Null safety -- Nullable parameters without checks, Optional misuse, potential NullPointerException paths
  • Resource leaks -- Unclosed streams, connections, or locks. Verify try-with-resources usage for all AutoCloseable types
  • Error handling -- Empty catch blocks, catching overly broad exceptions (Exception, Throwable), swallowed exceptions, missing finally blocks
  • Concurrency -- Race conditions, unsynchronized shared mutable state, incorrect use of volatile, double-checked locking without volatile, ConcurrentModificationException risks
  • Logic errors -- Off-by-one, incorrect operator precedence, unreachable code, broken equals/hashCode contracts
  • API misuse -- Incorrect use of Collections, Streams, Date/Time API, String comparison with == instead of.equals()

Phase 2: Security Review

Read references/security-checklist.md before this phase.

Check for:

  • Injection -- SQL injection (string concatenation in queries), command injection, LDAP injection, XPath injection, log injection
  • Authentication and authorization -- Hardcoded credentials, missing access checks, insecure token handling
  • Data exposure -- Sensitive data in logs, exceptions, or error messages. Unmasked PII
  • Cryptography -- Weak algorithms (MD5, SHA-1 for security), hardcoded keys, insecure random (Math.random for security purposes)
  • Deserialization -- Untrusted ObjectInputStream usage, missing type validation
  • Input validation -- Missing or insufficient validation of external input, path traversal risks

Phase 3: Performance Analysis

Read references/performance-patterns.md before this phase.

Check for:

  • Algorithmic complexity -- O(n^2) or worse in hot paths, unnecessary nested iterations
  • Memory -- Excessive object creation in loops, large collections held longer than needed, missing initial capacity for known-size collections
  • String handling -- String concatenation in loops (use StringBuilder), unnecessary String.format in hot paths
  • I/O -- Unbuffered streams, N+1 query patterns, missing connection pooling, synchronous I/O where async is appropriate
  • Collections -- Wrong collection type for the access pattern, unnecessary copying, missing pre-sizing
  • JVM considerations -- Excessive autoboxing, finalizer usage, classloader leaks

Phase 4: Code Quality and Maintainability

Check for:

  • Design -- God classes, excessive coupling, Liskov substitution violations, missing encapsulation
  • Naming -- Unclear variable/method names, naming convention violations (Java conventions: camelCase methods, PascalCase classes, UPPER_SNAKE constants)
  • Complexity -- Methods exceeding ~30 lines, cyclomatic complexity >10, deeply nested conditionals (>3 levels)
  • Duplication -- Repeated logic that should be extracted
  • Documentation -- Missing Javadoc on public API, outdated comments that contradict code
  • Testing gaps -- Untested public methods, missing edge case tests, no assertions in test methods, test methods that cannot fail
  • AI-generated code smells -- Hallucinated or non-existent API calls, overly verbose boilerplate that could use standard library methods, unnecessary wrapper classes or abstractions that add indirection without value, generic variable names (data, result, temp, info) that obscure intent, contradictory or parroted comments that restate the code without adding insight, TODO/FIXME/placeholder blocks left unimplemented, inconsistent patterns within the same file (e.g., mixing builder and constructor styles, mixing streams and loops for identical tasks), dead code or unreachable branches that suggest generation artifacts

Phase 5: Dependency and License Review

If build files are available (pom.xml, build.gradle, build.gradle.kts), or if import statements reference third-party libraries, check for:

  • License compatibility -- Copyleft licenses (GPL, AGPL, LGPL) in proprietary or permissively licensed projects. Flag any dependency whose license is incompatible with the project's declared license
  • License presence -- Dependencies with no discernible license (treat as all-rights-reserved). Unlicensed code cannot be safely used
  • Copyleft obligations -- LGPL dependencies linked statically (must be dynamic), GPL dependencies in non-GPL projects, AGPL dependencies in network services without source disclosure
  • Transitive risk -- A permissively licensed library that itself depends on a copyleft library. The copyleft obligation propagates
  • Deprecated or unmaintained libraries -- Dependencies with known end-of-life status, no updates in 2+ years, or archived repositories
  • Duplicate functionality -- Multiple libraries solving the same problem (e.g., both Guava and Apache Commons for the same utilities), increasing attack surface and license exposure unnecessarily

Severity Levels

Assign one severity to each finding:

SeverityLabelMeaning
S1CRITICALWill cause data loss, security breach, or production failure. Fix immediately.
S2HIGHLikely to cause bugs, performance degradation, or security weakness in production. Fix before merge.
S3MEDIUMCode smell, maintainability issue, or minor bug risk. Should be addressed.
S4LOWStyle issue, naming suggestion, or minor improvement. Address at discretion.

Output Format

Structure the review as follows:

Summary

Provide a 2-3 sentence overview: what the code does, overall quality assessment, and the most important finding.

Findings

List each finding with this structure:

[S{n}] {Category}: {Brief title}

  • Location: File and line number (or method name if line unknown)
  • Issue: What is wrong and why it matters
  • Suggestion: Concrete fix, with a code snippet when helpful

Order findings by severity (S1 first), then by location within each severity.

Positive Observations

Note 1-3 things the code does well. Good patterns, clean design, or thorough error handling deserve acknowledgment.

Summary Table

End with a count table:

SeverityCount
S1 CRITICALn
S2 HIGHn
S3 MEDIUMn
S4 LOWn

Guidelines

  • Be specific. Reference exact line numbers, method names, and variable names.
  • Provide concrete fix suggestions, not vague advice.
  • When suggesting a fix, show a brief code snippet demonstrating the improvement.
  • Do not flag style preferences that have no correctness or readability impact (e.g., brace placement style) unless the code mixes styles inconsistently.
  • For diffs, focus review on changed lines. Only flag pre-existing issues if they interact with the changes.
  • If the code is too large for a single review, divide it into logical sections and review each, providing a consolidated summary.
  • When uncertain about intent, state the assumption explicitly rather than making a silent judgment.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.93%
按下载量换算33

Claude

30.23%
按下载量换算28

Cursor

19.64%
按下载量换算18

Gemini CLI

10.61%
按下载量换算10

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills