when-to-wrap-primitives

when-to-wrap-primitives is a skill for Claude Code, Codex from j5ik2o/okite-ai. It costs 275 tokens per session (4,181 once invoked), scanned A, original, MIT.

A language-independent design guide for deciding when basic values such as strings or numbers should be wrapped in named domain types. A domain type represents a concept with its own rules, such as an email address or money amount.

In plain words
What is it for?
It supports code reviews, new implementations, and design discussions about value objects and domain-specific types in languages such as Rust, TypeScript, Java, Kotlin, Scala, Go, and Python.
Why use it?
It helps avoid both overly generic data that hides important rules and unnecessary wrapper types that add code without enough benefit.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It supports code reviews, new implementations, and design discussions about value objects and domain-specific types in languages such as Rust, TypeScript, Java, Kotlin, Scala, Go, and Python.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/j5ik2o/okite-ai/when-to-wrap-primitives
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 j5ik2o/okite-ai --skill when-to-wrap-primitives
Clone the repo
git clone --depth 1 https://github.com/j5ik2o/okite-ai

Made for: Claude Code, Codex.

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 when-to-wrap-primitives

README.md
[![agentmods](https://agentmods.dev/badge/skills/j5ik2o/okite-ai/when-to-wrap-primitives/github.svg)](https://agentmods.dev/skills/j5ik2o/okite-ai/when-to-wrap-primitives)
Your own site
<a href="https://agentmods.dev/skills/j5ik2o/okite-ai/when-to-wrap-primitives"><img src="https://agentmods.dev/badge/skills/j5ik2o/okite-ai/when-to-wrap-primitives/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 when-to-wrap-primitives

Your own site · 80×15
<a href="https://agentmods.dev/skills/j5ik2o/okite-ai/when-to-wrap-primitives"><img src="https://agentmods.dev/badge/skills/j5ik2o/okite-ai/when-to-wrap-primitives.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 275 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,181 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.00275 $0.04181
Opus 5 $0.00138 $0.02090
Sonnet 5 $0.00055 $0.00836
Haiku 4.5 $0.00028 $0.00418

Measured 7d ago against content hash 560d0f5c481b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

when-to-wrap-primitives 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 7d 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.

skills/when-to-wrap-primitives/SKILL.md · 325 lines

How it starts

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

プリミティブ型ラップ判断ガイド

プリミティブ型をラップすべきか否かは、コスト対効果で判断する。盲目的にラップするのも、 一切ラップしないのも、どちらも設計の失敗である。

前提: Value Objectの定義は1つではない

「Value Object」という用語は文脈によって意味が異なる。議論やレビューで混乱が生じる主因である。

定義 出典 スコープ 核心
一般的定義 Wikipedia等 最も広い 同等性がIDではなく値に基づくオブジェクト
PofEAA定義 Martin Fowler 実装パターン IDに基づかず値で等価判定される小型オブジェクト。別名参照問題を避けるため不変が推奨
DDD定義 Eric Evans ドメインモデリング PofEAA版の特性をすべて備えた上で、ドメインの概念を計測・定量化・説明し、不変条件と副作用のない振る舞いを持つドメインオブジェクト

DDD版はPofEAA版のextends

DDD版VOとPofEAA版VOは独立した概念ではなく、特化(specialization)の関係にある。

特性 PofEAA VO DDD VO
値による等価判定 必須 必須(継承)
不変性 推奨 必須(強化)
ドメイン不変条件 必須(追加)
ドメイン振る舞い 必須(追加)

つまり:

  • DDD VO IS-A PofEAA VO → すべてのDDD VOはPofEAA VOでもある
  • PofEAA VO IS-A DDD VO → 成立しない(Ruby HashはPofEAA VOだがDDD VOではない)

DDD版は「値で等価判定される」「不変である」というPofEAA版の特性を前提として含んだ上で、 ドメイン固有の要件を追加したものである。2つの定義を並列に見ると、DDD版が PofEAA版の特性も持っていることを見落としやすいので注意。

チーム内では「PofEAAのVO」「DDDのVO」のように文脈を明示して使い分けるべき。

本スキルの立場

本スキルでは、「プリミティブ型をドメイン固有型でラップすべきか」という実践的判断に焦点を当てる。 VOの定義論争には立ち入らず、ラップすることで得られる具体的な利益がコストに見合うかで判断する。

2つのアンチパターン

Primitive Obsession(プリミティブ型への固執)

すべてをString/int/floatで表現し、ドメインの制約がコードに表れない。

fn transfer(from: String, to: String, amount: f64)
// fromとtoを取り違えてもコンパイルが通る
// amountが負でもコンパイルが通る
// 通貨の概念がない

症状:

  • 同じプリミティブ型の引数が2つ以上並ぶ
  • バリデーションロジックが呼び出し側に散在
  • 「この文字列はメールアドレスのはず」という暗黙の前提
  • 単位の取り違え(メートルとフィート、円とドル)

Value Object Obsession(過剰なラップ)

すべてのプリミティブ型を機械的にクラスで包み、複雑性だけが増す。

class CustomerFirstName(value: String)
class CustomerLastName(value: String)
class ShippingFirstName(value: String)  // CustomerFirstNameと何が違う?
class ShippingLastName(value: String)   // 同上

症状:

  • 不変条件やドメインロジックを持たない「ただのラッパー」が大量に存在
  • 文脈ごとに別の型を作るが、中身のバリデーションは同一
  • 型変換のボイラープレートがドメインロジックより多い
  • 新規メンバーが型の森で迷子になる

判断フレームワーク

5つの判断基準

プリミティブ型をラップすべきかを以下の基準で評価する。 1つでも強くYesならラップを検討。複数Yesなら強く推奨。すべてNoならラップ不要。

基準1: ドメイン不変条件があるか

その値に「常に満たすべき制約」があるか?

Read the full file on GitHub · 325 lines

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. 7d ago First seen · 325 lines · 275 tokens per session scan A 560d0f5c481b

Subscribe to this mod's changes

when-to-wrap-primitives is a skill published in the GitHub repository j5ik2o/okite-ai (81 stars, last pushed 4mo ago), licensed MIT. It adds 275 tokens to every session and 4,181 once invoked, about $0.0014 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

no-bare-casts

Writing as in TypeScript or TSX production code, modifying a file that contains a bare as cast, silencing a type error with a cast, encountering as unknown as, or reviewing a cast site.

prisma/orm · 52 tokens

code-review-csharp

Perform structured code reviews of C# source code covering naming conventions, performance, security, readability, and .NET best practices. Trigger phrases include "review this C# code", "check my C# for best practices", "analyze this C# class", "find issues in my C# code".

pnp/copilot-prompts · 66 tokens

solid-principles

SOLID principles checklist with Java examples. Use when a class has too many responsibilities, an abstraction leaks, or a dependency points the wrong way, and when the user asks about Single Responsibility, Open/Closed, Liskov, Interface Segregation or Dependency Inversion. For naming, duplication and method length…

decebals/claude-code-java · 73 tokens

splitting-oversized-modules

Split an oversized Python module (a thousand-plus-line logic.py, models.py, api.py, or its test file) into a package of one module per concern, mechanically and provably without changing behavior. Use on a request to split / break up / decompose a god module or move functions out of one, once a human has agreed to…

PostHog/posthog-foss · 197 tokens

go-concurrency-safety

L1 supplement - audits Go-specific concurrency hazards in node client code: map iteration non-determinism, goroutine leaks, mutex ordering, panic boundaries, context cancellation.

PlamenTSV/plamen · 40 tokens

splitting-oversized-modules

Split an oversized Python module (a thousand-plus-line logic.py, models.py, api.py, or its test file) into a package of one module per concern, mechanically and provably without changing behavior. Use on a request to split / break up / decompose a god module or move functions out of one, once a human has agreed to…

PostHog/posthog · 197 tokens