business-logic-entry-point-execution-context
Execution Context for Business Logic Entry Points
Goal
Every business-logic entry point must set up an execution context that makes request-scoped data implicitly accessible from any point in the execution chain.
The execution context replaces explicit parameter passing for cross-cutting, request-scoped data. Functions deeper in the call chain retrieve the context from the ambient store instead of receiving it as a parameter.
The entry point itself — not the infrastructure caller — is responsible for creating and populating the execution context. Whether or not execution context is used is a business-logic concern. Infrastructure code such as HTTP handlers, controllers, server actions (Next.js), message consumers, or scheduled jobs must not know about the execution context. They call the entry point normally.
In Node.js projects, use AsyncLocalStorage from the node:async_hooks module.
What Counts as In Scope
Apply this skill to code that does one or more of these things: