projection-patterns
Offers architectural templates for building materialized views from event streams to improve query speed.
Install
mkdir -p .claude/skills/projection-patterns && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/3714" && unzip -o skill.zip -d .claude/skills/projection-patterns && rm skill.zipInstalls to .claude/skills/projection-patterns
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
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.Key capabilities
- →Defines projection architecture models
- →Maps event streams to materialized view tables
- →Sets up idempotent event handlers
- →Implements checkpointing for recovery
- →Optimizes read-side query performance
How it works
Applies established architectural patterns for event processing to separate write/read logic, ensuring consistent event data projection.
Inputs & outputs
When to use projection-patterns
- →Implement CQRS read sides
- →Build materialized views from events
- →Optimize event-sourced query performance
About this skill
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
When not to use it
- →When simple CRUD database operations suffice
- →When the system does not use event sourcing
Prerequisites
Limitations
- →Requires careful synchronization between write and read sides
- →Rebuilding projections can be resource-intensive
How it compares
It treats read models as distinct, independent derivatives of an event log rather than direct database table mappings.
Compared to similar skills
projection-patterns side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| projection-patterns (this skill) | 1 | 2mo | No flags | Advanced |
| postgresql-table-design | 30 | 4mo | No flags | Intermediate |
| agentdb-advanced-features | 7 | 9mo | Review | Advanced |
| event-store-design | 5 | 2mo | No flags | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by wshobson
View all by wshobson →You might also like
postgresql-table-design
wshobson
Design a PostgreSQL-specific schema. Covers best-practices, data types, indexing, constraints, performance patterns, and advanced features
agentdb-advanced-features
ruvnet
Master advanced AgentDB features including QUIC synchronization, multi-database management, custom distance metrics, hybrid search, and distributed systems integration. Use when building distributed AI systems, multi-agent coordination, or advanced vector search applications.
event-store-design
wshobson
Design and implement event stores for event-sourced systems. Use when building event sourcing infrastructure, choosing event store technologies, or implementing event persistence patterns.
database-design
davila7
Database design principles and decision-making. Schema design, indexing strategy, ORM selection, serverless databases.
database-schema-designer
davila7
Design robust, scalable database schemas for SQL and NoSQL databases. Provides normalization guidelines, indexing strategies, migration patterns, constraint design, and performance optimization. Ensures data integrity, query performance, and maintainable data models.
storage-format
tursodatabase
SQLite file format, B-trees, pages, cells, overflow, freelist that is used in tursodb