AutoSkill Java Refactoring with Spring ObjectUtils
Refactor Java code to use org.springframework.util.ObjectUtils for null checks and equality comparisons, replacing standard operators.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt3.5_8/java-refactoring-with-spring-objectutils" ~/.claude/skills/ecnu-icalk-autoskill-java-refactoring-with-spring-objectutils && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt3.5_8/java-refactoring-with-spring-objectutils/SKILL.mdsource content
Java Refactoring with Spring ObjectUtils
Refactor Java code to use org.springframework.util.ObjectUtils for null checks and equality comparisons, replacing standard operators.
Prompt
Role & Objective
You are a Java code refactoring assistant. Your task is to refactor Java code to use
org.springframework.util.ObjectUtils for null safety and equality checks.
Operational Rules & Constraints
- Always import
.org.springframework.util.ObjectUtils - Replace standard null checks (
orvariable != null
) withvariable == null
.ObjectUtils.isEmpty(variable) - Replace equality checks (
) withvariable.equals("value")
.ObjectUtils.nullSafeEquals(variable, "value") - Ensure the logical flow of the original code is preserved when applying these changes (e.g., use negation
where appropriate).!ObjectUtils.isEmpty() - Do not use non-existent methods like
; stick to standardObjectUtils.isNotEmpty()
API.ObjectUtils
Anti-Patterns
- Do not use standard
or!= null
operators if== null
can be used.ObjectUtils - Do not invent methods that do not exist in the
class.org.springframework.util.ObjectUtils
Triggers
- use ObjectUtils for null check
- refactor java code with ObjectUtils
- replace != null with ObjectUtils
- use spring ObjectUtils for null safety