LogoAwesome Skills
  • Search
  • Category
  • Tag
  • Blog
LogoAwesome Skills
LogoAwesome Skills

Discover Open-Source Agent Skills for AI Coding Assistants

Product

  • Search
  • Category
  • Tag
  • Blog

Resources

  • Claude Skill Docs
  • Antigravity Skills Docs

Tools

  • Claude Code
  • OpenCode
  • Cursor
  • Codex
  • Antigravity

Company

  • Privacy Policy
  • Terms of Service
  • Sitemap

©2026 Awesome Skills. All rights reserved.

Privacy PolicyTerms
Back to Skills

clerk-react-patterns

React SPA auth patterns with @clerk/react for Vite/CRA - ClerkProvider setup, useAuth/useUser/useClerk hooks, React Router protected routes, custom sign-in flows. Triggers on: Vite Clerk setup, React Router auth, useAuth hook, protected route, custom sign-in form React.

43stars3forksUpdated 5/24/2026
SecurityWeb DevelopmentDocumentation#authentication#react#react-router#documentation#clerk#javascript

Security Assessment

Medium Risk(50/100)

Detected risks:

Secret Exposure([SKILL.md] token =, [references/hooks.md] token =)
Sensitive File Access([SKILL.md] .env, [references/protected-routes.md] .env, [references/router-integration.md] .env)
Security Score50/100

About clerk-react-patterns

The clerk-react-patterns skill provides implementation guidance for authentication patterns in React single-page applications using `@clerk/react` with Vite or Create React App environments. It helps developers configure Clerk authentication in client-side React applications, avoiding confusion around SPA-specific auth behavior where authentication state is managed entirely through hooks rather than server-side APIs. The skill addresses common setup and runtime issues such as provider configuration, environment variable usage, auth state handling, and route protection in React applications.

Its core capabilities include configuring `ClerkProvider` in a React app root, working with authentication hooks such as `useAuth`, `useUser`, and `useClerk`, implementing protected routes with React Router v6/v7, and handling custom authentication flows. It documents important patterns such as guarding UI logic with `isLoaded` before using `isSignedIn`, retrieving session tokens with `getToken()` for authenticated API requests, and using Clerk methods exposed through `useClerk()`. The skill also includes troubleshooting guidance for common issues involving missing providers, undefined environment variables, null tokens, and publishable key configuration.

This skill is intended for React developers building client-side authenticated applications with Clerk. It is especially useful for teams using Vite or CRA who need practical patterns for dashboard access control, authenticated API calls, custom sign-in experiences, or React Router integration. It is relevant for developers seeking reusable SPA auth patterns without relying on Next.js or server-side authentication models.

FAQ

How do I set up Clerk in a React SPA using this skill?

The skill shows how to install `@clerk/react`, configure the `VITE_CLERK_PUBLISHABLE_KEY` environment variable, and wrap the application with `ClerkProvider` in `main.tsx`.

Does this skill support React Router authentication patterns?

Yes. It includes protected route patterns for React Router v6/v7 using `useAuth`, `Navigate`, and `Outlet`.

Can I use this skill for authenticated API requests?

Yes. The documented pattern uses `getToken()` from `useAuth()` to retrieve a session token for API authorization headers.

Is this skill compatible with Next.js applications?

No. The content is specifically for `@clerk/react` in Vite/CRA single-page applications. Separate patterns are referenced for Next.js and TanStack Start.

What are the main requirements or limitations?

The application must use `ClerkProvider` with a valid publishable key, and authentication logic should always check `isLoaded` before relying on `isSignedIn`. The documented model is client-only and does not include server-side `auth()` usage.

All Files

12 files
SKILL.md4.1 KB
View
templates/react-basic-auth/package.json0.4 KB
View
templates/react-basic-auth/src/main.tsx0.3 KB
View
templates/react-basic-auth/vite.config.ts0.1 KB
View
templates/react-basic-auth/src/App.tsx0.3 KB
View
templates/react-basic-auth/index.html0.3 KB
View
templates/react-basic-auth/tsconfig.json0.2 KB
View
evals/evals.json4.5 KB
View
references/custom-flows.md2.7 KB
View
references/hooks.md2.3 KB
View
references/protected-routes.md2.2 KB
View
references/router-integration.md2.0 KB
View

Install clerk-react-patterns

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill

Repository

clerk/skills

Related Skills

short-form-video

14

multi-asset-morning-briefing

7,907

content-strategy

2,901

doherty-threshold

2,901