Mediator Pattern

Teaches the mediator pattern for centralized component communication. Use when multiple components need to communicate and direct coupling between them creates complexity or tight dependencies.

259 stars 28 forksSoftware Development

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add PatternsDev/skills --skill mediator-pattern
Manual install
git clone --depth 1 https://github.com/PatternsDev/skills.git /tmp/skills
mkdir -p ~/.claude/skills
cp -r /tmp/skills/javascript/mediator-pattern ~/.claude/skills/mediator-pattern

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# Mediator/Middleware Pattern

The mediator pattern makes it possible for components to interact with each other through a central point: the mediator. Instead of directly talking to each other, the mediator receives the requests, and sends them forward! In JavaScript, the mediator is often nothing more than an object literal or a function.

You can compare this pattern to the relationship between an air traffic controller and a pilot. Instead of having the pilots talk to each other directly, which would probably end up being quite chaotic, the pilots talk the air traffic controller. The air traffic controller makes sure that all planes receive the information they need in order to fly safely, without hitting the other airplanes.

## When to Use

- Use this when multiple objects need to communicate but direct many-to-many relationships would be chaotic
- This is helpful for implementing middleware chains (e.g., Express.js middleware)

## When NOT to Use

- When direct communication between two components is simpler and the system has few participants
- When the mediator itself becomes a monolithic "god object" that's hard to maintain
- When event-driven patterns (observer/pub-sub) provide sufficient decoupling without a central coordinator

## Instructions

- Create a central mediator that processes requests and forwards them to the appropriate handlers
- Use the middleware pattern to chain processing functions that can modify requests/responses
Read the full skill on GitHub

Details

Skill name
mediator-pattern
Path
javascript/mediator-pattern/SKILL.md
Repo updated
15 April 2026

FAQ

What does the Mediator Pattern skill do?

Teaches the mediator pattern for centralized component communication. Use when multiple components need to communicate and direct coupling between them creates complexity or tight dependencies.

How do I install the Mediator Pattern skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add PatternsDev/skills --skill mediator-pattern. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Mediator Pattern popular?

It lives in PatternsDev/skills, which has 259 GitHub stars and 28 forks.

Related skills

Browse the most popular Claude skills, all software development skills, or write your own with the skills generator.