Skip to content
eld-model-law-card logo

LDE Law Card作成

eld-model-law-card

LDE(Law-Driven Engineering)のLaw Card作成スキル。 ビジネス上の「守るべき条件」を標準フォーマットで文書化する。 使用タイミング: (1) 新しいLawを追加する時、(2) 既存Lawを更新する時、 (3) Law Catalogに新規エントリを追加する時、(4) Grounding Mapを更新する時

SKILL.md

Full skill instructions

LDE Law Card作成

Law分類

種別定義例
Invariantどの状態でも常に成り立つ条件(状態制約)available = total - reserved
Pre操作を受け付けるための条件(入力制約)orderQty ≤ available
Post操作後に必ず成り立つ条件(出力制約)reserved' = reserved + orderQty
Policy裁量・例外・外部状況を含む判断規則「VIPは上限緩和」

分類時の注意

  • Invariant: 「本当は手続き依存」なのにInvariantと言い張ると事故る
  • Pre: UI/​API境界でまず守る
  • Post: 並行時の意味(同時実行)を別途定義することがある
  • Policy: 純粋関数に落とすなら環境(Context)を入力化する

Law Cardテンプレート

## LAW-<domain>-<name> (ID)
- Type: Invariant | Pre | Post | Policy
- Scope: <module/​usecase/​endpoint/​job>
- Statement: <自然言語 1〜3行>
- Formal-ish: <疑似式 / 型 / predicate(任意だが曖昧さ削減に有効)>

- Terms (required):
  - <このLawが参照するTerm ID。最低1つ必須>
  - 例: TERM-inventory-available, TERM-order-quantity

- Exceptions:
  - <例外条件と理由。無ければ "None">

- Violation Handling:
  - Severity: S0|S1|S2|S3
  - When Violated: reject | compensate | warn | quarantine | audit
  - Owner: <責任者/チーム>

- Verification (at least one):
  - Test: <unit/​property/​test-case>
  - Runtime Check: <assertion/​guard>

- Observability (at least one):
  - Telemetry: law.<domain>.<law_name>.(applied|violated|latency_ms|coverage)
  - Log/​Event: <event name / fields>

相互拘束ルール

  • Lawは孤立禁止: すべてのLawは最低1つのTermを参照する必要がある
  • Terms参照はLink Mapと連動: /​lde-link-map で Law ↔ Term の関係を管理

Severity(重要度)

レベル説明
S0ビジネス停止レベル
S1重大な機能障害
S2部分的な機能劣化
S3軽微・改善レベル

作成手順

  1. Law同定: ビジネス上の「守るべき条件」を特定
  2. 分類: Invariant / Pre / Post / Policy のいずれかに分類
  3. Scope定義: 適用範囲(モジュール/エンドポイント/ジョブ)を明確化
  4. Statement記述: 自然言語で1〜3行で記述
  5. Terms紐付け: このLawが参照するTermを明示(最低1つ必須)
  6. Exceptions定義: 例外条件があれば明記
  7. Handling決定: Severity + 違反時動作 + Owner
  8. Verification設定: Test または Runtime Check を最低1つ
  9. Observability設定: Telemetry または Log/​Event を最低1つ
  10. Link Map更新: /​lde-link-map で Law ↔ Term の関係を記録
  11. Grounding Map更新: Law ↔ Test ↔ Telemetry の対応を記録

実例:在庫の不変条件

## LAW-inv-available-balance
- Type: Invariant
- Scope: `inventory.reserveStock` / `inventory.releaseStock`
- Statement: 利用可能在庫は総在庫から予約済み在庫を引いた値に等しい
- Formal-ish: `∀t: available(t) = total(t) - reserved(t)`

- Terms:
  - TERM-inventory-available(利用可能在庫)
  - TERM-inventory-total(総在庫)
  - TERM-inventory-reserved(予約済み在庫)

- Exceptions:
  - None

- Violation Handling:
  - Severity: S1
  - When Violated: quarantine(出荷停止)| audit(反例保存)
  - Owner: inventory-team

- Verification:
  - Test: `prop_inventory_balance` (PBT)
  - Runtime Check: `assert_balance()` in post-commit hook

- Observability:
  - Telemetry: `law.inventory.available_balance.violated_total`
  - Log/​Event: `inventory.balance.violation` with `{expected, actual, diff}`

実例:注文数量の事前条件

## LAW-pre-order-quantity
- Type: Pre
- Scope: `order.create` API
- Statement: 注文数量は利用可能在庫を超えてはならない
- Formal-ish: `orderQty ≤ available`

- Terms:
  - TERM-order-quantity(注文数量)
  - TERM-inventory-available(利用可能在庫)

- Exceptions:
  - バックオーダー許可商品は例外(Policy LAW-policy-backorder 参照)

- Violation Handling:
  - Severity: S2
  - When Violated: reject(400 Bad Request)
  - Owner: order-team

- Verification:
  - Test: `test_order_quantity_exceeds_available`
  - Runtime Check: Zod schema validation

- Observability:
  - Telemetry: `law.order.quantity_limit.violated_total`
  - Log/​Event: `order.validation.failed` with `{orderQty, available}`

Law Catalog更新

Law Card作成後、Law Catalogに追加:

| ID | Type | Scope | Severity | Owner | Status |
|----|------|-------|----------|-------|--------|
| LAW-inv-available-balance | Invariant | inventory.* | S1 | inventory-team | Active |
| LAW-pre-order-quantity | Pre | order.create | S2 | order-team | Active |

Grounding Map更新

| Law ID | Type | Test | Runtime Check | Telemetry | Notes |
|--------|------|------|---------------|-----------|-------|
| LAW-inv-available-balance | Invariant | prop_inventory_balance | assert_balance | law.inventory.* | - |
| LAW-pre-order-quantity | Pre | test_order_quantity | Zod validation | law.order.* | - |

品質優先原則(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 skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View