senrecep/tsentials/tsentials-mediator
Claude Code and agent skill by senrecep/tsentials
- community
Checking that the SKILL.md file is still in the repository.
Use when you need typed in-process request/response dispatch with cross-cutting behaviors — createMediator<RequestMap>() with register/send, handlers returning Result<T>, pipeline behaviors for exception handling, validation, logging, caching, locking and transactions, and AbortSignal propagation.
Install
npx vskill@latest install senrecep/tsentials/tsentials-mediatorSKILL.md
tsentials/mediator
Typed in-process mediator without a DI container. Handlers return Result; behaviors wrap them as a pipeline. Subpath-only: not exported from the root tsentials entry.
Installation
Import
Register and send
- The
RequestMaptype maps request names to{ request; response };sendandregisterare fully typed from it. - Handlers may be sync or async and receive
(request, { requestName, signal }). registerreturns the mediator (chainable). Pipeline order, outermost first: mediator-wide behaviors, then the per-handler behaviors passed toregister, then the handler.
Behaviors
| Behavior | Purpose | |||
|---|---|---|---|---|
exceptionHandlingBehavior() | thrown handler error becomes Err.fromException(e) (type Failure) | |||
validationBehavior(validators, { defaultMode, observers }) | run validators before the handler; modes `'enforce' \ | 'logOnly' \ | 'off' (from request.validationMode); a Rule<T>` is a valid validator | |
loggingBehavior({ logger }) | log request/response via a MediatorLogger | |||
cachingBehavior({ cache }) | cache results by request.cacheKey (CacheStore get/set of strings); the key is caller-supplied, so include tenant/user in it for per-user data | |||
lockBehavior(new InProcessResourceLock()) | serialize requests with the same request.lockKey | |||
transactionBehavior(runner) | run requests with transactional: true in a TransactionRunner; commits unless the result fails |
Custom behavior (a function; call next() to continue):
pipeline(handler, ...behaviors) composes a handler with behaviors without a mediator.
Patterns and pitfalls
- Import from
tsentials/mediator— never from the roottsentialsentry. sendrejects when no handler is registered for the name;registerthrowsTypeErroron a duplicate name.- AbortSignal convention: pass
{ signal }tosend; the caller's abort rejects withsignal.reason.exceptionHandlingBehavior()never turns an abort-like error into a failure result. - Put
exceptionHandlingBehavior()outermost in the global behaviors so it also covers other behaviors. - Place
lockBehaviorbeforetransactionBehaviorfor process-wide locks, after it for transaction-scoped locks. - A failed lock acquisition throws
LockTimeoutError(not a failure result). - Handlers return
Result<T>; do not return bare values.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.well-known/agent-skills/tsentials-mediator/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/senrecep/tsentials/tsentials-mediator)