forinda/kickjs-examples-archive/context-contributor
Claude Code and agent skill by forinda/kickjs-examples-archive
- community
Checking that the SKILL.md file is still in the repository.
Use when a middleware's only job is to set ctx values consumed elsewhere — replace with defineHttpContextDecorator (HTTP) or defineContextDecorator (transport-agnostic).
Install
npx vskill@latest install forinda/kickjs-examples-archive/context-contributorSKILL.md
The same SKILL.md was published earlier as forinda/kickjs-examples-archive/context-contributor.
Pattern (HTTP — most common):
Use defineContextDecorator (no Http prefix) only when the contributor must run across HTTP, WebSocket, queue, and cron transports — Ctx defaults to the smaller ExecutionContext surface (get / set / requestId only, no req).
Five precedence levels (high → low): method > class > module > adapter > global
Same-key collisions WITHIN a precedence level throw DuplicateContributorError. Across levels, the higher precedence silently overrides — a feature, not a bug, but debug it by giving resolvers distinguishable return values.
Boot-time validation:
- Cycles in
dependsOn→ContributorCycleError. dependsOnreferring to an unknown key →MissingContributorError.- Both errors fail boot, not first request.
Critical rules — all stem from the same shared-via-ALS instance model:
- Every per-request stage (middleware → contributors → handler) gets its OWN
RequestContextinstance, but they all read/write the SAMEAsyncLocalStorage-backed bag. - `resolve` and `onError` must RETURN the value — the runner writes it via
ctx.set(key, value). Direct property assignment (ctx.tenant = …) sticks to one instance only and the handler instance never sees it. ctx.set('tenant', x)thenctx.get('tenant')works across instances.ctx.req.headers[...]works (the underlying node request is shared). Note it is a nodeIncomingMessageon Fastify and a web-backed request on h3, not anexpress.Request.- Services with no
ctxreference:getRequestValue('tenant')returnsMetaValue<'tenant'> | undefined(typed via the augmentedContextMeta). ForrequestIdusegetRequestStore(). - No `setRequestValue` — writes flow through `ctx.set` or a contributor's return value. Avoids "spooky action at a distance" where any service can pollute the per-request bag.
Error matrix:
optional: true—resolvethrows → key left unset; downstream seesctx.get(key) === undefined.optional: false(default) +onError— return a fallback value to write; returnundefinedto skip; throw to forward to the request error handler.optional: false+ noonError— throw propagates straight to the request error handler.
Don't use this for: response short-circuit, stream mutation, or pre-route-matching work — keep @Middleware() for those.
Red flags:
ctx.get('key')!— the non-null assertion compiles even when the producing decorator isn't on the route. Usectx.require('key').contributors: [LoadX]at a module / adapter / bootstrap site — those take registrations:LoadX.registrationorLoadX.with({ ... }).registration.- A
paramDefaultsvalue that every call site overrides (action: 'settings:read') — drop it and let the compiler require the field at each site. defineContextDecorator<'k', Deps, Params>(spec)positional form for a parameterised contributor — use.withParams<Params>()(spec)ordepsinference is lost.ctx.tenant = xinstead of returning the value fromresolve— sticks to one instance only.- Plugin / adapter authors using bare keys (
'state') instead of namespaced ('@my-plugin/state') — collides with adopter keys. getRequestValue<string>('traceId')— generic is the key type, not value type.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinginertia-app/.agents/skills/context-contributor/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/forinda/kickjs-examples-archive/context-contributor)