What problem does it solve?
This Skill provides practical, mistake-resistant patterns for adding authentication to React single-page applications with @clerk/react, reducing integration errors and insecure implementations.
Core Features & Use Cases
- Provider setup: guidance for placing ClerkProvider at the app root and loading the publishable key from environment variables.
- Auth hooks: concrete usage patterns for useAuth, useUser, and useClerk including the isLoaded guard and getToken for API calls.
- Protected routes & router integration: ProtectedRoute patterns for React Router v6/v7, org-gated routes, and component-level Show fallbacks.
- Custom flows & templates: examples for building custom sign-in and sign-up forms and ready-to-run Vite template scaffolds for fast bootstrapping.
Use case example: bootstrap a Vite app, wrap the app with ClerkProvider, protect dashboard routes with a ProtectedRoute, and call a backend API with a session token retrieved via getToken.
Quick Start
Add ClerkProvider to your main file, read VITE_CLERK_PUBLISHABLE_KEY from import.meta.env, and implement a ProtectedRoute that returns a loading state while isLoaded is false and redirects to /sign-in when isSignedIn is false.