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

projection-patterns

できること

このツールは、過去のイベント情報を整理して、すばやく検索できるようにするためのものです。データの最適化された「ビュー」を作成します。

使う場面

  • ✓データの現在の状態をリアルタイムで確認したいとき。
  • ✓イベントの履歴から情報を再構築するとき。
  • ✓データの検索をより速く、効率的に行いたいとき。

スキルのリンク

https://github.com/wshobson/agents/blob/main/plugins/backend-development/skills/projection-patterns/SKILL.md

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

使い方

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

貼り付け用メッセージ

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

AIへの頼み方の例

“トランザクションのイベントから、売上データの最適化されたビューを作成するにはどうすればよいですか?”

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

仕組み

イベントの列(実行されたアクションの記録など)を処理して、よりシンプルで分かりやすいデータモデルを作成します。このモデルを使って、質問にすばやく答えます。

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

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

Projection Patterns

Comprehensive guide to building projections and read models for event-sourced systems.

When to Use This Skill

  • Building CQRS read models
  • Creating materialized views from events
  • Optimizing query performance
  • Implementing real-time dashboards
  • Building search indexes from events
  • Aggregating data across streams

Core Concepts

1. Projection Architecture

┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│ Event Store │────►│ Projector   │────►│ Read Model  │
│             │     │             │     │ (Database)  │
│ ┌─────────┐ │     │ ┌─────────┐ │     │ ┌─────────┐ │
│ │ Events  │ │     │ │ Handler │ │     │ │ Tables  │ │
│ └─────────┘ │     │ │ Logic   │ │     │ │ Views   │ │
│             │     │ └─────────┘ │     │ │ Cache   │ │
└─────────────┘     └─────────────┘     └─────────────┘

2. Projection Types

Type Description Use Case
Live Real-time from subscription Current state queries
Catchup Process historical events Rebuilding read models
Persistent Stores checkpoint Resume after restart
Inline Same transaction as write Strong consistency

Templates and detailed worked examples

Full template library and detailed worked examples live in references/details.md. Read that file when you need the concrete templates.

Best Practices

Do's

  • Make projections idempotent - Safe to replay
  • Use transactions - For multi-table updates
  • Store checkpoints - Resume after failures
  • Monitor lag - Alert on projection delays
  • Plan for rebuilds - Design for reconstruction

Don'ts

  • Don't couple projections - Each is independent
  • Don't skip error handling - Log and alert on failures
  • Don't ignore ordering - Events must be processed in order
  • Don't over-normalize - Denormalize for query patterns
よくある質問

「イベント」とは何ですか?

イベントとは、「ユーザーが登録した」「注文が行われた」のように、過去に起きた出来事の記録です。

「リードモデル」とは何ですか?

質問に答えるために特別に作られた、データの整理された見方のことです。データが最初に記録された形式とは異なります。

なぜ「パフォーマンスを最適化する」のですか?

データ量が多くても、システムが検索にすばやく応答し、処理が遅くなるのを防ぐためです。

詳細

作者による元の説明

Build read models and projections from event streams. Use when implementing CQRS read sides, building materialized views, or optimizing query performance in event-sourced systems.

repo: wshobson/agents

人気

GitHubのスター
41k
ランキング
#6640
ライセンス
MIT
更新日
2026/10/15

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

0

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

コメント

  • …

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

似ているスキル