Nullability Contract Review

Nullability Contract Review is a skill for Claude Code from s977043/river-review. It costs 24 tokens per session (1,667 once invoked), scanned A, original, MIT.

A code review rule for values that may be missing, null, empty, or not-a-number. It checks both function contracts and the code that consumes their results.

In plain words
What is it for?
It reviews return types, null and undefined checks, empty collections, optional values, and unsafe type assertions or conversions.
Why use it?
It catches runtime errors caused by using absent data as though it were always present, including unchecked results from searches, maps, nested properties, and number conversions.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the river-review plugin — 139 skills, 18 commands, 5 agents, 3 hooks shipped together

Good fit It reviews return types, null and undefined checks, empty collections, optional values, and unsafe type assertions or conversions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/s977043/river-review/nullability-contract
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add s977043/river-review --skill nullability-contract
Clone the repo
git clone --depth 1 https://github.com/s977043/river-review

Made for: Claude Code.

Or install river-review, the plugin that ships this one along with the rest of its 139 skills, 18 commands, 5 agents, 3 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for Nullability Contract Review

README.md
[![agentmods](https://agentmods.dev/badge/skills/s977043/river-review/nullability-contract/github.svg)](https://agentmods.dev/skills/s977043/river-review/nullability-contract)
Your own site
<a href="https://agentmods.dev/skills/s977043/river-review/nullability-contract"><img src="https://agentmods.dev/badge/skills/s977043/river-review/nullability-contract/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for Nullability Contract Review

Your own site · 80×15
<a href="https://agentmods.dev/skills/s977043/river-review/nullability-contract"><img src="https://agentmods.dev/badge/skills/s977043/river-review/nullability-contract.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 24 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,667 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00024 $0.01667
Opus 5.5 $0.00010 $0.00667
Sonnet 5.5 $0.00005 $0.00333
Haiku 4.5 $0.00002 $0.00167

Measured 1mo ago against content hash 9f431abda97e, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

Nullability Contract Review scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugin-dist/river-review/skills/midstream/nullability-contract/SKILL.md · 93 lines

How it starts

The opening of the file, as written. The whole thing — 93 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Pattern declaration

Primary pattern: Reviewer Secondary patterns: Inversion Why: null/undefined/emptyの処理漏れはランタイムエラーの主要因。差分内の関数・API境界でnullability契約が明示・遵守されているかをレビューする。

Rule / ルール

  • 関数の戻り値がnull/undefinedを返す可能性がある場合、型シグネチャに明示する(T | null、T | undefined、T | null | undefined)。
  • 呼び出し元でnull/undefinedチェックを省略しないこと。
  • 配列・オブジェクトの空ケース(空配列[]、空オブジェクト{})もnullと同様に考慮する。
  • Optional chainingのみでは不十分な場合(次の処理でnullが伝播する場合)は明示的なearly returnを使用する。

Heuristics / 判定の手がかり

  • 戻り値型にnull/undefinedを含む関数の呼び出しで、nullチェックなしにプロパティアクセスや関数呼び出しが行われている。
  • Array.find() / Array.at() などundefinedを返しうる配列メソッドの結果を直接使用している。
  • Map.get() の結果をノーチェックで使用している。
  • オブジェクトのプロパティアクセスが深くネストされており、中間のnull可能性がケアされていない。
  • as string / ! などで型システムをバイパスしてnull可能性を握りつぶしている。
  • parseInt / parseFloat / Number() / 暗黙の数値・文字列変換の結果をNaNチェックなしに使用しており、変換失敗が下流へ伝播する(型変換によるデータ損失)。

Good / Bad Examples

  • Good: const item = map.get(key); if (!item) return null; return item.value;
  • Bad: return map.get(key)!.value;
  • Good: const found = items.find(x => x.id === id); if (!found) throw new Error(\Item ${id} not found`);`
  • Bad: return items.find(x => x.id === id).name;
  • Good: function getUser(id: string): User | null { ... } と戻り値型で明示。
  • Bad: function getUser(id: string): User { ... } でnullを返す可能性を隠蔽。

Actions / 改善案

  • null/undefinedを返しうる箇所の型シグネチャを修正し、呼び出し元でのチェックを徹底する。
  • Array.find() / Map.get() などの結果はunwrapするか早期returnする。
  • 非 null アサーション(!)を除去し、型ガードまたはearly returnで代替する。
  • nullableな値を扱うユーティリティ(Optional<T> パターン等)の導入を検討する。

Non-goals / 扱わないこと

  • TypeScriptのstrictモード設定変更提案(別スキルのスコープ)。
  • null許容を意図的に使用しているライブラリAPI(外部依存)の型定義修正。
  • コードベース全体の型定義一貫性の監査(差分外のコードは対象外)。

Pre-execution Gate / 実行前ゲート

このスキルは以下の条件がすべて満たされない限りNO_REVIEWを返す。

  • 差分にTypeScriptファイル(*.ts または *.tsx)が含まれている
  • 差分にnull/undefined/emptyを返しうる処理またはそれらを受け取る処理が含まれている
  • inputContextにdiffが含まれている

ゲート不成立時の出力: NO_REVIEW: nullability-contract — null/undefined処理のTypeScript差分がない

False-positive guards / 抑制条件

Read the full file on GitHub · 93 lines

Files

What ships with it

6 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 93 lines · 24 tokens per session scan A 9f431abda97e

Subscribe to this mod's changes

Nullability Contract Review is a skill published in the GitHub repository s977043/river-review (7 stars, last pushed yesterday), licensed MIT. It adds 24 tokens to every session and 1,667 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

review-all

Multi-agent code review for diffs (project-agnostic). Covers standards, bugs, security, DRY, smells, perf, tests, API contracts, a11y/i18n. Verifies each finding to eliminate false positives. Use for /review-all, pre-PR/pre-commit review, or auditing uncommitted/staged changes.

ncoevoet/claude-review-all · 74 tokens

logic-review

Find logic bugs in a single file or function via semi-formal execution tracing (Premises → Trace → Divergence → Trigger → Remedy). Trigger when a user shares code and suspects something is wrong without naming a concrete failure — phrases like "review this", "does this look right", "check this function", "audit this…

hyhmrright/logic-lens · 161 tokens

logic-fix-all

Autonomous repository-wide audit-and-fix pipeline: health → review → locate/explain → fix → diff-verify → iterate until clean. Starts with a mandatory consent prompt (token-intensive); after consent runs hands-free. Trigger when the user wants ALL logic issues found and fixed — "fix everything", "fix all logic…

hyhmrright/logic-lens · 211 tokens

logic-health

Sweep a directory, module, or full codebase for logic correctness and produce a scored health dashboard with systemic patterns. Trigger when the user requests a health view — "audit the whole codebase", "health check", "health overview", "logic health overview", "audit src/", "audit auth and payments modules", "where…

hyhmrright/logic-lens · 180 tokens

logic-locate

Locate the root cause of a CONFIRMED failure via backward-then-forward semi-formal tracing. Trigger when the user provides a stack trace, failing assertion, error message, or specific wrong-value observation — "find the bug", "this test is failing", "track down this crash", "why is this test failing", "KeyError at…

hyhmrright/logic-lens · 177 tokens

logic-explain

Explain what a specific piece of code actually does for a given input by producing a step-by-step execution trace (interprocedural, with name resolution and type transitions). Trigger when the user is confused about behavior or asks why code produces X instead of Y — "walk me through this", "trace through X with input…

hyhmrright/logic-lens · 171 tokens