b72c14f370
Based on actual review findings: - Replay determinism: DateTime.utc_now() in apply, random in state - Event design: OrderUpdated with changes map (CRUD-in-disguise) - Projections as source of truth - Suggesting event 'fixes' instead of compensating events - Missing idempotency in handlers Added Elixir/OTP specific patterns (handle_continue for replay, Process dictionary for test isolation). Anti-patterns table for quick flagging.
41 lines
1018 B
Markdown
41 lines
1018 B
Markdown
# DDD & Event Sourcing Patterns
|
|
|
|
What LLMs get subtly wrong in event-sourced systems. Based on actual code review findings.
|
|
|
|
## Why This Exists
|
|
|
|
LLMs know the textbook definitions of event sourcing and DDD. But they make subtle mistakes:
|
|
|
|
- Adding `DateTime.utc_now()` in apply functions (breaks replay determinism)
|
|
- Creating `OrderUpdated` events with a changes map (CRUD-in-disguise)
|
|
- Treating projections as source of truth
|
|
- Suggesting "fixes" to immutable events
|
|
- Making aggregates too large (data grouping vs consistency boundary)
|
|
- Multi-aggregate coordination in services without saga patterns
|
|
|
|
This checklist catches those mistakes.
|
|
|
|
## Contents
|
|
|
|
- `DDD-CHECKLIST.md` - Review prompts covering:
|
|
- Replay Determinism (CRITICAL)
|
|
- Event Design
|
|
- Aggregate Boundaries
|
|
- Projections
|
|
- Idempotency
|
|
- Process Managers / Sagas
|
|
- Elixir/OTP Specific
|
|
- Anti-patterns table
|
|
|
|
## Integration
|
|
|
|
```yaml
|
|
# In your review workflow
|
|
patterns-repo: rodin/ddd-patterns
|
|
patterns-files: '.'
|
|
```
|
|
|
|
## License
|
|
|
|
MIT
|