functional-domain-modeling-ts

functional-domain-modeling-ts is a skill for Claude Code, Codex from amadeus-dlc/amadeus. It costs 94 tokens per session (1,526 once invoked), scanned A, original, Apache-2.0.

Guidance for functional domain modeling in TypeScript, a style that uses data types and functions instead of classes and interfaces. It covers factories, private closure state, branded validated types, and explicit result or error values.

In plain words
What is it for?
Use it when designing or reviewing TypeScript domain types, factory functions, immutable public objects, smart constructors, event stores, and typed error handling.
Why use it?
It helps teams apply this specific style consistently when modeling business rules without class-based objects.

Skill for Claude CodeCodex

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

Good fit Use it when designing or reviewing TypeScript domain types, factory functions, immutable public objects, smart constructors, event stores, and typed error handling.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/amadeus-dlc/amadeus/functional-domain-modeling-ts
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 amadeus-dlc/amadeus --skill functional-domain-modeling-ts
Clone the repo
git clone --depth 1 https://github.com/amadeus-dlc/amadeus

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 functional-domain-modeling-ts

README.md
[![agentmods](https://agentmods.dev/badge/skills/amadeus-dlc/amadeus/functional-domain-modeling-ts/github.svg)](https://agentmods.dev/skills/amadeus-dlc/amadeus/functional-domain-modeling-ts)
Your own site
<a href="https://agentmods.dev/skills/amadeus-dlc/amadeus/functional-domain-modeling-ts"><img src="https://agentmods.dev/badge/skills/amadeus-dlc/amadeus/functional-domain-modeling-ts/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 functional-domain-modeling-ts

Your own site · 80×15
<a href="https://agentmods.dev/skills/amadeus-dlc/amadeus/functional-domain-modeling-ts"><img src="https://agentmods.dev/badge/skills/amadeus-dlc/amadeus/functional-domain-modeling-ts.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 94 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,526 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.00094 $0.01526
Opus 5 $0.00047 $0.00763
Sonnet 5 $0.00019 $0.00305
Haiku 4.5 $0.00009 $0.00153

Measured 10d ago against content hash 3d13b24a3324, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

functional-domain-modeling-ts 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 10d 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.

amadeus/spaces/default/knowledge/amadeus-shared/software-design/functional-domain-modeling-ts/SKILL.md · 114 lines

How it starts

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

Functional Domain Modeling (TypeScript)

class / interface を使わず、データ = 型、振る舞い = 関数で構成する TypeScript スタイル。Scott Wlaschin『Domain Modeling Made Functional』の流儀を TypeScript のイディオムに落としたもの。正準実装例は j5ik2o/event-store-adapter-js packages/library

適用条件: 方式依存。プロジェクトがこのスタイルを採用する場合のみ適用し、採用プロジェクトは memory/project.md にこのガイドへのポインタルールを追加する(索引 ../README.md の運用に従う)。

構成イディオム(5つ)

1. type エイリアスによる構造的契約 — interface の代替

契約はメソッドシグネチャを持つ type で定義する。実装側に implements 宣言は不要で、構造的互換で満たされる。

export type EventStore<AID extends AggregateId, /* ... */> = {
  persistEvent(event: E, expectedVersion: number): Promise<Result<void, EventStoreError>>;
  getLatestSnapshotById(id: AID): Promise<A | undefined>;
};

2. ファクトリ関数 + クロージャ — class の代替

コンストラクタの代わりに create* ファクトリ関数。private フィールドの代わりにクロージャ変数。返すオブジェクトリテラルは Object.freeze する。実装関数は internal/ に置き、公開はコンパニオンオブジェクト経由に限定する。

function createMemoryEventStore<...>(input = {}): EventStore<...> {
  const events = new Map(/* クロージャに閉じた可変状態 */);
  function appendEvent(id: string, event: E): void { /* 内部ヘルパー */ }
  return Object.freeze({
    async persistEvent(event, expectedVersion) { /* ... */ },
  });
}

3. コンパニオンオブジェクトパターン — static メンバの代替

同名の typenamespace を宣言マージし、コンストラクタ関数・ファクトリを namespace 側に置く(名前は Scala 由来)。namespace 自体も Object.freeze する。

export type Result<T, E> = { type: "ok"; value: T } | { type: "err"; error: E };

export namespace Result {
  export function ok<T>(value: T): Result<T, never> {
    return Object.freeze({ type: "ok", value });
  }
  export function err<E>(error: E): Result<never, E> {
    return Object.freeze({ type: "err", error });
  }
}

Object.freeze(Result);

利用側は Result.ok(x)EventStore.createMemory(input) のように型名を経由して呼ぶ。

4. ブランド型 + スマートコンストラクタ — 公称型の擬似再現

プリミティブに unique symbol のブランドを交差させ、検証を通ったコンパニオンの create だけがその型を作れるようにする(parse-dont-validate の型システム版)。

Read the full file on GitHub · 114 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. 10d ago First seen · 114 lines · 94 tokens per session scan A 3d13b24a3324

Subscribe to this mod's changes

functional-domain-modeling-ts is a skill published in the GitHub repository amadeus-dlc/amadeus (8 stars, last pushed 19d ago), licensed Apache-2.0. It adds 94 tokens to every session and 1,526 once invoked, about $0.0005 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-08-31.

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

aws-sst-development

SST v4 (Ion) expert for managing AWS resources as code with the Pulumi-backed framework.

sickn33/agentic-awesome-skills · 26 tokens

dd-code-generation

Use pup CLI for immediate Datadog operations or generate code for integration into applications.

DataDog/pup · 16 tokens

fast-typescript-check

Keep www-sacred's TypeScript fast to type-check and fast to run. Use when touching the ASCII/canvas animation components (the only real per-frame code here), tightening type-check wall-clock, or auditing a change for runtime or compiler regressions. Scoped to this repo — a React 19 / Next.js 16 component library plus…

internet-development/www-sacred · 84 tokens

typescript-magician

Designs complex generic types, refactors any types to strict alternatives, creates type guards and utility types, and resolves TypeScript compiler errors. Use when the user asks about TypeScript (TS) types, generics, type inference, type guards, removing any types, strict typing, type errors, infer, extends…

mcollina/skills · 108 tokens

drizzle-migrations

Drizzle ORM schema management and SQLite migrations — adding tables, modifying columns, creating indexes, generating and running migrations, Drizzle query patterns. NOT for Prisma, TypeORM, Sequelize, or raw SQL migration tools.

curiositech/some_claude_skills · 48 tokens