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.
npx skills add s977043/river-review --skill type-driven-designgit clone --depth 1 https://github.com/s977043/river-reviewWrote 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.
[](https://agentmods.dev/skills/s977043/river-review/type-driven-design)<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.
<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>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.
| Model | Per session | Once 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 |
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.
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を使っている。
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.
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.
- 3mo ago First seen · 162 lines · 26 tokens per session scan A 035a8494a22a
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.
Type-Driven Design Guard compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| Type-Driven Design Guards977043/river-review | Skill | 8 | today | MIT | A | 26 | Claude Code |
| react-frontendiliaal/whetstone | Skill | 37 | yesterday | MIT | A | 57 | Claude Code, Codex |
| exec-typescriptanhnguyen0905/codex-mcp | Skill | 4 | 6d ago | MIT | A | 38 | Claude Code |
| fe-buildsh5623/fe-rail | Skill | 1 | 2d ago | MIT | A | 57 | Claude Code |
| ts-reviewwidnyana/eyay-toolkits | Skill | 9 | 15d ago | MIT | A | 99 | Claude Code |
| node-patternsjdanigo/hydraia | Skill | 8 | 2mo ago | MIT | A | 0 | Claude Code |
| clean-code-tsCassetteTapeCrackle/claude-starters | Skill | 1 | 1mo ago | MIT | A | 36 | Claude Code |