本文へスキップ
Skillpedia
APIとサーバー(バックエンド)81k · #1616

ddd-validate

できること

このスキルは、ドメイン駆動のコードベースを監査して、境界の漏れを見つけます。境界の漏れとは、ある業務領域が別の領域の内部ファイルをインポートしていることです。コードの構造を整えたいチーム向けです。

使う場面

  • ✓業務領域どうしの漏れがないか、コードベースを監査したいとき。
  • ✓複数の領域にまたがる変更をマージする直前のとき。
  • ✓境界の問題を早期に見つけ出す自動チェックがほしいとき。

スキルのリンク

https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-ddd/skills/ddd-validate/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-ddd/skills/ddd-validate/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“コードベースの中で、ほかの領域の内部ファイルに手を伸ばしているコードがないか確認してください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

スキルは各業務領域を見つけ、そのファイルを調べて、別の領域の内部フォルダーへのインポートを探し、エンティティ、イベント名、リポジトリの配置に関するルールを確認します。見つかった問題を一つずつ報告します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Validate domain boundary integrity across all bounded contexts.

Steps

  1. Discover contexts: Scan src/*/domain/ to find all bounded contexts.

  2. Check cross-boundary violations:

    • For each context, scan all .ts files for import statements
    • Flag any import that reaches into another context's domain/ directory directly
    • Allowed: importing from another context's public index.ts (application layer)
    • Violation: importing from src/<other-context>/domain/entities/... directly
    # Find cross-boundary imports
    for ctx in $(find src -maxdepth 2 -name "domain" -type d | sed 's|src/||;s|/domain||'); do
      grep -rn "from ['\"].*src/" "src/$ctx/" --include="*.ts" | grep -v "src/$ctx/" || true
    done
    
  3. Check aggregate invariant enforcement:

    • Scan aggregate root entities for public setters that bypass validation
    • Flag mutable public properties without invariant checks
    • Verify that child entities are not directly accessible (must go through aggregate root)
  4. Check event naming conventions:

    • Domain events should be past-tense named (e.g., OrderCreated, not CreateOrder)
    • Events should be immutable (no public setters)
    • Events should carry the aggregate ID
  5. Check repository patterns:

    • Repository interfaces should exist in domain/repositories/, not infrastructure/
    • Repository implementations should exist in infrastructure/, not domain/
    • Each aggregate root should have exactly one repository
  6. Report findings:

    • Output a table of violations with file path, line number, violation type, and suggestion
    • Categorize as: BOUNDARY, INVARIANT, EVENT, REPOSITORY
    • Exit with summary: total violations, by category, severity
  7. Store results:

    npx @claude-flow/cli@latest memory store --key "ddd-validation-TIMESTAMP" --value "RESULTS_SUMMARY" --namespace tasks
    npx @claude-flow/cli@latest hooks post-task --task-id "ddd-validate" --success true --store-results true
    
よくある質問

何が違反とみなされますか?

別の領域のドメインフォルダーに直接入り込むインポートは、違反として印が付きます。別の領域の公開インデックスからのインポートは許可されます。

問題を自動で修正しますか?

手順は問題の発見と報告に重点を置いています。レポートを確認し、何を変更するかを決めてください。

イベントにはどんな命名ルールがありますか?

ドメインイベントは過去形で命名すべきです。例えば、CreateOrder ではなく OrderCreated とします。

詳細

作者による元の説明

Validate domain boundaries -- detect cross-context import violations and aggregate invariant issues. Use when auditing a DDD codebase for leaks between bounded contexts, before merging cross-cutting changes, or as a CI gate to catch boundary erosion early.

repo: ruvnet/ruflo

人気

GitHubのスター
81k
ランキング
#1616
ライセンス
MIT
更新日
2026/11/2

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル