Index of every page on this site: llms.txt
All skills
wshobson avatar

/projection-patterns

@4220308
by Seth Hobsonwshobson/agents43k stars
4,518
Run it yourself

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.

  • 2 files
  • 16.5 KB
  • Updated 6 months ago
  • GitHub
Use this Skill: https://skilld.dev/gh/wshobson/agents/projection-patterns

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈50 tokens for metadata: the name and description. ≈610 when used: this file. ≈3.6k more on demand in 1 file.

Description uses 2.5% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈201 characters, or 2.5%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

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

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at 4220308. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 days ago.

Activeupdated 6 months ago
  • cqrs
  • event-sourcing
  • projections
  • read-models
  • materialized-views
  • event-streams
  • query-optimization

README badge

README badge for wshobson/agents/projection-patterns

Provides patterns and templates for building projections and read models in event-sourced systems, covering live, catchup, persistent, and inline projection types. Targets CQRS architectures, materialized views, and query optimization through event stream processing.

Generated from the current SKILL.md.

Does this skill cover both live and catchup projections?
Yes. The skill describes four projection types: live (real-time from subscription), catchup (historical events), persistent (with checkpoints), and inline (same transaction as write).
What event store or database does this target?
The skill does not mandate a specific event store or database. It provides patterns and architecture guidance applicable to any event-sourced system.
Does this include code templates or just theory?
The skill includes a template library and worked examples in a references/details.md file that contains concrete templates for implementation.
Does this address handling projection failures and replay?
Yes. The skill emphasizes making projections idempotent, storing checkpoints for resume capability, and designing for reconstruction and rebuilds.

Generated from the current SKILL.md. These answers refresh after source changes.