/laravel-spatie-event-sourcing:laravel-spatie-event-sourcingfrom Laravel Spatie Event Sourcing
Guides users through designing and implementing event-sourced domains with spatie/laravel-event-sourcing. Covers aggregates, events, projectors, reactors, and test generation via a two-gate workflow.
Ships in Laravel Spatie Event Sourcing. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Generate event-sourced domain code for Laravel using spatie/laravel-event-sourcing, following a two-gate workflow: Design first, then implement with tests.
references/design-heuristics.md — Event naming, aggregate boundaries, projector/reactor rules, anti-patternsreferences/adr-template.md — ADR template for Gate 1references/tdd-patterns.md — Pest and PHPUnit test patternsreferences/commands-pattern.md — Command + handler patterns (plain and bus-dispatched)references/spatie-api-cheatsheet.md — Key Spatie ES classes and methodsreferences/setup-checks.md — Project setup checks (run on first invocation)assets/templates/*.md — Code generation templates (PHP in a fenced block)On first invocation in a project, follow references/setup-checks.md from the Laravel project root. It checks:
spatie/laravel-event-sourcing v7)spatie/laravel-event-sourcing is in composer.jsonstored_events and snapshots tables exist (migrations have run)config/event-sourcing.php has been publishedIf anything is missing, print the single command that fixes it and stop. Do not auto-install packages or run migrations on behalf of the user — they need to confirm first.
If everything passes, check for .claude/event-sourcing.md in the project root. If it doesn't exist, ask the user one configuration question:
"I'll create a project config at
.claude/event-sourcing.md. Two quick choices:
- Command dispatch style: plain handler classes invoked directly, or Laravel's command bus (
Bus::dispatch)?- Test framework: Pest or PHPUnit?"
Write their answers to that file. On future invocations, read it silently and proceed.
This skill operates in two gates with a hard stop between them. The user must approve the design before any code gets written.
Start with domain analysis. Ask 3–5 focused questions (skip any the user already answered):
Then produce an ADR using the template in references/adr-template.md. The ADR covers:
references/design-heuristics.md for naming rules)Stop here. Present the ADR and wait for the user to approve, request changes, or edit inline. Iterate until they say something like "approved", "looks good", or "let's build it."
Do not write any implementation code during Gate 1.
Once the ADR is approved, generate everything in one uninterrupted flow. No mid-implementation questions — if something is ambiguous, that's an ADR defect; go back to Gate 1.
Generation order:
app/Domain/<Context>/$table->uuid('uuid')->primary()), no auto-increment, and include $table->timestamps()config/event-sourcing.php./vendor/bin/pest or ./vendor/bin/phpunit)Use the templates in assets/templates/ as starting points (the PHP is in each file's fenced code block). Read references/tdd-patterns.md for test structure and references/commands-pattern.md for command/handler patterns.
Stop here. Present the results. The user approves, requests changes, or moves to the next feature.
app/Domain/<Context>/
├── Aggregates/
│ └── <Name>Aggregate.php
├── Commands/
│ └── <Verb><Noun>Command.php
├── CommandHandlers/
│ └── <Verb><Noun>Handler.php
├── Events/
│ └── <Noun><PastTenseVerb>.php
├── Projectors/
│ └── <Noun>Projector.php
├── Reactors/
│ └── Send<Noun><Action>Reactor.php
└── ReadModels/
└── <Noun>.php
tests/Feature/<Context>/
├── <Name>AggregateTest.php
├── <Noun>ProjectorTest.php
└── <Noun>ReactorTest.php
database/migrations/
└── <timestamp>_create_<read_model>_table.php
This skill is for greenfield event sourcing only. If the user asks to refactor existing CRUD code into event sourcing, politely decline and explain that CRUD-to-ES migration is a different (and much harder) problem that this skill doesn't cover. Suggest they design the event-sourced version from scratch alongside the existing code instead.
assets/templates/aggregate.md (opens in a new tab)assets/templates/aggregate.pest.md (opens in a new tab)assets/templates/aggregate.phpunit.md (opens in a new tab)assets/templates/command-bus.md (opens in a new tab)assets/templates/command-handler-bus.md (opens in a new tab)assets/templates/command-handler.md (opens in a new tab)assets/templates/command.md (opens in a new tab)assets/templates/event.md (opens in a new tab)assets/templates/projector.md (opens in a new tab)assets/templates/projector.pest.md (opens in a new tab)assets/templates/projector.phpunit.md (opens in a new tab)assets/templates/reactor.md (opens in a new tab)assets/templates/reactor.pest.md (opens in a new tab)assets/templates/reactor.phpunit.md (opens in a new tab)assets/templates/read-model.md (opens in a new tab)references/adr-template.md (opens in a new tab)references/commands-pattern.md (opens in a new tab)references/design-heuristics.md (opens in a new tab)references/setup-checks.md (opens in a new tab)references/spatie-api-cheatsheet.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
event-sourcing, laravel, spatie, aggregate-root, projector, reactor
Other plugins' skills for the same job
npx claudepluginhub albertoarena/claude-laravel-event-sourcing --plugin laravel-spatie-event-sourcing