Skip to main content
skill CX Codex

clerk-vue-patterns — Claude Code skill for Vue 3 and Clerk

A skill that tells your agent how to wire Vue 3 to Clerk: composables, Vue Router guards and a Pinia auth store.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add clerk/skills --skill clerk-vue-patterns -a claude-code
Open on GitHub

What clerk-vue-patterns does

The skill covers @clerk/vue v2+ inside a Vue 3 app. It ships reference files for the composables useAuth, useUser, useClerk and useOrganization, for Vue Router navigation guards, and for a Pinia store holding auth state. Your agent opens the right file when you ask about sign-in, sign-out or org switching.

Setup goes through clerkPlugin in main.ts, with publishableKey read from VITE_CLERK_PUBLISHABLE_KEY. The composables hand back reactive values: isSignedIn, userId, user, organization. Switching the active organization runs through useOrganizationList and setActive.

The skill also lists the usual breakages. A composable returning undefined means the call sits outside the ClerkProvider tree, so check that app.use(clerkPlugin, { publishableKey }) actually ran. Nuxt projects are out of scope here — the description points to clerk-nuxt-patterns instead.

What it helps with

  • register Clerk in a Vue 3 app through clerkPlugin
  • read reactive isSignedIn and userId inside a component
  • block unauthenticated users from Vue Router routes
  • keep auth state in a Pinia store
  • switch the active organization with useOrganizationList

Example prompts for the agent

  • Show me how to render the user's first name with useUser in Vue 3
  • Add a Vue Router guard that only lets signed-in users through
  • Build a Pinia store that holds Clerk auth state

How to install clerk-vue-patterns

1Skills CLI (Vercel)

npx skills add clerk/skills --skill clerk-vue-patterns -a claude-code

2Manually: put the files in place

~/.claude/skills/clerk-vue-patterns/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/clerk-vue-patterns/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about clerk-vue-patterns

How do I install clerk-vue-patterns in Claude?

Run npx skills add clerk/skills --skill clerk-vue-patterns -a claude-code. The skill lands at ~/.claude/skills/clerk-vue-patterns/SKILL.md.

What does clerk-vue-patterns do?

It gives the agent Vue 3 patterns for Clerk: composables, Vue Router guards and a Pinia store. It also covers pitfalls such as a composable returning undefined.

Does it work with Nuxt?

No. The description points Nuxt users to a separate skill, clerk-nuxt-patterns.

Source text

SKILL.md · MIT
---
name: clerk-vue-patterns
description: 'Vue 3 patterns with Clerk — composables (useAuth, useUser,
  useClerk, useOrganization), Vue Router guards, Pinia auth store
  integration. Triggers on: vue clerk, useAuth vue, clerk composables,
  vue router clerk guard, pinia auth clerk. For Nuxt, use clerk-nuxt-patterns instead.'
license: MIT
allowed-tools: WebFetch
metadata:
  author: clerk
  version: 1.0.0
---

# Vue Patterns

SDK: `@clerk/vue` v2+ (Vue 3). For Nuxt, use `clerk-nuxt-patterns`.

## What Do You Need?

| Task | Reference |
|------|-----------|
| Composables: useAuth, useUser, useOrganization | references/composables.md |
| Vue Router navigation guards | references/vue-router-guards.md |
| Pinia store with auth state | references/pinia-integration.md |

## Mental Model

Vue uses composables from `@clerk/vue`:

- **`useAuth()`** — reactive `isSignedIn`, `userId`, `signOut`
- **`useUser()`** — reactive `user` object
- **`useClerk()`** — full Clerk instance for advanced operations
- **`useOrganization()`** — reactive `organization`, `membership`

## Setup

### Vue (Plain)

```ts
// main.ts
import { clerkPlugin } from '@clerk/vue'
import { createApp } from 'vue'
import App from './App.vue'

const app = createApp(App)
app.use(clerkPlugin, {
  publishableKey: import.meta.env.VITE_CLERK_PUBLISHABLE_KEY,
})
app.mount('#app')
```

## Composables Usage

```vue
<script setup lang="ts">
import { useAuth, useUser } from '@clerk/vue'

const { isSignedIn, userId, signOut } = useAuth()
const { user } = useUser()
</script>

<template>
  <div v-if="isSignedIn">
    <p>Hello {{ user?.firstName }}</p>
    <button @click="signOut()">Sign Out</button>
  </div>
  <SignInButton v-else />
</template>
```

## Org Switching

```vue
<script setup lang="ts">
import { useOrganizationList } from '@clerk/vue'

const { userMemberships, setActive } = useOrganizationList()
</script>

<template>
  <button
    v-for="mem in userMemberships.data ?? []"
    :key="mem.organization.id"
    @click="setActive({ organization: mem.organization.id })"
  >
    {{ mem.organization.name }}
  </button>
</template>
```

## Common Pitfalls

| Symptom | Cause | Fix |
|---------|-------|-----|
| Composables return `undefined` | Not inside `ClerkProvider` tree | Ensure `app.use(clerkPlugin, { publishableKey })` is called |
| `userId` reactive but not updating | Destructuring loses reactivity | Use `const { userId } = useAuth()` (toRefs-style composable, reactive) |
## Import Map

| What | Import |
|------|--------|
| Composables | `@clerk/vue` |
| Plugin setup | `@clerk/vue` |
| Components | `@clerk/vue` |

## See Also

- `clerk-setup` - Initial Clerk install
- `clerk-custom-ui` - Custom flows & appearance
- `clerk-orgs` - B2B organizations

## Docs

- [Vue SDK](https://clerk.com/docs/vue/getting-started/quickstart)

© clerk · MIT · clerk/skills

Similar skills

Everything for Frontend and UI →

From the same set19

clerk-react-router-patterns Guides Clerk integration with React Router v7/v8, including loaders, protected routes, SSR auth, and organization switching. Useful when wiring auth into a router. CX Codex +1 15,500installs clerk-tanstack-patterns Walks your agent through Clerk auth in TanStack React Start: route guards, createServerFn, loaders and request middleware. CX Codex +1 15,500installs clerk-swift Builds Clerk sign-in UI in native iOS and macOS apps: prebuilt ClerkKitUI views or custom ClerkKit flows. CX Codex +1 14,500installs clerk-chrome-extension-patterns Guides integration of @clerk/chrome-extension into Chrome extensions. Helps configure popup sign-in, service worker session tokens, and OAuth delegation via syncHost. CX Codex +1 14,400installs clerk-astro-patterns Walks your agent through Clerk inside Astro: middleware, protected SSR pages, API route auth and island components. CX Codex +1 14,300installs clerk-android A skill that walks your agent through adding Clerk to a native Android app in Kotlin and Jetpack Compose, using prebuilt AuthView/UserButton or a custom API flow. CX Codex +1 14,400installs clerk-expo A skill that wires Clerk sign-in and sign-up into Expo and React Native apps. Useful when you want prebuilt auth screens or custom flows with OTP and MFA. CX Codex +1 14,100installs clerk-nuxt-patterns Provides @clerk/nuxt authentication patterns for Nuxt 3 projects. It helps configure Nitro server routes, client composables, and SSR route guards. CX Codex +1 13,900installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor