JSpecify Nullness (Java)
SkillDev toolsJSpecify nullness annotations for Java APIs and tooling. Use when adopting or migrating JSpecify annotations, designing null-safe Java signatures, fixing generic bounds and type-use placement, or interpreting Kotlin interop, annotation-processor, and tool-conformance behavior.
Available today. Use it from your connected AI after setup.
No other account needed.
Add ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.
Then ask your AI: use the JSpecify Nullness (Java) skill
What this skill tells your AI
The instructions your AI receives, as published by alexandru/skills in skills/jspecify-nullness/SKILL.md and read by ahel’s review.
Quick start
- Add
org.jspecify:jspecify:1.0.0as a visible API dependency for Java libraries. - Prefer
@NullMarkedat package or class scope; add@Nullableonly wherenullis allowed. - Treat unannotated types outside
@NullMarkedas unspecified nullness, not non-null. - Decide generic bounds deliberately:
<T extends @Nullable Object>accepts nullable type arguments;<T>does not in a null-marked scope. - Keep
@Nullable/@NonNullin JSpecify-recognized type-use locations, especially for arrays, nested types, type arguments, and bounds. - Read
references/jspecify-nullness.mdbefore substantial annotation, migration, or tooling advice.
Workflow
- Confirm consumer constraints: nullness checker, Kotlin compiler behavior, and annotation processors.
- Add the JSpecify dependency without hiding it from downstream users.
- Annotate nullable types first, then add
@NullMarkedat class or package scope. - Fix generics: choose nullable/non-null bounds and annotate type-variable uses only when the use differs from the type argument.
- Compile examples for syntax, then run a JSpecify-aware nullness analyzer and fix findings before expanding scope.
Rules of thumb
- Do not annotate local-variable root types or casts; annotate only nested type arguments/components there.
- For fields, parameters, and returns,
@Nullable String[]means nullable elements;String @Nullable []means the array reference is nullable. - For nested types, annotate the nested type as
Map.@Nullable Entry, not the outer type. - Use
@NonNull Tonly to force a type-variable use non-null when the type argument may be nullable. - Use
@NullUnmarkedonly as an incremental escape hatch inside a null-marked scope.
Output expectations
- Provide annotated signatures and call-site implications.
- Explain generic bound choices and type-use placement.
- Call out tool-conformance limits instead of promising specific diagnostics.
- For skill edits, run
jbang skills/jspecify-nullness/scripts/verify-examples.java.
References
- Load
references/jspecify-nullness.mdfor source-backed guidance, examples, and representative prompts.
Signals
- GitHub stars
- 53
- Forks
- 3
- Last commit
- Sep 2026
Advanced
- Item type
- skill
- Key
jspecify-nullness- Source
- github.com/alexandru/skills