Type-Driven Design Guard

Type-Driven Design Guard is a skill for Claude Code from s977043/river-review. It costs 26 tokens per session (1,965 once invoked), scanned A, original, MIT.

A TypeScript design review that checks whether important domain concepts have clear types and whether invalid states are prevented by the type system. A domain concept is a meaningful idea in the product, such as a user ID, order, or payment state.

In plain words
What is it for?
It is for reviewing changed TypeScript code for overuse of plain strings or numbers, missing domain types, and state models that should use explicit alternatives.
Why use it?
It helps prevent different values from being confused and makes the code's allowed states easier to understand.

Skill for Claude Code

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

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

Good fit It is for reviewing changed TypeScript code for overuse of plain strings or numbers, missing domain types, and state models that should use explicit alternatives.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/s977043/river-review/type-driven-design
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 type-driven-design
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 140 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 Type-Driven Design Guard

README.md
[![agentmods](https://agentmods.dev/badge/skills/s977043/river-review/type-driven-design/github.svg)](https://agentmods.dev/skills/s977043/river-review/type-driven-design)
Your own site
<a href="https://agentmods.dev/skills/s977043/river-review/type-driven-design"><img src="https://agentmods.dev/badge/skills/s977043/river-review/type-driven-design/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 Type-Driven Design Guard

Your own site · 80×15
<a href="https://agentmods.dev/skills/s977043/river-review/type-driven-design"><img src="https://agentmods.dev/badge/skills/s977043/river-review/type-driven-design.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 26 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,965 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.00026 $0.01965
Opus 5.5 $0.00010 $0.00786
Sonnet 5.5 $0.00005 $0.00393
Haiku 4.5 $0.00003 $0.00197

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

Security

Grade A, and why

Type-Driven Design Guard 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 3mo 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/type-driven-design/SKILL.md · 162 lines

How it starts

The opening of the file, as written. The whole thing — 162 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: プリミティブ型の濫用やドメイン型の欠如をチェックリスト型で評価するが、TypeScript以外の変更では実行不要

Goal / 目的

  • 型を「仕様書」として扱い、ドメイン概念をプリミティブ型のまま放置しないようにする。
  • 不正な状態を型レベルで表現不可能にする("make illegal states unrepresentable")。

Non-goals / 扱わないこと

  • any の排除や型アサーションの削減(typescript-strict のスコープ)。
  • null/undefined のガードや非 null アサーションの排除(typescript-nullcheck のスコープ)。
  • 既存の関数シグネチャ(差分に含まれていない)のリファクタ提案。
  • tsconfig.json の設定変更。
  • スタイル/命名規則のレビュー(nit は出さない)。

Pre-execution Gate / 実行前ゲート

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

  • 差分にTypeScriptファイル(.ts, .tsx)の変更が含まれている
  • 差分がテストファイル(*.spec.ts, *.test.ts, __tests__/**)のみではない
  • inputContextにdiffが含まれている

ゲート不成立時の出力: NO_REVIEW: type-driven-design — Type-Driven Design評価の対象となるTypeScriptコード変更が検出されない

False-positive guards / 抑制条件

  • ブランド型がリポジトリに既に存在し、差分コードがそれを正しく使用している場合(code_search で確認)。
  • string の引数が 1 つしかなく、他のプリミティブとの混入可能性がない場合。
  • 外部 API レスポンスやライブラリ型を直接扱う境界コードで、ブランド型の適用範囲が明確でない場合(注記として返す)。
  • 小さなユーティリティ関数で、ドメインの文脈を持たない場合。

Rule / ルール

  • ドメイン概念を表す string / number にはブランド型 (UserId, OrderId, Price 等) を使う。
  • 複数の状態を boolean フラグや status: string で表現するのではなく、判別可能なユニオン型(Discriminated Union)でモデリングする。
  • 新規の public 関数/メソッドのシグネチャに string / number が連続して並ぶ場合、引数が混入可能か確認する。
  • リテラルユニオンが複数箇所でインライン定義されている場合、型エイリアスへの切り出しを促す。

Evidence / 根拠の取り方

  • 指摘は差分に紐づける(<file>:<line> で追える内容)。
  • ブランド型が既にコードベースに存在するかを code_search で確認し、根拠を示す。
  • 推測を断定しない(不確実なら "可能性" として書く)。

Output / 出力

<file>:<line>: <message> 形式。コメントは日本語で返す。

  • Finding: 何が問題か(1文)
  • Impact: 何が困るか(短く)
  • Fix: 次の一手(最小の修正案)

例:

  • src/order.ts:15: userId と orderId が同じ string 型。引数の順序を間違えてもコンパイルエラーにならない。Fix: ブランド型 UserId / OrderId を導入

Heuristics / 判定の手がかり

  • (userId: string, orderId: string) のように同じプリミティブ型が複数の引数に並ぶ。
  • status: 'pending' | 'active' | 'deleted' のようなリテラルユニオンが型エイリアスに切り出されていない。
  • isLoading: boolean; isError: boolean; isSuccess: boolean のように boolean フラグが複数並び、排他性が型で表現されていない。
  • type State = { loading: true } | { error: Error } | { data: Data } のような判別可能なユニオンが使えるのに使われていない。
  • ブランド型が既にコードベースに存在するのに、差分では素の string / number を使っている。

Read the full file on GitHub · 162 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. 3mo ago First seen · 162 lines · 26 tokens per session scan A 035a8494a22a

Subscribe to this mod's changes

Type-Driven Design Guard is a skill published in the GitHub repository s977043/river-review (8 stars, last pushed today), licensed MIT. It adds 26 tokens to every session and 1,965 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

Type-Driven Design Guard compared with skills from other repositories

Type-Driven Design Guard next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
Type-Driven Design Guards977043/river-reviewSkill8todayMITA26Claude Code
react-frontendiliaal/whetstoneSkill37yesterdayMITA57Claude Code, Codex
exec-typescriptanhnguyen0905/codex-mcpSkill46d agoMITA38Claude Code
fe-buildsh5623/fe-railSkill12d agoMITA57Claude Code
ts-reviewwidnyana/eyay-toolkitsSkill915d agoMITA99Claude Code
node-patternsjdanigo/hydraiaSkill82mo agoMITA0Claude Code
clean-code-tsCassetteTapeCrackle/claude-startersSkill11mo agoMITA36Claude Code