createMiddleware, request middleware (.server only), server function middleware (.client + .server), context passing via next({ context }), sendContext for client-server transfer, global middleware via createStart in src/start.ts, middleware factories, method order enforcement, fetch override precedence.
$npx -y skills add tanstack/router --skill middlewareInstalls into the current project.
Run `npx skills use "https://github.com/tanstack/router" --skill "tanstack/router/middleware"` and follow the generated skill instructions now. Read its complete output, redirecting it to a temporary file first if necessary. Resolve relative paths from the supporting-files directory it provides.
Use the skills in "https://github.com/tanstack/router" that are relevant to the current task. Run `npx skills add "https://github.com/tanstack/router"` and select the relevant skills, then follow their instructions.