
Projection Patterns
FreeBuild efficient read models from event streams.
Free · Opens the source repo
What Projection Patterns does
Projection Patterns is a comprehensive guide designed for developers and architects working with event-sourced systems. It provides detailed instructions on how to build projections and read models, which are crucial for implementing Command Query Responsibility Segregation (CQRS) patterns. This skill is particularly valuable when you need to create materialized views or optimize query performance, ensuring that your applications can handle data efficiently and in real time.
The skill covers essential concepts such as projection architecture, which outlines the flow from an event store through projectors to read models. It details the different types of projections, including live, catchup, persistent, and inline, each serving specific use cases to meet varying application requirements. By following the guidelines provided, you can effectively manage the complexity of data handling in event-sourced environments, ensuring that your read models are both accurate and performant.
Included in the skill are best practices for building projections, emphasizing the importance of idempotency, transaction management, and error handling. The skill encourages developers to monitor projection lag and plan for potential rebuilds, thereby enhancing the reliability of their systems. Additionally, it provides a library of templates and worked examples in the references/details.md file, making it easy to implement the concepts in real-world scenarios.
Overall, Projection Patterns is aimed at developers and system architects who are looking to enhance their event-sourced applications with effective read models and projections, ultimately leading to improved application performance and user experience.
When to use it
Use this skill when implementing CQRS read sides, creating materialized views, or optimizing query performance in applications that rely on event sourcing.
When not to use it
This skill may not be suitable for simpler applications that do not require advanced data handling or for those not using event sourcing principles.
What you can build with it
Implementing CQRS
Use this skill to effectively implement the read side of a CQRS architecture, ensuring efficient data retrieval.
Creating Materialized Views
Leverage the guidance to create materialized views from event streams, improving query performance.
Optimizing Real-time Dashboards
Apply the principles outlined in this skill to build responsive real-time dashboards that aggregate data effectively.
How to install Projection Patterns
View source1. Install with the skills CLI
npx skills add wshobson/agents/projection-patterns --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by wshobsonProjection 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
Frequently asked questions about Projection Patterns
Similar skills
Python PyPI Package Builder
Streamline the process of creating and publishing Python packages.
Minecraft Plugin Development
Streamline your Minecraft server plugin creation.
MCP Server Builder
Easily build .NET MCP servers with the latest standards.
CommunityToolkit.Mvvm Messenger
Decoupled communication for ViewModels in .NET applications.
MVVM Toolkit DI
Streamline ViewModel integration with Dependency Injection in .NET.
MCP Apps Builder
Essential guidelines for MCP server development.
