router-core/auth-and-guards

Implements route guards and RBAC for TanStack Router applications.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/redacharf/fin-punk --skill router-core-auth-and-guards-redacharf
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: router-core/auth-and-guards
Source: https://github.com/redacharf/fin-punk/tree/main/.agents/skills/router-core/auth-and-guards
Command: npx skills add https://github.com/redacharf/fin-punk --skill router-core-auth-and-guards-redacharf

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Route protection with beforeLoad, redirect()/throw redirect(), isRedirect helper, authenticated layout routes (_authenticated), non-redirect auth (inline login), RBAC with roles and permissions, and auth provider integration (Auth0, Clerk, Supabase) with router context for auth state.

Core Features & Use Cases

  • Route protection with beforeLoad, redirect(), isRedirect, and authenticated layouts (_authenticated).
  • Inline login for non-redirect authentication and RBAC with roles and permissions.
  • Auth provider integration with common services (Auth0, Clerk, Supabase) and router context for auth state.
  • Use Case: Implement a admin dashboard guarded behind an _authenticated layout with role checks and seamless login flow.

Quick Start

Use the auth-and-guards skill to wire up protected routes and RBAC in a TanStack Router app.

Frequently Asked Questions about router-core/auth-and-guards

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I protect routes in TanStack Router using beforeLoad guards?

Route protection in TanStack Router uses the beforeLoad guard to check authentication state before rendering, redirecting unauthenticated users to login or rendering an inline login form instead of navigating away.

What's the best way to implement RBAC with role checks in a TanStack Router app?

Implementing RBAC in TanStack Router involves defining roles and permissions within the router context, then applying checks inside beforeLoad guards to allow or deny access to specific protected routes based on user roles.

Can I use TanStack Router guards with authentication providers like Auth0, Clerk, or Supabase?

Yes, TanStack Router guards integrate with Auth0, Clerk, and Supabase by passing the auth state through the router context, enabling beforeLoad guards to access session data for route protection.

How do I handle redirects for unauthenticated users in TanStack Router?

Handle unauthenticated redirects in TanStack Router by calling the redirect() function or throwing redirect() inside a beforeLoad guard, and use the isRedirect helper to manage caught redirect errors effectively.

Does TanStack Router support authenticated layout routes for protected areas?

Yes, TanStack Router supports authenticated layout routes using the _authenticated directory pattern, wrapping nested routes in a layout that enforces authentication and RBAC checks via beforeLoad.

When should I use inline login instead of redirecting for authentication?

Use inline login for non-redirect authentication when you want to render the login form directly within the current route layout instead of navigating away, preserving user context and route state.