AGENT SKILL

clerk-vue-patterns

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
最近更新
2026-11-14
Stars
★ 1
Forks
0

01 前言 Front Matter

name
clerk-vue-patterns
license
MIT
metadata
{ "author": "clerk", "version": "1.0.0" }
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.
allowed-tools
WebFetch

02 资源文件 12

03 SKILL.md 正文

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

04 同仓库更多 Skills

Allternit
Allternit/allternit-platform

jev

Ask typed System One judgments (noul / choice / score) against Allternit's LOCAL System One server instead of prompting a chat model to "return JSON". Use when classifying, routing, scoring, or screening something and code needs a probability it can branch on, or when the user runs /jev. Official TypeSafe Jev is an optional, explicit remote lane.

★ 1
Allternit
Allternit/allternit-platform

jev-route

Route with local System One answers — map Choice + confidence to act / confirm / human lanes, or pick a model tier by Choice label. Also documents the separate `route-model` helper for OpenRouter's typesafe/jev-router (a chat-model router, NOT System One). Use for confidence routing, model-tier routing, or when the user runs /jev-route.

★ 1
Allternit
Allternit/allternit-platform

jev-guardrail

Screen text or agent tool calls with a battery of local System One Noul hazards plus a Score, with policy in code — and the Claude Code PreToolUse guard (hooks/pretooluse-guard) that puts deterministic hard rules first and lets Jev only raise friction. Use for injection/secret/destructive-action screening or when the user runs /jev-guardrail.

★ 1
Allternit
Allternit/allternit-platform

jev-fanout

Ask every independent System One question over the same state in ONE POST /v1/systemone to the local server (speculative fan-out). Use for parallel judgments, compound commands, one-call turn assessment, or when the user runs /jev-fanout. Do not fire one HTTP call per question.

后端与接口
★ 1
Allternit
Allternit/allternit-platform

memory-drive

Read and write the user's Allternit Memory Drive, a git repo of markdown memories in the open Agent Memory Repo format. Use at the start of a session to load what the user's agents remember (MEMORY.md), when the user says "remember this", when you learn a durable fact about the user or their work, and before answering questions that depend on past sessions.

★ 1
Allternit
Allternit/allternit-platform

agent-orchestrator

Orchestrate external CLI agents (kimi, codex, agy, claude, grok, gizzi) through the Allternit Factory (gizzi agents / orchestration / workspace / workflows). Use when the user asks to delegate, offload, or farm out implementation work to another CLI agent / terminal session, or to run work outside this session to save tokens. Part of Allternit Agents / Bot Agents — not a separate product.

Skill与智能体开发
★ 1