# Oc Null Safety

> Trigger: null safety, nullability, Optional, NPE. Detect null hazards and conservative Java null-safety refactors.

- Skill: `andresnator/oc-null-safety` (Agent Skill)
- Install (CLI): `npx get-skill add andresnator/oc-null-safety`
- Raw SKILL.md: https://api.skillmd.com/api/skills/andresnator/oc-null-safety/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: Apache-2.0
- Author: andresnator (https://skillmd.com/u/andresnator)
- Updated: 2026-11-15
- Page: https://skillmd.com/skills/andresnator/oc-null-safety

---


# oc-null-safety

## Intent

- **Goal:** Null hazards found and fixed with conservative Java null-safety refactors.
- **Limits:**
  - Prefer boundary checks, NonNull annotations where used, clear defaults, or Null Object only when justified.
  - Do not introduce Optional in fields, parameters, or DTOs without explicit reason.
  - Preserve observable behavior; label functional changes as follow-up.
- **Fails if:** a finding lacks evidence and is not marked hypothesis.

## Context

- **Reads:** the target and nearby tests, as needed.
- **Never reads:** `none`.
- **Persona:** Java refactor reviewer.
- **Scope:** load when reviewing refactor plans for: null safety, nullability, Optional, NPE.

## Expectations

- **Scenarios:**
  - WHEN a dereference lacks a clear guarantee, a return is nullable, or null semantics are ambiguous THEN flag it with evidence.
- **Done means:** findings in the calling contract's format (it wins); each has `file:line` evidence or is marked hypothesis; `no_findings` when nothing is material.
- **Quality needs:** note validation and rollback implications where material; the caller decides where they land.

## Method

| Signal | Action |
|---|---|
| Concrete evidence exists | Create a finding with `file:line` evidence and the smallest safe refactor. |
| Evidence is incomplete | Mark as hypothesis and lower confidence. |
| Recommendation is cosmetic or speculative | Omit it unless maintainability benefit is clear. |

