mediator-pattern
Installation
SKILL.md
Mediator Pattern
Centralizes communication between components through a mediator instead of direct references. Components send messages/events to the mediator, which coordinates responses—reducing coupling and making components independently reusable.
When to Use
- Multiple components need to communicate (UI components, services, handlers)
- Direct component coupling makes testing or reuse difficult
- Orchestrating multi-step workflows (CQRS command/event bus)
- Complex form validation where many fields affect each other
Don't use for:
- Simple parent-child communication (props/callbacks are fine)
- Two components that genuinely belong together
- Systems where central coordination becomes a bottleneck