What problem does it solve? Unprotected routes in TanStack Router apps expose private pages and cause flashes of protected content when auth checks run inside components. This Skill provides the correct patterns for guarding routes with beforeLoad, redirecting unauthenticated users, and enforcing role- and permission-based access control. ## Core Features & Use Cases - Redirect-Based Route Guards: Protect routes with beforeLoad and redirect() inside a pathless _authenticated layout route, with redirect-back support via validated search params. - RBAC and Permission Checks: Extend router context with hasRole, hasAnyRole, and hasPermission helpers to build admin-only and permission-gated layout routes. - Auth State via Router Context: Inject live auth state through createRootRouteWithContext and RouterProvider's context prop without recreating the router. - Use Case: You are building a dashboard where only admins can manage users. Create an _authenticated/_admin layout route whose beforeLoad checks context.auth.hasRole('admin') and redirects others to /unauthorized, while every createServerFn handler enforces auth via middleware. ## Quick Start Protect my TanStack Router dashboard routes so unauthenticated users are redirected to a login page and only admins can access the user management section.