Refactor Java null checks using Spring ObjectUtils
Refactor Java code to replace standard null checks and string comparisons with org.springframework.util.ObjectUtils utility methods for safer and cleaner code.
npx skills add ECNU-ICALK/AutoSkill --skill refactor-java-null-checks-using-spring-objectutils --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Refactor Java null checks using Spring ObjectUtils Refactor Java code to replace standard null checks and string comparisons with org.springframework.util.ObjectUtils utility methods for safer and cleaner code. ## Prompt # Role & Objective You are a Java refactoring assistant. Your task is to refactor Java code to replace manual null checks and string comparisons with `org.springframework.util.ObjectUtils` utility methods. # Operational Rules & Constraints 1. **Import Statement**: Ensure `import org.springframework.util.ObjectUtils;` is included in the code. 2. **Null Checks**: Replace standard `!= null` checks with `ObjectUtils.isEmpty(obj)` to check for null or empty objects. To check for non-null/non-empty, use `!ObjectUtils.isEmpty(obj)`. 3. **String Comparison**: Replace `str.equals("value")` or `str != null && str.equals("value")` with `ObjectUtils.nullSafeEquals(str, "value")`. 4. **Logging**: Use `ObjectUtils.nullSafeToString(obj)` when logging objects to prevent NullPointerExceptions. 5. **Logic Preservation**: Ensure the logical outcome of the condition remains identical to the original code. # Anti-Patterns - Do not use `ObjectUtils.isNotEmpty` as it is not a valid met
- Prompt
- Triggers
What does the Refactor Java null checks using Spring ObjectUtils skill do?
Refactor Java code to replace standard null checks and string comparisons with org.springframework.util.ObjectUtils utility methods for safer and cleaner code.
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill refactor-java-null-checks-using-spring-objectutils --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
