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

java-code-upgradeJava 代码 upgrade

Agent Skill

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

总安装

256

周安装

11

GitHub Stars

2

下载量

90
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/darshitpp/java-code-upgrade --skill java-code-upgrade

简介

用于辅助 Java 项目开发、面向对象设计和 Spring 生态集成。

  • 适合分析类结构、设计接口、整理服务分层或生成测试代码。
  • 使用时需结合项目已有架构、包结构和依赖版本,避免仅按教程修改代码。
  • 涉及数据库、事务或并发配置时,应先确认运行环境和回归测试范围。
  • java-code-upgrade 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Java Evolved — Code Upgrade Skill

Modernize Java code by identifying legacy patterns and suggesting modern replacements with before/after examples sourced from 113 patterns across 11 categories (Java 7 through Java 25).

Procedures

Step 1: Determine Upgrade Scope

  1. Identify the target JDK version for the project. Check pom.xml, build.gradle, or .java-version for the configured source/target level. If unspecified, ask the user.
  2. Identify which categories are relevant to the task:

- language — var, records, sealed classes, pattern matching, switch expressions, text blocks - collections — immutable factories, sequenced collections, unmodifiable collectors - strings — isBlank, strip, repeat, lines, formatted, text blocks - streams — toList, mapMulti, gatherers, takeWhile/dropWhile, optional improvements - concurrency — virtual threads, structured concurrency, scoped values, stable values - io — HTTP client, Files API, Path.of, transferTo, memory-mapped files - errors — helpful NPE, multi-catch, optional chaining, null-in-switch - datetime — java.time API, Duration/Period, HexFormat, Math.clamp - security — PEM encoding, KDF, strong random, TLS defaults - tooling — JShell, single-file execution, JFR, AOT preloading - enterprise — EJB to CDI, Servlet to JAX-RS, JDBC to JPA/jOOQ, SOAP to REST, Spring modernization

  1. If performing a full codebase scan, proceed to Step 2. If upgrading specific code, skip to Step 3.

Step 2: Scan for Legacy Patterns

  1. Read references/detection-patterns.md to load the detection signature database.
  2. For each relevant category, search the codebase for the detection signatures listed:

- Use grep/search for the specific code patterns documented (e.g., Collections.unmodifiableList, new Thread(, .trim().isEmpty()) - Track each match with file path, line number, and matched pattern slug.

  1. Execute python3 scripts/find-pattern.py --data-dir references/ --category {cat} --max-jdk {target} --format full to retrieve the complete before/after transformation for each detected pattern.
  2. Group findings by priority:

- Quick wins: beginner difficulty, drop-in replacements (e.g., var, List.of(), String.isBlank()) - Moderate: intermediate difficulty, may require testing (e.g., records, sealed classes, virtual threads) - Significant: advanced difficulty, architectural changes (e.g., structured concurrency, enterprise migrations)

  1. Format results using assets/upgrade-report-template.md.

Step 3: Upgrade Specific Code

  1. Identify which legacy pattern the code uses. If unsure, read references/detection-patterns.md and match against the code.
  2. Look up the specific pattern by executing: python3 scripts/find-pattern.py --data-dir references/ --keyword "{pattern_name}" --format full
  3. Read the relevant category reference file from references/{category}.md for the complete transformation including:

- Before/after code examples - Explanation of why the modern approach is better - JDK version requirements - Related patterns to consider alongside

  1. Apply the transformation following the modern code example. Adapt to the specific codebase context — do not blindly copy-paste.
  2. Check for related patterns that often co-occur. The reference files list related patterns for each entry.

Step 4: Enterprise Migration Path

If the codebase involves Java EE or early Jakarta EE, read references/enterprise.md for the complete migration mappings:

  • EJB to CDI beans
  • Servlet to JAX-RS endpoints
  • JSF managed beans to CDI named beans
  • JNDI lookups to CDI injection
  • JPA EntityManager to Jakarta Data repositories
  • SOAP web services to Jakarta REST
  • Message-driven beans to reactive messaging
  • Manual transactions to declarative @Transactional
  • Spring XML configuration to annotation-driven
  • Spring null safety to JSpecify

Step 5: Validate Upgrades

  1. Verify the target JDK version supports all applied patterns. Each pattern specifies its minimum JDK version.
  2. Ensure no pattern requires a JDK version higher than the project target.
  3. Run the project's existing test suite to confirm no regressions.
  4. For patterns marked as preview features, verify the project enables preview: --enable-preview.

Quick Reference by JDK Version

JDKKey Patterns
7multi-catch, diamond operator
8default/static interface methods, streams, CompletableFuture, java.time
9List/Set/Map.of(), Optional.or/ifPresentOrElse, private interface methods, Stream.ofNullable/takeWhile/dropWhile, process API
10var, unmodifiable copy, Optional.orElseThrow
11String.isBlank/strip/repeat/lines, HTTP client, Path.of, single-file execution, Predicate.not
12String.indent/transform, Files.mismatch, Collectors.teeing
14switch expressions, helpful NPE
15text blocks, String.formatted
16records, Stream.toList, mapMulti, unmodifiable collectors, record-based errors, static members in inner classes
17sealed classes, RandomGenerator, HexFormat
18built-in HTTP server
19executor try-with-resources, Thread.sleep(Duration)
21virtual threads, pattern matching (instanceof + switch), sequenced collections, unnamed variables, guarded patterns, null-in-switch, Math.clamp
22unnamed variables, multi-file source, FFM API (call C from Java), file memory mapping
23markdown Javadoc
24stream gatherers
25structured concurrency, scoped values, stable values, flexible constructors, compact source files, module imports, primitive patterns, AOT preloading, PEM encoding, KDF, IO class

Error Handling

  • If scripts/find-pattern.py fails with a file-not-found error, verify the --data-dir points to the references/ directory containing the category markdown files.
  • If a pattern requires a JDK version higher than the project target, flag it as "future upgrade" rather than applying it.
  • If the YAML data files are missing, the reference markdown files in references/ contain all pattern data and can be used directly without the script.
  • If a detection signature matches but the code context differs from the pattern (e.g., intentional use of old API), skip the suggestion and note why.

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

37.47%
按下载量换算34

Claude

28.9%
按下载量换算26

Cursor

18.22%
按下载量换算16

Gemini CLI

8.75%
按下载量换算8

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

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

安装前确认

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

来源信息

继续浏览同类 Skills