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.
npx skills add clerk/skills --skill clerk-vue-patterns -a claude-codeWhat 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-code2Manually: put the files in place
~/.claude/skills/clerk-vue-patterns/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/clerk-vue-patterns/
1Skills CLI (Vercel)
npx skills add clerk/skills --skill clerk-vue-patterns -a codex2Manually: put the files in place
.agents/skills/clerk-vue-patterns/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add clerk/skills --skill clerk-vue-patterns -a cursor2Manually: put the files in place
.cursor/skills/clerk-vue-patterns/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install clerk/skills clerk-vue-patterns2Manually: put the files in place
.github/skills/clerk-vue-patterns/SKILL.md1Skills CLI (Vercel)
npx skills add clerk/skills --skill clerk-vue-patterns -a gemini-cli2Platform CLI
gemini skills install https://github.com/clerk/skills --path skills/clerk-vue-patternsManually: put the files in place
.devin/skills/clerk-vue-patterns/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add clerk/skills --skill clerk-vue-patterns -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
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