Projection Patterns skill for Claude
Build read models and projections from event streams.
When Claude uses it
Use when implementing CQRS read sides, building materialized views, or optimizing query performance in event-sourced systems.
Projection Patterns SKILL.md
The full skill file from wshobson/agents (MIT).
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
How to install Projection Patterns
Claude Code
Copy the skill into your personal skills folder (or into .claude/skills/ inside a project):
npx degit wshobson/agents/plugins/backend-development/skills/projection-patterns#main ~/.claude/skills/projection-patternsCodex
npx degit wshobson/agents/plugins/backend-development/skills/projection-patterns#main ~/.codex/skills/projection-patternsClaude.ai and Claude Desktop
Download the skill folder from GitHub, zip it, and upload it under Settings → Capabilities → Skills.
Frequently asked questions
+What does the Projection Patterns skill do?
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.
+How do I install Projection Patterns in Claude Code?
Copy the skill folder into ~/.claude/skills/projection-patterns, for example with "npx degit wshobson/agents/plugins/backend-development/skills/projection-patterns#main ~/.claude/skills/projection-patterns". Claude Code loads it automatically and uses it when a task matches.
+Does Projection Patterns work with ChatGPT or Codex?
Yes. Projection Patterns uses the open SKILL.md format. In Codex, put the folder in ~/.codex/skills/projection-patterns. In Claude.ai, zip the folder and upload it under Settings → Capabilities → Skills.
+Is Projection Patterns free?
Projection Patterns is published on GitHub by wshobson under the MIT license, which allows free use.