Skip to content
Skillpedia
APIs & servers (backend)41k · #4807

projection-patterns

Helps your agent create data views from event streams. It's useful for optimizing how data is read and presented.

What it does

This tool helps organize past event information so you can query it quickly. It creates optimized 'views' of your data.

When to use it

  • ✓When you need to see the current state of things in real-time.
  • ✓When rebuilding information from an event history.
  • ✓To make data queries faster and more efficient.

Example of what to ask your AI

“How can I create an optimized view of my sales data from transaction events?”

Want more? Open the sections below.

How to use

The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.

Skill link

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

Ready-to-paste message

Use this skill to help me: https://github.com/wshobson/agents/blob/main/plugins/backend-development/skills/projection-patterns/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
How it works

It works by taking a sequence of events (like records of actions) and processing them to create a simpler, more direct data model. This model is then used to answer questions quickly.

Installation

Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.

In the terminal (Claude Code, Codex, Cursor), in your project folder:

npx skills add wshobson/agents --skill projection-patterns

Or download just the file:

curl -L https://raw.githubusercontent.com/wshobson/agents/main/plugins/backend-development/skills/projection-patterns/SKILL.md -o SKILL.md
Technical content (original SKILL.md)

Original text by the author, straight from 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
FAQ

What are 'events'?

Events are records of something that happened in the past, like 'user signed up' or 'order was placed'.

What is a 'read model'?

It's an organized way of viewing data, made specifically for answering questions, different from how the data was originally recorded.

Why 'optimize performance'?

So the system responds faster to your queries, even with a lot of data, avoiding slowdowns.

Details

Original description by the author

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

Popularity

GitHub stars
41k
Ranking position
#4807
License
MIT
Updated
10/15/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills