Projection Patterns
Seth HobsonCommunityCreated by Seth Hobson
- Skill
- Guidelines
- Software development
- MIT
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a framework for building projections that transform event streams into queryable read models. It covers architectural concepts, different projection types, and implementation patterns for CQRS-based systems. The content includes best practices for ensuring idempotent processing, managing checkpoints, and handling event ordering, alongside code templates for building projectors in Python.
What it does
- Explains the architecture of event-sourced projections
- Categorizes projection types including live, catchup, persistent, and inline
- Provides Python code templates for base projector classes
- Offers implementation patterns for handling specific event types
- Outlines best practices for idempotent event processing
- Details strategies for managing checkpoints and projection rebuilds
When to use it
- When implementing CQRS read sides
- When creating materialized views from event streams
- When optimizing query performance in event-sourced systems
- When building search indexes or real-time dashboards from events
- When aggregating data across multiple event streams
Advantages
- Promotes decoupled projection design
- Ensures reliable state reconstruction through checkpointing
- Provides structured patterns for handling event-driven updates
- Supports consistent read model maintenance
Usage examples
- “How do I structure a class to handle multiple event types for a read model?”
- The skill provides a base Projection class and an example OrderSummaryProjection that maps specific event types to dedicated handler methods.
- “What are the best practices for ensuring my projections are robust?”
- The skill advises making projections idempotent, using transactions for updates, storing checkpoints to resume after failures, and monitoring for processing lag.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/wshobson/projection-patterns/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip projection-patterns.zip -d .agents/skills
Documentation by Seth Hobson
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
Files
- ATTRIBUTION.mdAdded by AutoGineer995 B
- LICENSELicence file added by AutoGineer1.0 KiB
- SKILL.md2.6 KiB
- references/details.md13.9 KiB
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- Seth Hobson
- Publisher
- Seth Hobson (Community)
- Source
- wshobson/agents · plugins/backend-development/skills/projection-patterns · commit 4bde316
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Seth Hobson or Seth Hobson.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download projection-patterns.zip