From harness-claude
> Route component interactions through a central mediator to reduce direct coupling
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeThis skill uses the workspace's default tool permissions.
> Route component interactions through a central mediator to reduce direct coupling
Decouples tightly coupled components by routing communication through a central mediator or typed event bus in TypeScript. Use for chat rooms, collaborative editors, or workflow engines with many-to-many interactions.
Generates Mediator pattern components for PHP 8.4 including mediator interface, colleagues, events, requests/responses, and unit tests. Use for coordinating complex object interactions and reducing coupling.
Mandates invoking relevant skills via tools before any response in coding sessions. Covers access, priorities, and adaptations for Claude Code, Copilot CLI, Gemini CLI.
Share bugs, ideas, or general feedback.
Route component interactions through a central mediator to reduce direct coupling
next() pipelines)(req, res, next) (or equivalent) and call next() to pass control.next('skip') or returning early).// Middleware pipeline
class Pipeline {
constructor() {
this.middlewares = [];
}
use(fn) {
this.middlewares.push(fn);
return this;
}
execute(context) {
let index = 0;
const next = () => {
const fn = this.middlewares[index++];
if (fn) fn(context, next);
};
next();
}
}
const pipeline = new Pipeline();
pipeline
.use((ctx, next) => {
ctx.log = [];
next();
})
.use((ctx, next) => {
ctx.log.push('step1');
next();
})
.use((ctx) => {
ctx.log.push('step2');
});
const ctx = {};
pipeline.execute(ctx);
console.log(ctx.log); // ['step1', 'step2']
The Mediator pattern (GoF) centralizes communication. The Middleware pattern (popularized by Express.js) is a sequential pipeline variant. Both reduce point-to-point coupling by routing interactions through a shared hub or chain.
Trade-offs:
When NOT to use:
https://patterns.dev/javascript/mediator-middleware-pattern