clerk-vue-patterns

Implements Clerk authentication in Vue 3 apps using composables, router guards, and Pinia stores.

Updated Aug 22, 2026
One-click install
npx skills add https://github.com/Rajaryan1726/ai-code-review-system --skill clerk-vue-patterns-rajaryan1726
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: clerk-vue-patterns
Source: https://github.com/Rajaryan1726/ai-code-review-system/tree/main/client/.agents/skills/clerk-vue-patterns
Command: npx skills add https://github.com/Rajaryan1726/ai-code-review-system --skill clerk-vue-patterns-rajaryan1726

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @clerk/vue, and includes references (resource) components.

What problem does it solve? Integrating Clerk authentication into a plain Vue 3 application requires knowing the correct composables, reactivity rules, and guard patterns, and mistakes like losing reactivity or trusting auth state before Clerk loads cause subtle bugs. ## Core Features & Use Cases - Composables Reference: Covers useAuth, useUser, useClerk, useOrganization, useOrganizationList, and useSignIn from @clerk/vue with correct ref handling. - Vue Router Guards: Provides global and per-route navigation guard patterns, including org-gated routes and isLoaded checks. - Pinia Integration: Shows how to wrap Clerk composables in Pinia stores without copying state and creating stale data. - Use Case: You are building a Vue 3 SPA and need a sign-in flow, a protected dashboard route, and an app-wide auth store — this Skill supplies working patterns for all three. ## Quick Start Ask the assistant to add Clerk authentication to your Vue 3 app with a protected route and a Pinia auth store.

Frequently Asked Questions about clerk-vue-patterns

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

FAQPage Schema
How do I use Clerk composables in a Vue 3 component?▼

Import useAuth and useUser from @clerk/vue after registering clerkPlugin with your publishable key in main.ts. useAuth exposes isSignedIn, userId, and signOut, while useUser exposes the reactive user object with fields like firstName.

How to protect Vue Router routes with Clerk authentication?▼

Add a global beforeEach guard that checks route meta flags like requiresAuth, then reads userId from useAuth and redirects to /sign-in when absent. Always wait for isLoaded before trusting isSignedIn, since the guard can fire before Clerk initializes.

How do I sync Clerk auth state with a Pinia store?▼

Define a setup-style Pinia store that calls useAuth and useUser inside the store function and returns the refs directly. Do not copy userId into separate state, because that creates a stale copy that stops updating on sign-in or sign-out.

Does @clerk/vue work with Nuxt?▼

This Skill targets plain Vue 3 with @clerk/vue only. For Nuxt, use the clerk-nuxt-patterns approach instead, which relies on Nuxt middleware rather than manual Vue Router guards.

Why do Clerk composables return undefined in my Vue app?▼

Composables return undefined when the app is not wrapped by the Clerk plugin. Ensure app.use(clerkPlugin, { publishableKey }) is called in main.ts before mounting, with VITE_CLERK_PUBLISHABLE_KEY set in your environment.