Skip to content
eld-model-law-discovery logo

LDE Law/Vocabulary Discovery

eld-model-law-discovery

コードベースや要件からVocabulary(語彙)とLaw(守るべき条件)を自動発見するスキル。 名辞抽象(Term/Type)と関係抽象(Law/制約)の両方を抽出し、 /lde-term-card および /lde-law-card への入力を生成する。 使用タイミング: (1) 新規プロジェクトでVocabulary/Lawを洗い出す時、 (2) 既存コードからLaw/Termを抽出する時、(3) 「Lawを発見して」「語彙を抽出して」、 (4) LDEをレトロフィットする時、(5) Phase A-Bで初期Catalogを作る時

SKILL.md

Full skill instructions

LDE Law/​Vocabulary Discovery

コードベースや要件からVocabulary候補とLaw候補を自動発見する。

発見の二軸

抽象発見対象成果物
名辞抽象Term/​Type/​Value/​ContextVocabulary Catalog → Term Card
関係抽象Law/制約/写像Law Catalog → Law Card

Vocabulary発見(名辞抽象)

発見ソース

ソース発見対象抽出方法
型定義Entity/​Value Objectinterface/​type/​classを検索
Zodスキーマ値制約z.object/​z.string等を解析
Brand型意味的区別Brand/​Newtype定義を検索
ドメインモデル概念domain/​models配下を分析
API定義I/​O境界の語彙Request/​Response型を解析

発見プロセス

Step 1: 型・語彙の収集
# 型定義を検索
grep -r "interface\|type\|class\|Brand" src/
# Zodスキーマを検索
grep -r "z\.object\|z\.string\|z\.number" src/
Step 2: Term候補生成
term_candidate:
  id: TERM-<domain>-<name>
  source:
    file: <発見元ファイル>
    line: <行番号>
  meaning: <推定される意味>
  type_shape: <型表現>
  context: <使用文脈>
  io_boundaries: <I/​O境界>
  confidence: high | medium | low
  needs_review: <確認が必要な点>

Law発見(関係抽象)

発見ソース

ソース発見対象抽出方法
Zodスキーマ入力制約スキーマ定義を解析
アサーション不変条件assert/​invariant文を検索
テスト期待値事後条件expect/​assertを解析
catch節例外ポリシーエラーハンドリングを抽出
ビジネスロジックドメインルール条件分岐を分析
障害履歴防御すべき条件過去のバグから抽出

発見プロセス

Step 1: 制約の収集
# バリデーション・アサーションを検索
grep -r "assert\|invariant\|validate" src/
grep -r "throw new.*Error\|reject\|fail" src/
Step 2: Law候補生成
law_candidate:
  id: LAW-<domain>-<name>
  type: Pre | Post | Invariant | Policy
  source:
    file: <発見元ファイル>
    line: <行番号>
    pattern: <検出パターン>
  statement: <自然言語での記述>
  formal_ish: <疑似式>
  terms: [<関連するTerm候補>]
  confidence: high | medium | low
  needs_review: <確認が必要な点>

パターン分類

Vocabulary(名辞)パターン

パターンTerm種別例
interface EntityTerm(エンティティ)interface Order
type Brand<T>Type(ブランド型)type OrderId = Brand<string>
z.number().min().max()Value(値制約)z.number().min(1).max(100)
// Context: XXXContext(文脈)コメントから抽出

Law(関係)パターン

パターンLaw Type例
if (!condition) throwPre入力検証
assert(a === b)Invariant状態整合性
expect(result).toBe(x)Post出力保証
if (role === 'admin')Policy権限判断

発見例

Zodからの抽出

// 発見元
const OrderSchema = z.object({
  quantity: z.number().min(1).max(100),
  price: z.number().positive(),
});

// 抽出されるTerm候補
// TERM-order-quantity: 注文数量(1〜100の整数)
// TERM-order-price: 注文価格(正の数)

// 抽出されるLaw候補
// LAW-pre-order-quantity: 1 ≤ quantity ≤ 100
//   Terms: [TERM-order-quantity]
// LAW-pre-order-price: price > 0
//   Terms: [TERM-order-price]

アサーションからの抽出

// 発見元
class Inventory {
  reserve(qty: number) {
    assert(this.available >= qty, 'Insufficient stock');
    // ...
    assert(this.available === this.total - this.reserved);
  }
}

// 抽出されるTerm候補
// TERM-inventory-available: 利用可能在庫
// TERM-inventory-total: 総在庫
// TERM-inventory-reserved: 予約済み在庫

// 抽出されるLaw候補
// LAW-pre-reserve-stock: available >= qty
//   Terms: [TERM-inventory-available]
// LAW-inv-available-balance: available = total - reserved
//   Terms: [TERM-inventory-available, TERM-inventory-total, TERM-inventory-reserved]

出力形式

Discovery Report

# LDE Discovery Report

## Summary
- Vocabulary候補: 12件 (High: 8, Medium: 3, Low: 1)
- Law候補: 15件 (High: 9, Medium: 4, Low: 2)

---

## Vocabulary候補(名辞抽象)

### High Confidence (即座にTerm Card化可能)

#### TERM-order-quantity
- **Source**: src/​orders/​schema.ts:12
- **Meaning**: 注文数量
- **Type/​Shape**: `z.number().min(1).max(100)`
- **Context**: 注文処理
- **Action**: → `/​lde-term-card` でカード化

### Medium Confidence (確認推奨)

#### TERM-user-balance (要確認)
- **Source**: src/​users/​account.ts:45
- **Meaning**: ユーザー残高(推定)
- **Needs Review**: 一時的なマイナスを許可するか確認

---

## Law候補(関係抽象)

### High Confidence (即座にLaw Card化可能)

#### LAW-pre-order-quantity
- **Type**: Pre
- **Source**: src/​orders/​schema.ts:12
- **Statement**: 注文数量は1以上100以下
- **Formal**: 1 ≤ orderQty ≤ 100
- **Terms**: [TERM-order-quantity]
- **Action**: → `/​lde-law-card` で正式化

### Medium Confidence (確認推奨)

#### LAW-inv-user-balance (要確認)
- **Type**: Invariant
- **Source**: src/​users/​account.ts:120
- **Statement**: ユーザー残高は非負
- **Terms**: [TERM-user-balance]
- **Needs Review**: 一時的なマイナス残高を許可するケースがあるか確認

---

## 相互拘束チェック

### 孤立リスク
- Law候補で参照Termが不明確: 2件
- Term候補で関連Lawがなし: 3件

### 推奨アクション
1. LAW-policy-discount: 参照するTermを明確化
2. TERM-customer-tier: 関連するLawを検討

既存Catalogとの照合

チェック内容
重複検出既存TermやLawと重複していないか
類似統合類似した定義の統合を提案
矛盾検出既存定義と矛盾していないか

使用例

User: このプロジェクトからVocabularyとLawを発見して

Claude:
## LDE Discovery実行中...

### Step 1: ソース収集
- src/配下を走査中...
- 型定義: 35件検出
- バリデーション: 23件検出
- アサーション: 8件検出

### Step 2: Vocabulary候補生成
- Term候補: 12件生成

### Step 3: Law候補生成
- Law候補: 15件生成

### Step 4: 相互拘束チェック
- 孤立リスク: 5件検出

---

## Discovery Report

### High Confidence Vocabulary (8件)
1. TERM-order-quantity → `/​lde-term-card`
2. TERM-inventory-available → `/​lde-term-card`
...

### High Confidence Laws (9件)
1. LAW-pre-order-quantity → `/​lde-law-card`
   Terms: [TERM-order-quantity]
2. LAW-inv-available-balance → `/​lde-law-card`
   Terms: [TERM-inventory-available, TERM-inventory-total, TERM-inventory-reserved]
...

Vocabulary CatalogとLaw Catalogを初期化しますか?

品質優先原則(Superpowers統合)

核心原則

  1. Epistemic Humility: 推測を事実として扱わない。unknownと言う勇気を持つ
  2. Evidence First: 結論ではなく因果と証拠を中心にする
  3. Minimal Change: 最小単位で変更し、即時検証する
  4. Grounded Laws: Lawは検証可能・観測可能でなければならない
  5. Source of Truth: 真実は常に現在のコード。要約はインデックス

「速さより質」の実践

  • 要件の曖昧さによる手戻りを根本から排除
  • テストなし実装を許さない
  • 観測不能な変更を防ぐ

完了の定義

  • Evidence Ladder目標レベル達成
  • Issue Contractの物差し満足
  • Law/​Termが接地している(Grounding Map確認)
  • Link Mapに孤立がない
  • ロールバック可能な状態

停止条件

以下が発生したら即座に停止し、追加計測またはスコープ縮小:

  • 予測と現実の継続的乖離(想定外テスト失敗3回以上)
  • 観測不能な変更の増加(物差しで検証できない変更)
  • ロールバック線の崩壊(戻せない変更の発生)

More Other skills

Delegate independent tasks to specialized agents working concurrently with isolated context.

295.4K 206.3K
View

Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.

179.7K 100.1K
View

Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.

179.7K 89.5K
View

A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).

179.7K 76.1K
View

Fundamental design principles for writing maintainable, testable Python code.

40.2K 21.9K
View

Modern responsive layouts using container queries, fluid typography, CSS Grid, and mobile-first strategies.

40.2K 20K
View

Generate Playwright tests from scenarios using interactive browser exploration and validation.

39.7K 18.2K
View

Modern React state management with Redux Toolkit, Zustand, Jotai, and React Query for every state category.

40.2K 14.7K
View

GDPR-compliant data handling with consent management, data subject rights, and privacy controls.

40.2K 14.3K
View

Python error handling patterns including input validation, exception hierarchies, and partial failure handling. Use when implementing validation logic, designing exception strategies, handling batch processing failures, or building robust APIs.

40.2K 13.5K
View

Detailed multi-file refactor planning with safety checks and rollback guidance.

39.7K 13K
View