·law-of-demeter
</>

law-of-demeter

デメテルの法則(最小知識の原則)に基づくコードレビューと設計支援。オブジェクトの連鎖呼び出し (Train Wreck)を検出し、直接の友人とのみ会話する設計へ変換する。結合度の低減と 変更容易性の向上を促進する。コードレビュー、新規実装、リファクタリング時に オブジェクト間の結合が深い場合に使用。 対象言語: Java, Kotlin, Scala, TypeScript, Python, Ruby, Go, Rust。 トリガー:「デメテルの法則」「連鎖呼び出しを減らしたい」「Train Wreckを直して」 「結合度を下げたい」「ドット連鎖が多い」「最小知識の原則」「Law of Demeter」 といったオブジェクト間結合関連リクエストで起動。

13Installs·2Trend·@j5ik2o

Installation

$npx skills add https://github.com/j5ik2o/okite-ai --skill law-of-demeter

How to Install law-of-demeter

Quickly install law-of-demeter AI skill to your development environment via command line

  1. Open Terminal: Open your terminal or command line tool (Terminal, iTerm, Windows Terminal, etc.)
  2. Run Installation Command: Copy and run this command: npx skills add https://github.com/j5ik2o/okite-ai --skill law-of-demeter
  3. Verify Installation: Once installed, the skill will be automatically configured in your AI coding environment and ready to use in Claude Code, Cursor, or OpenClaw

Source: j5ik2o/okite-ai.

SKILL.md

View raw

Karl Liebherr(1987年、ノースイースタン大学)が提唱。正式名称は「最小知識の原則(Principle of Least Knowledge)」。

| 連鎖呼び出し | a.getB().getC().doX() | 内部構造に依存、変更に脆い | | 委譲 | a.doX() | 結合度が低い、変更に強い |

| 1 | 自身(this / self)のメソッド | 自分のクラスに定義されたメソッド | | 2 | M の引数として渡されたオブジェクトのメソッド | パラメータ経由の直接の友人 | | 3 | M 内で生成したオブジェクトのメソッド | 自分が作ったオブジェクトは友人 | | 4 | 自身のインスタンス変数(フィールド)のメソッド | 保持しているオブジェクトは友人 |

デメテルの法則(最小知識の原則)に基づくコードレビューと設計支援。オブジェクトの連鎖呼び出し (Train Wreck)を検出し、直接の友人とのみ会話する設計へ変換する。結合度の低減と 変更容易性の向上を促進する。コードレビュー、新規実装、リファクタリング時に オブジェクト間の結合が深い場合に使用。 対象言語: Java, Kotlin, Scala, TypeScript, Python, Ruby, Go, Rust。 トリガー:「デメテルの法則」「連鎖呼び出しを減らしたい」「Train Wreckを直して」 「結合度を下げたい」「ドット連鎖が多い」「最小知識の原則」「Law of Demeter」 といったオブジェクト間結合関連リクエストで起動。 Source: j5ik2o/okite-ai.

Facts (cite-ready)

Stable fields and commands for AI/search citations.

Install command
npx skills add https://github.com/j5ik2o/okite-ai --skill law-of-demeter
Category
</>Dev Tools
Verified
First Seen
2026-03-10
Updated
2026-03-10

Browse more skills from j5ik2o/okite-ai

Quick answers

What is law-of-demeter?

デメテルの法則(最小知識の原則)に基づくコードレビューと設計支援。オブジェクトの連鎖呼び出し (Train Wreck)を検出し、直接の友人とのみ会話する設計へ変換する。結合度の低減と 変更容易性の向上を促進する。コードレビュー、新規実装、リファクタリング時に オブジェクト間の結合が深い場合に使用。 対象言語: Java, Kotlin, Scala, TypeScript, Python, Ruby, Go, Rust。 トリガー:「デメテルの法則」「連鎖呼び出しを減らしたい」「Train Wreckを直して」 「結合度を下げたい」「ドット連鎖が多い」「最小知識の原則」「Law of Demeter」 といったオブジェクト間結合関連リクエストで起動。 Source: j5ik2o/okite-ai.

How do I install law-of-demeter?

Open your terminal or command line tool (Terminal, iTerm, Windows Terminal, etc.) Copy and run this command: npx skills add https://github.com/j5ik2o/okite-ai --skill law-of-demeter Once installed, the skill will be automatically configured in your AI coding environment and ready to use in Claude Code, Cursor, or OpenClaw

Where is the source repository?

https://github.com/j5ik2o/okite-ai