projection-patterns

projection-patterns is a skill for Claude Code, Codex from mattmre/EVOKORE-MCP-PUBLIC. It costs 36 tokens per session (3,219 once invoked), scanned A, a copy of projection-patterns, MIT.

A guide to building read models from event streams. An event stream is a sequence of recorded changes, and a read model is a database view shaped for fast queries.

In plain words
What is it for?
Use it to build CQRS read sides, materialized views, search indexes, real-time dashboards, and aggregated data from event-sourced systems.
Why use it?
It helps turn historical events into queryable data without forcing every screen or report to reconstruct state from the original event history.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Good fit Use it to build CQRS read sides, materialized views, search indexes, real-time dashboards, and aggregated data from event-sourced systems.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mattmre/evokore-mcp-public/projection-patterns
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add mattmre/EVOKORE-MCP-PUBLIC --skill projection-patterns
Clone the repo
git clone --depth 1 https://github.com/mattmre/EVOKORE-MCP-PUBLIC

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for projection-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/mattmre/evokore-mcp-public/projection-patterns/github.svg)](https://agentmods.dev/skills/mattmre/evokore-mcp-public/projection-patterns)
Your own site
<a href="https://agentmods.dev/skills/mattmre/evokore-mcp-public/projection-patterns"><img src="https://agentmods.dev/badge/skills/mattmre/evokore-mcp-public/projection-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for projection-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/mattmre/evokore-mcp-public/projection-patterns"><img src="https://agentmods.dev/badge/skills/mattmre/evokore-mcp-public/projection-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 36 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,219 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00036 $0.03219
Opus 5 $0.00018 $0.01610
Sonnet 5 $0.00007 $0.00644
Haiku 4.5 $0.00004 $0.00322

Measured 7d ago against content hash ee6db3fb62f6, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

projection-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to projection-patterns — 4 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

SKILLS/WSHOBSON PLUGINS/backend-development/projection-patterns/SKILL.md · 493 lines

How it starts

The opening of the file, as written. The whole thing — 493 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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

Template 1: Basic Projector

from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Dict, Any, Callable, List
import asyncpg

@dataclass
class Event:
    stream_id: str
    event_type: str
    data: dict
    version: int
    global_position: int


class Projection(ABC):
    """Base class for projections."""

    @property
    @abstractmethod
    def name(self) -> str:
        """Unique projection name for checkpointing."""
        pass

    @abstractmethod
    def handles(self) -> List[str]:
        """List of event types this projection handles."""
        pass

    @abstractmethod
    async def apply(self, event: Event) -> None:
        """Apply event to the read model."""
        pass


class Projector:
    """Runs projections from event store."""

    def __init__(self, event_store, checkpoint_store):
        self.event_store = event_store
        self.checkpoint_store = checkpoint_store
        self.projections: List[Projection] = []

    def register(self, projection: Projection):
        self.projections.append(projection)

    async def run(self, batch_size: int = 100):
        """Run all projections continuously."""
        while True:
            for projection in self.projections:
                await self._run_projection(projection, batch_size)
            await asyncio.sleep(0.1)

    async def _run_projection(self, projection: Projection, batch_size: int):
        checkpoint = await self.checkpoint_store.get(projection.name)
        position = checkpoint or 0

        events = await self.event_store.read_all(position, batch_size)

        for event in events:
            if event.event_type in projection.handles():
                await projection.apply(event)

            await self.checkpoint_store.save(
                projection.name,
                event.global_position
            )

    async def rebuild(self, projection: Projection):
        """Rebuild a projection from scratch."""
        await self.checkpoint_store.delete(projection.name)
        # Optionally clear read model tables
        await self._run_projection(projection, batch_size=1000)

Read the full file on GitHub · 493 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 493 lines · 36 tokens per session scan A ee6db3fb62f6

Subscribe to this mod's changes

projection-patterns is a skill published in the GitHub repository mattmre/EVOKORE-MCP-PUBLIC (3 stars, last pushed 3mo ago), licensed MIT. It adds 36 tokens to every session and 3,219 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to projection-patterns, differing in 4 lines, and is treated as a copy.