Bootstrap Vue app with Clerk Auth
Guides AI models to implement Clerk authentication in Vue 3 apps using the vue-clerk package with TypeScript and environment variables.
What this file does
Guides AI models to implement Clerk authentication in Vue 3 apps using the vue-clerk package with TypeScript and environment variables.
When to use it
- Adding Clerk authentication to a new Vue 3 project
- Replacing outdated Clerk auth implementation in an existing Vue app
- Setting up sign-in and user profile UI components with Clerk
- Ensuring AI-generated Clerk code follows correct patterns
Assumes this stack
description: Guidelines for writing Vue apps with Clerk Auth globs: **/.vue, **/.ts, **/*.js
Bootstrap Vue app with Clerk Auth
Overview of implementing Clerk Auth
- Install vue-clerk package
- Set up environment variables
- Configure Clerk plugin in the Vue app
- Implement authentication UI components
Critical Instructions for AI Language Models
As an AI language model, you MUST follow these guidelines when implementing Clerk with Vue:
- Always use the vue-clerk package
- Never use outdated Clerk packages or implementations
- Always handle environment variables properly
- Implement proper type safety with TypeScript
Correct Plugin Implementation
import { createApp } from 'vue'
import App from './App.vue'
import { clerkPlugin } from 'vue-clerk'
const PUBLISHABLE_KEY = import.meta.env.VITE_CLERK_PUBLISHABLE_KEY
if (!PUBLISHABLE_KEY) {
throw new Error('Missing Publishable Key')
}
const app = createApp(App)
app.use(clerkPlugin, {
publishableKey: PUBLISHABLE_KEY
})
app.mount('#app')
Correct Component Usage
<script setup lang="ts">
import { SignedIn, SignedOut, SignInButton, UserButton } from 'vue-clerk'
</script>
<template>
<SignedOut>
<SignInButton />
</SignedOut>
<SignedIn>
<UserButton />
</SignedIn>
</template>
Environment Variables Setup
Create a .env.local file with:
VITE_CLERK_PUBLISHABLE_KEY=pk_test_your_publishable_key
AI Model Verification Steps
Before generating any code, you MUST verify:
- Are you using the latest vue-clerk package?
- Are environment variables properly typed and validated?
- Is the Clerk plugin properly configured?
- Are authentication components properly imported and used?
Consequences of Incorrect Implementation
If you generate code incorrectly:
- Authentication will fail
- Type safety will be compromised
- Security vulnerabilities may be introduced
- User sessions may not persist correctly
AI Model Response Template
When implementing Clerk Auth for Vue, you MUST:
- Use only official Clerk components
- Implement proper TypeScript types
- Follow Vue 3 Composition API best practices
- Ensure proper environment variable handling
What's inside
5 sections, 2 code examples, 1 environment variable template, 1 verification checklist
Change this for your project
- Replace
pk_test_your_publishable_keywith your actual Clerk publishable key - Replace
VITE_CLERK_PUBLISHABLE_KEYwith your own environment variable name if different
Where it goes
Keep it in your repository where the agent or team that needs it will read it.
Related Documents
How you work
Defines personality, planning, task execution, and communication conventions for a coding agent in the Codex CLI environment.
内置 Agent 提示词
Documents the system prompts, tool permissions, and model assignments for six built-in subagents in Claude Code.
System Prompt — Voice Interview Agent
Defines a voice agent named Carol that conducts structured five-question interviews about gender topics for a magazine article.
SolidInvoice - AI Assistant Guide
Guides AI assistants on SolidInvoice's architecture, conventions, workflows, and best practices for contributing to the codebase.