Nullability Contract Review

Nullability Contract Review is a skill for Claude Code, Codex 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 CodeCodex

Part of the river-review plugin — 140 skills, 15 commands, 5 agents, 2 hooks shipped together

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.

agentmods
npx agentmods add skills/s977043/river-review/nullability-contract
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, Codex.

Or install river-review, the plugin that ships this one along with the rest of its 140 skills, 15 commands, 5 agents, 2 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.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.svg" alt="Measured on agentmods" 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. Scan, not verified.
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 $0.00024 $0.01667
Opus 5 $0.00012 $0.00834
Sonnet 5 $0.00005 $0.00333
Haiku 4.5 $0.00002 $0.00167

Measured yesterday against content hash 9f431abda97e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 yesterday.

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.

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 | nullT | undefinedT | 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. yesterday 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 (3 stars, last pushed today), licensed MIT. It adds 24 tokens to every session and 1,667 once invoked, about $0.0001 per session on Opus 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

clean-code

Software quality review and design guidance for any code: naming, cohesion, coupling, duplication, function size, dependency direction, and testability. Use when someone asks to improve, review, refactor, or design code, or asks what good structure looks like here. Routes to the sub-skill matching the kind of work.

rainmanjam/poka-yoke · 68 tokens

llm

AI features you ship to users: structured output, tool schemas, prompt injection, evals. Use when "the model returns bad JSON", "it hallucinates", "stop it calling the wrong tool", "add evals", or an LLM feature can trigger refunds, emails or writes. Covers schema-constrained output, idempotent tool calls…

rainmanjam/poka-yoke · 89 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

run-iteration-eval

Run the Logic-Lens content-eval pipeline for one iteration and produce a scored summary.json — use to measure a skill change. Wraps scripts/run-content-evals.sh (runner, costs tokens) and scripts/grade-iteration.py (grader, free, re-runnable). ALWAYS sync the plugin cache first. Use when the user wants to "run the…

hyhmrright/logic-lens · 108 tokens

sync-skill-cache

Sync the Logic-Lens working-copy skills/ into the installed plugin cache so content-evals test the EDITED skill, not the last published one. ALWAYS run this after editing any skills//SKILL.md or guide/shared file and BEFORE running content-evals — otherwise the eval silently grades stale content and every token is…

hyhmrright/logic-lens · 103 tokens

bump-version

Bump the Logic-Lens version across all six metadata locations at once (package.json, the four plugin manifests, and the README badge), then validate. Use when cutting a release or when npm run validate reports a version mismatch.

hyhmrright/logic-lens · 52 tokens