Index of every page on this site: llms.txt
All skills
clerk avatar

/clerk-vue-patterns

@95f241a official
by clerkclerk/skills95 stars
6
Run it yourself

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.

Use this Skill: https://skilld.dev/gh/clerk/skills/clerk-vue-patterns

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈75 tokens for metadata: the name and description. ≈654 when used: this file. ≈2k more on demand in 5 files.

Description uses 3.7% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈297 characters, or 3.7%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

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)

// 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

<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

<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

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts9d4 checks · Risk SAFE
  • Gen Agent Trust Hub9d

    The skill provides standard architectural patterns for integrating Clerk authentication into Vue 3 applications. No security issues were detected; the patterns follow official documentation and industry best practices for authentication and reactivity.

  • Socket9d

    No alerts

  • Snyk9d

    Risk: LOW · No issues

  • ZeroLeaks7mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 95f241a. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated last week
What it can do
Network
metadata
{
  "author": "clerk",
  "version": "1.0.0"
}
All 1 allowed tools
WebFetch
  • Vue
  • clerk
  • composables
  • authentication
  • vue-router
  • pinia
  • organizations

README badge

README badge for clerk/skills/clerk-vue-patterns

Provides Clerk auth composables and patterns for Vue 3, including useAuth, useUser, useOrganization, Vue Router guards, and Pinia store integration. Targets @clerk/vue v2+ and assumes you're building with plain Vue rather than Nuxt.

Generated from the current SKILL.md.

Does this skill cover Nuxt?
No. This skill targets Vue 3 with @clerk/vue. For Nuxt, use clerk-nuxt-patterns instead.
What composables does this skill teach?
useAuth, useUser, useClerk, and useOrganization — all from @clerk/vue v2+. Each provides reactive access to auth state, user data, and organization context.
Does this include Vue Router integration?
Yes. The skill covers Vue Router navigation guards for protecting routes based on auth state.
Can I use this with a Pinia store?
Yes. The skill includes a reference for integrating Clerk auth state with Pinia.
Why are my composables returning undefined?
Composables must be called inside the ClerkProvider tree. Ensure app.use(clerkPlugin, { publishableKey }) is invoked in main.ts.

Generated from the current SKILL.md. These answers refresh after source changes.