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

TypeDescriptionUse Case
LiveReal-time from subscriptionCurrent state queries
CatchupProcess historical eventsRebuilding read models
PersistentStores checkpointResume after restart
InlineSame transaction as writeStrong 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-patterns

Codex

npx degit wshobson/agents/plugins/backend-development/skills/projection-patterns#main ~/.codex/skills/projection-patterns

Claude.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.

Related software development skills

  1. Code Review

    Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes: Standards (does the code follow this repo's…

    mattpocock/skills★ 327k
  2. Using Agent Skills

    Discovers and invokes agent skills. Use when starting a session, or when you need to decide which skill or workflow applies to the piece of…

    addyosmani/agent-skills★ 119k
  3. Build

    Fully automate a coding task with make-plan, do, and babysit.

    thedotmack/claude-mem★ 118k
  4. Protocol Reverse Engineering

    Master network protocol reverse engineering including packet analysis, protocol dissection, and custom protocol documentation.

    wshobson/agents★ 43k
  5. Python Anti Patterns

    Use this skill when reviewing Python code for common anti-patterns to avoid.

    wshobson/agents★ 43k
  6. Python Background Jobs

    Python background job patterns including task queues, workers, and event-driven architecture.

    wshobson/agents★ 43k
  7. Python Code Style

    Python code style, linting, formatting, naming conventions, and documentation standards.

    wshobson/agents★ 43k
  8. Python Configuration

    Python configuration management via environment variables and typed settings.

    wshobson/agents★ 43k
  9. Python Design Patterns

    Python design patterns including KISS, Separation of Concerns, Single Responsibility, and composition over inheritance.

    wshobson/agents★ 43k

See all software development skills →

More skills from wshobson

  1. Prometheus Configuration

    Set up Prometheus for comprehensive metric collection, storage, and monitoring of infrastructure and applications.

    wshobson/agents★ 43k
  2. Prompt Engineering Patterns

    This skill should be used when the user asks to "optimize a prompt", "improve prompt performance", "design a prompt template", "write…

    wshobson/agents★ 43k
  3. Protect Mcp Setup

    Configure Cedar policy enforcement and Ed25519 signed receipts for Claude Code tool calls.

    wshobson/agents★ 43k

All skills by wshobson →

Give your whole team an AI agent with skills

Cody runs managed AI agents your team can message in Slack, Teams, WhatsApp and the web, with 50+ business integrations, scheduled tasks and memory. No terminal required.