What problem does it solve? Setting up Clerk authentication in a Vite or CRA React single-page app involves several error-prone details: placing ClerkProvider correctly, guarding on isLoaded before trusting auth state, wiring protected routes with React Router, and fetching session tokens for API calls. This Skill provides tested patterns and references that prevent common mistakes like undefined isSignedIn values or missing publishable keys. ## Core Features & Use Cases - Provider and Environment Setup: Configures ClerkProvider in main.tsx with the VITE_CLERK_PUBLISHABLE_KEY environment variable accessed via import.meta.env. - Auth Hooks and Protected Routes: Covers useAuth, useUser, and useClerk hooks plus a ProtectedRoute component for React Router v6/v7 that redirects unauthenticated users. - Custom Flows and API Tokens: Implements custom sign-in/sign-up forms with useSignIn/useSignUp and retrieves session JWTs via getToken() for authenticated backend requests. - Use Case: You are building a React SPA dashboard and need /dashboard and /settings restricted to signed-in users, with a custom email/password sign-in form and authenticated calls to your Express API. ## Quick Start Ask the assistant to add Clerk authentication to your Vite React app with a protected dashboard route and a custom sign-in page.