clerk-react-patterns

Implement Clerk authentication patterns for React single-page applications.

Updated Jun 20, 2026
One-click install
npx skills add https://github.com/sudarshan-krishnan/Sentinel_AIHackathon_Berkley_2026 --skill clerk-react-patterns-sudarshan-krishnan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clerk-react-patterns
Source: https://github.com/sudarshan-krishnan/Sentinel_AIHackathon_Berkley_2026/tree/main/app/.agents/skills/clerk-react-patterns
Command: npx skills add https://github.com/sudarshan-krishnan/Sentinel_AIHackathon_Berkley_2026 --skill clerk-react-patterns-sudarshan-krishnan

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It removes the friction of adding secure, user-friendly authentication to React single-page apps, so builders can focus on product features instead of auth wiring.

Core Features & Use Cases

  • ClerkProvider Setup: Initialize Clerk correctly in Vite or CRA apps and make auth state available throughout the app.
  • Protected Routing: Guard dashboard, settings, and other private pages with React Router using reliable loading and signed-in checks.
  • Custom Auth Flows: Build custom sign-in and sign-up forms, show user profile data, switch organizations, and attach session tokens to API requests.
  • Use Case: A team shipping a React SaaS can add sign-in, route protection, profile access, and authenticated backend calls without designing the integration from scratch.

Quick Start

Ask for a complete Clerk React setup for my SPA, including provider wiring, sign-in and sign-out UI, protected routes, and any custom auth flow I need.

Frequently Asked Questions about clerk-react-patterns

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

FAQPage Schema
How do I set up Clerk authentication in a React SPA?

Protecting routes with React Router v6 or v7 requires using isLoaded and signed-in checks as guards. You wrap private dashboard or settings pages with these guards to prevent unauthorized access while authentication state initializes.

Can I build custom sign-in and sign-up flows with Clerk in React?

Yes, you can build custom sign-in and sign-up flows using the useSignIn and useSignUp hooks. This allows you to create tailored authentication forms instead of using pre-built Clerk components, offering full control over the user interface.

How do I attach session tokens to API requests in a React app using Clerk?

You attach session tokens to API requests by retrieving the bearer token through Clerk's useAuth hook. You then include this token in the authorization header of your backend calls to authenticate the user's session.

Does Clerk work with React Router for protected routes and organization switching?

Yes, Clerk integrates with React Router for protected routes and organization switching. The integration uses isLoaded guards for reliable loading states and supports switching between organizations once the user is authenticated.