pattern-mediator

Route component interactions through a mediator interface with a notify method.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/johnnystefan/test-saas-business --skill pattern-mediator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pattern-mediator
Source: https://github.com/johnnystefan/test-saas-business/tree/main/skills/design-patterns/behaviorals/pattern-mediator
Command: npx skills add https://github.com/johnnystefan/test-saas-business --skill pattern-mediator

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Mediator pattern skill clarifies which component coordinates interactions so tightly coupled objects stop depending on each other and the application avoids tangled imports.

Core Features & Use Cases

  • Identify coupling hotspots: Spot objects that repeatedly call each other and risk creating dependency hell.
  • Declare mediator contract: Define a notify-like bridge so every participant broadcasts events instead of invoking peers directly.
  • Implement concrete mediator: Centralize routing logic to drive workflows such as event buses, command handlers, or CQRS orchestrations.
  • Use Case: Apply this pattern when a dialog, a service, and a logging handler must all coordinate without referencing each other directly.

Quick Start

Ask the pattern-mediator skill to centralize communication between your components via a mediator interface.

Frequently Asked Questions about pattern-mediator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I decouple tightly coupled components that keep calling each other directly?

To decouple tightly coupled components, route their interactions through a centralized mediator interface. Participants broadcast events via a notify method instead of invoking peers directly, centralizing coordination logic and removing tangled imports.

What is a mediator pattern used for in event bus and CQRS architectures?

In event bus and CQRS architectures, a mediator pattern centralizes routing logic to orchestrate command handlers and event workflows. It drives workflows by routing interactions through a single interface, ensuring services coordinate without direct dependencies.

How do I coordinate UI components and services without creating dependency hell?

Coordinate UI components and services by declaring a mediator contract with a notify method. Every participant broadcasts events through this bridge instead of referencing peers directly, avoiding dependency hell and keeping coordination logic centralized.

Does the mediator pattern work for orchestrating command handlers in a CQRS setup?

Yes, the mediator pattern works for orchestrating command handlers in a CQRS setup. It centralizes command routing by having components interact solely through a mediator interface, decoupling the command sender from its specific handler implementations.

When should I not use a centralized mediator for component messaging?

Avoid using a centralized mediator for component messaging when components have very few interactions or when routing logic becomes a monolithic bottleneck. If objects do not risk creating tangled imports, direct communication may be simpler than centralizing coordination.