Token导航 LogoToken导航

Agent Skill · 前端设计

refactor-java(refactor Java 测试)

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

refactor-java 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,第三方扫描已通过,按安装量在前端设计类的 10,216 个 Skill 里排第 8,773。

总安装 261周安装 11GitHub Stars 公开资料未说明下载 92核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/andresnator/agents-orchestrator --skill refactor-java

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

用于辅助 Java 后端项目开发和服务架构设计。适合分析类结构、接口定义或优化服务分层。需结合 Spring 生态和项目依赖版本进行适配。安装方式:通过 npx 从指定 GitHub 仓库添加技能。涉及并发或事务处理时应先确认运行环境。

refactor-java 属于前端设计类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/refactor-java

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/andresnator/agents-orchestrator --skill refact…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

refactor-java 怎么安装?

在终端执行 npx skills add https://github.com/andresnator/agents-orchestrator --skill refactor-java。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

refactor-java 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

refactor-java 需要什么权限?

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

refactor-java 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

refactor-java 用的人多吗?

公开数据是累计安装 261 次,近一周安装 11 次,下载 92 次。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

refactor-java 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理前端设计类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
frontend-design

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
refactor-java

refactor Java 测试 · 本页

261—需要联网未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Java Refactoring Catalog Skill

A comprehensive, technique-by-technique catalog of refactoring best practices for Java, sourced from Martin Fowler's *Refactoring: Improving the Design of Existing Code* (2nd Edition) and Alexander Shvets' *Refactoring in Java* (Refactoring Guru).

Core Philosophy

Refactoring is the process of changing the internal structure of code without altering its observable behavior. It is a disciplined technique, not a random cleanup. The golden rule is: Cover → Modify → Refactor (always have tests before you start).

How to Use This Skill

  1. Diagnose first: Identify the code smell (see techniques/00-code-smells-diagnostic.md)
  2. Select technique: Each smell maps to one or more refactoring techniques
  3. Read the technique file: Each technique has its own markdown file in techniques/ with problem description, motivation, step-by-step mechanics, and Java 8 + Java 11 examples
  4. Apply incrementally: Small steps, test after each change, commit frequently

Technique Categories

The techniques are organized in 7 groups. Each technique has its own file in the techniques/ directory.

Group 1: Composing Methods (techniques/01-XX)

Techniques for building clean, well-structured methods. The foundation of all refactoring.

  • 01-extract-method.md — Extract a code fragment into a named method
  • 02-inline-method.md — Replace a method call with the method body
  • 03-extract-variable.md — Give a name to a complex expression
  • 04-inline-variable.md — Remove a variable that adds no clarity
  • 05-replace-temp-with-query.md — Replace temp variables with method calls
  • 06-replace-method-with-method-object.md — Turn a complex method into its own class
  • 07-substitute-algorithm.md — Replace an algorithm with a clearer version

Group 2: Moving Features (techniques/02-XX)

Techniques for placing code where it truly belongs.

  • 08-move-method.md — Move a method to where it has more cohesion
  • 09-move-field.md — Move a field to the class that uses it most
  • 10-extract-class.md — Split a class with multiple responsibilities
  • 11-inline-class.md — Merge a class that does too little
  • 12-hide-delegate.md — Encapsulate chain navigation behind a simpler interface
  • 13-remove-middle-man.md — Remove unnecessary delegation
  • 14-move-statements.md — Move statements into/out of functions, slide statements
  • 15-split-loop.md — Separate a loop that does multiple things
  • 16-replace-loop-with-pipeline.md — Use Stream API instead of imperative loops
  • 17-remove-dead-code.md — Delete unused code

Group 3: Organizing Data (techniques/03-XX)

Techniques for enriching data with behavior and protecting internal state.

  • 18-encapsulate-variable.md — Wrap data access with getters/setters
  • 19-encapsulate-record.md — Convert data structures into objects
  • 20-encapsulate-collection.md — Protect collections from external mutation
  • 21-replace-primitive-with-object.md — Create domain types instead of using raw primitives
  • 22-split-variable.md — Give each purpose its own variable
  • 23-rename-field.md — Improve field names for clarity
  • 24-replace-derived-variable-with-query.md — Calculate values on demand
  • 25-change-reference-to-value.md — Make objects immutable (Value Objects)
  • 26-change-value-to-reference.md — Share a single instance across consumers
  • 27-replace-type-code-with-subclasses.md — Convert type codes to polymorphic hierarchy

Group 4: Simplifying Conditionals (techniques/04-XX)

Techniques for taming conditional complexity.

  • 28-decompose-conditional.md — Name condition and branches
  • 29-consolidate-conditional.md — Merge related conditions
  • 30-replace-nested-conditional-with-guard-clauses.md — Early returns for special cases
  • 31-replace-conditional-with-polymorphism.md — Use OOP instead of switch/if-type
  • 32-introduce-special-case.md — Null Object pattern for default behavior
  • 33-introduce-assertion.md — Document invariants with executable assertions
  • 34-replace-control-flag.md — Replace boolean flags with break/return

Group 5: Simplifying Method Calls / API Design (techniques/05-XX)

Techniques for building self-documenting interfaces.

  • 35-change-function-declaration.md — Rename functions and change parameters
  • 36-introduce-parameter-object.md — Group related parameters into an object
  • 37-parameterize-function.md — Unify similar functions with a parameter
  • 38-remove-flag-argument.md — Replace boolean params with named methods
  • 39-preserve-whole-object.md — Pass the object instead of extracted values
  • 40-replace-parameter-with-query.md — Let the function calculate what it needs
  • 41-replace-query-with-parameter.md — Pass value as param for purity/testability
  • 42-remove-setting-method.md — Make properties read-only
  • 43-replace-constructor-with-factory.md — Use factory methods for flexible creation
  • 44-replace-function-with-command.md — Encapsulate function as object
  • 45-separate-query-from-modifier.md — CQS: separate reads from writes

Group 6: Dealing with Inheritance (techniques/06-XX)

Techniques for refactoring class hierarchies.

  • 46-pull-up-method.md — Move duplicated methods to superclass
  • 47-push-down-method.md — Move specialized methods to subclass
  • 48-pull-up-constructor-body.md — Unify constructor initialization
  • 49-extract-superclass.md — Create common superclass for shared behavior
  • 50-extract-interface.md — Define a contract without implementation
  • 51-collapse-hierarchy.md — Merge unnecessary hierarchy levels
  • 52-form-template-method.md — Template Method pattern from GoF
  • 53-replace-subclass-with-delegate.md — Composition over inheritance
  • 54-replace-superclass-with-delegate.md — Replace extends with has-a
  • 55-replace-inheritance-with-delegation.md — General inheritance to delegation

Group 7: Additional Techniques (techniques/07-XX)

Cross-cutting techniques from both sources.

  • 56-combine-functions-into-class.md — Group functions that share data
  • 57-combine-functions-into-transform.md — Enrich read-only data
  • 58-split-phase.md — Separate code into processing phases
  • 59-introduce-foreign-method.md — Extend third-party classes you can't modify
  • 60-introduce-local-extension.md — Subclass or wrapper for library extension
  • 61-replace-error-code-with-exception.md — Modernize error handling
  • 62-replace-exception-with-test.md — Don't use exceptions for control flow

Diagnostic Guide

Start with techniques/00-code-smells-diagnostic.md to identify which techniques apply to your code. The diagnostic maps 24 code smells to their recommended refactoring techniques.

Applying the Skill

When given Java code to refactor:

  1. Read techniques/00-code-smells-diagnostic.md to identify the smells present
  2. For each identified smell, read the corresponding technique file(s)
  3. Apply techniques in small steps, always testing between changes
  4. Provide both Java 8 and Java 11 versions when the language features differ meaningfully
  5. Explain WHY each refactoring improves the code, not just HOW to do it

Key Principles

These principles underpin every technique in the catalog:

  1. Names matter more than length — a well-named 1-line method is better than an inline expression
  2. Small steps — extract small fragments, test, commit. Never batch multiple changes
  3. Intention over implementation — code should communicate WHAT, not HOW
  4. Data and logic that change together should live together — cohesion is king
  5. Prefer composition over inheritance — delegation is more flexible than extends
  6. Immutability is a powerful preservative — immutable data is easier to reason about
  7. CQS (Command-Query Separation) — a method either returns a value or modifies state, never both

平台分布

Codex

35.45%
按下载量换算33

Claude

28.9%
按下载量换算27

Cursor

20.81%
按下载量换算19

Gemini CLI

9.47%
按下载量换算9

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

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

安装前确认

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

继续浏览同类 Skills