projection-patterns — Claude Code skill: projections and setup
Build read models from event streams with guidance on projection types and replay. Useful for CQRS read sides, materialized views, and search indexes.
/plugin marketplace add wshobson/agents
/plugin install backend-development@claude-code-workflowsWhat projection-patterns does
The skill walks through a projection pipeline: an Event Store feeds a projector, which updates a read model. It covers live projections for current-state queries, catchup projections for historical events, persistent projections with checkpoints, and inline projections that share a transaction with writes.
Its guidance covers safe replay, transactions for multi-table updates, lag monitoring, and rebuilding read models. Concrete templates and worked examples are in references/details.md. Events need to be processed in order, and failures should be logged and monitored. Install it when your project derives read models from events; it is not aimed at ordinary query work without event sourcing.
What it helps with
- build a CQRS read model from events
- rebuild a materialized view from event history
- create a search index from an event stream
- aggregate data across streams
- resume a projection after failure using a checkpoint
Example prompts for the agent
- Design a CQRS read model for these events.
- Show how to rebuild this projection from history and store a checkpoint.
- How should I create a search index from this event stream while preserving event order?
How to install projection-patterns
1Plugin marketplace
/plugin marketplace add wshobson/agents/plugin install backend-development@claude-code-workflowsThis installs the whole backend-development plugin with all its skills
2Skills CLI (Vercel)
npx skills add wshobson/agents --skill projection-patterns -a claude-code3Manually: put the files in place
~/.claude/skills/projection-patterns/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/projection-patterns/
1Skills CLI (Vercel)
npx skills add wshobson/agents --skill projection-patterns -a codex2Manually: put the files in place
.agents/skills/projection-patterns/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add wshobson/agents --skill projection-patterns -a cursor2Manually: put the files in place
.cursor/skills/projection-patterns/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install wshobson/agents projection-patterns2Manually: put the files in place
.github/skills/projection-patterns/SKILL.mdPlatform CLI
gemini skills install https://github.com/wshobson/agents --path plugins/backend-development/skills/projection-patternsManually: put the files in place
.devin/skills/projection-patterns/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set213
The whole set →Similar
Questions about projection-patterns
How do I install projection-patterns in Claude Code?
Run npx skills add wshobson/agents --skill projection-patterns -a claude-code. The supplied commands also include /plugin marketplace add wshobson/agents followed by /plugin install backend-development@claude-code-workflows.
What does projection-patterns do?
It explains how to build read models and projections from events, covering current-state queries and rebuilding from historical events.
Where are the templates and worked examples?
They are in references/details.md; the skill points to that file for concrete templates.
Source text
SKILL.md · MIT
--- name: projection-patterns description: 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. --- # 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
© Seth Hobson · MIT · wshobson/agents