Null Safety
Use when annotating nullability in Spring Boot 3 / Spring Framework 6 code, integrating Kotlin, or adding static nullability checks without assuming Spring Framework 7 JSpecify defaults.
View SKILL.mdUse the nullability model supported by the project. Spring Framework 6 commonly uses
org.springframework.lang.Nullable, @NonNull, and package-level @NonNullApi. JSpecify can be
introduced deliberately, but do not assume Framework 7 migration semantics in a Boot 3 module.
@NonNullApi
package com.example.orders;
import org.springframework.lang.NonNullApi;
Annotate genuine nullable results and parameters with @Nullable. Keep repository return types
explicit, validate external input at boundaries, and use Kotlin compiler settings that match the
annotations when Java and Kotlin are mixed. If the project standardizes JSpecify independently,
apply it consistently at module boundaries and document the chosen checker.
Gotchas
- Agent assumes Framework 7 JSpecify defaults - Boot 3 projects usually use Spring's legacy annotations.
- Agent uses
@NonNullApiwithout importing the package annotation - package metadata must compile and be checked in. - Agent marks every value
@NonNull- establish a package default and annotate only nullable exceptions. - Agent treats annotations as runtime validation - use Bean Validation or explicit checks for input validation.
- Agent changes a repository's nullable contract without updating callers - preserve
Optional, nullable, and empty collection semantics. - Agent mixes JSpecify and Spring annotations without a migration plan - choose one module boundary policy.
Examples & templates
bad-null-contract.javaexamples
@Nullable
List<String> findNames() { return List.of(); } // nullable contract contradicts empty collection behaviorgood-package-info.javaexamples
@NonNullApi
package com.example.orders;
import org.springframework.lang.NonNullApi;Verification scope
- Compiled sources
- No
- Runtime checks
- No
Coverage describes checked-in fixtures, not a guarantee for every snippet or project.
Coverage matrix & agent evidenceADD TO YOUR AGENTInstall Boot 3 skills
Install Boot 3 skills
claude plugin marketplace add rrezartprebreza/spring-boot-skills
claude plugin install spring-boot-3-skills@spring-boot-skillscodex plugin marketplace add rrezartprebreza/spring-boot-skills
codex plugin add spring-boot-3-skills@spring-boot-skills