jpskill.com
🛠️ 開発・MCP コミュニティ

eventing-hub

Black-Tortoiseのイベントソーシングとイベントバスに関する指示を扱い、イベントスキーマや発行フロー、安全なサブスクライバーを管理するSkill。

📜 元の英語説明(参考)

Event-sourcing and EventBus directives for Black-Tortoise, covering structured event schemas, append-before-publish flow, causality/id rules, and safe subscribers; use when touching src/app/eventing, EventBus, or any event handlers/projections.

🇯🇵 日本人クリエイター向け解説

一言でいうと

Black-Tortoiseのイベントソーシングとイベントバスに関する指示を扱い、イベントスキーマや発行フロー、安全なサブスクライバーを管理するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-17
取得日時
2026-05-17
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

[スキル名] eventing-hub

イベントハブ マスターガイド

目的

src/app/eventing/AGENTS.md および .github/instructions/20-ddd-event-sourcing-copilot-instructions.md で説明されている共有 EventBus のイベント契約、永続化/発行順序、およびコンシューマーの安全性を記述します。

イベントスキーマ

  • イベントは Type、Payload、Metadata、Semantics の構造で宣言します。ペイロードは不変に保ち、許可される変更はすべてメタデータに文書化します。
  • 関連するイベントを結びつけるために correlationId を使用し、トリガーとなるイベントを指す causationId を割り当てます(ルートイベントの場合のみ null)。
  • 集約/アプリケーションサービスから型付きイベントのみを発行し、生の DTO や Firebase オブジェクトは公開しません。

追加 → 発行 → 反応

  • EventBus の発行ステップを呼び出す前に、すべての結果を永続化します(追加)。因果関係のギャップを避けるため、追加/発行を Promise.all や並列フローでラップしないでください。
  • 追加のプロミスが解決した後、イベントを発行し、ダウンストリームのストア/プロジェクションがグローバルな EventBus シングルトンを介して反応できるようにします。
  • 反応は単純なプロジェクションまたは副作用に限定すべきです。長時間実行される作業は、アプリケーション層で処理される専用のユースケースに属します。

因果関係の追跡と不変性

  • 発行されたすべてのイベントについて、因果関係/相関 ID を維持します。追跡のためにログに記録し、監査ツール用にメタデータに含めます。
  • 発行されたイベントは読み取り専用の事実として扱います。コンシューマーは検査できますが、ペイロードやメタデータオブジェクトを変更してはなりません。
  • ブロードキャスト時には Object.freeze() またはディープコピーを使用して、不変性の保証がすべてのサブスクライバーに届くようにします。

安全なサブスクリプション

  • データをプレゼンテーションストアに公開する前に、EventBus の背後にある RxJS ストリームをアプリケーション境界で toSignal() を使用してシグナルに変換します。
  • コンポーネント/ストアが破棄された後もイベントハンドラーがリークしないように、takeUntilDestroyed() またはシグナルベースのクリーンアップでサブスクリプションを保護します。
  • イベントへの反応には @ngrx/signals ストアを優先します。その withMethods ハンドラーは、ストアを直接変更するのではなく、イベントペイロードに基づいて patchState を呼び出すべきです。

検証と監視

  • 追加の前にペイロードスキーマを検証し、ドメイン値オブジェクトを使用して不変条件を強制し(ドメイン層)、無効なデータを早期に拒否します。
  • 追加または発行ステップが失敗したときに監査イベントを発行し、docs/AUDIT-* トラッカーが問題のコンテキストを捕捉できるようにします。
  • 因果関係 ID をオブザーバビリティツールにフィードし、CI またはランタイムトレース中に「追加→発行→反応」チェーンを検証します。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Eventing Hub Master Guide

Intent

Describe event contracts, persistence/publish order, and consumer safety for the shared EventBus described in src/app/eventing/AGENTS.md and .github/instructions/20-ddd-event-sourcing-copilot-instructions.md.

Event Schema

  • Declare events with a Type, Payload, Metadata, and Semantics structure; keep payloads immutable and document any allowed mutations in the metadata.
  • Use a correlationId to tie related events, and assign a causationId that points to the triggering event (null only for root events).
  • Emit only typed events from the Aggregates/Application services; do not publish raw DTOs or Firebase objects.

Append → Publish → React

  • Persist every outcome (Append) before invoking the EventBus publish step; never wrap append/publish in Promise.all or parallel flows to avoid causality gaps.
  • After the append promise resolves, publish the event and let downstream stores/projections react via the global EventBus singleton.
  • Reactions should be limited to simple projections or side effects; long-running work belongs to dedicated use cases handled by the Application layer.

Causality Tracking & Immutability

  • Maintain causation/correlation IDs for every published event; log them for tracing and include them in metadata for audit tooling.
  • Treat emitted events as read-only facts; consumers may inspect but must never mutate payload or metadata objects.
  • Use Object.freeze() or deep copies when broadcasting to ensure immutability guarantees reach all subscribers.

Safe Subscriptions

  • Convert the RxJS stream behind EventBus into signals at the Application boundary using toSignal() before exposing data to Presentation stores.
  • Guard subscriptions with takeUntilDestroyed() or signal-based cleanup so that event handlers do not leak after a component/store is destroyed.
  • Prefer @ngrx/signals stores for reacting to events; their withMethods handlers should call patchState based on event payloads rather than mutating the store directly.

Validation & Monitoring

  • Validate payload schemas before append, using domain value objects to enforce invariants (Domain layer) and rejecting invalid data early.
  • Emit audit events when Append or Publish steps fail so docs/AUDIT-* trackers capture the problem context.
  • Feed causality IDs into any observability tooling to verify the Append→Publish→React chain during CI or runtime tracing.