A guide for developing with Vue.js 3, focusing on the Composition API and single-file components.
Install
mkdir -p .claude/skills/vue-terminalskills && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/19526" && unzip -o skill.zip -d .claude/skills/vue-terminalskills && rm skill.zipInstalls to .claude/skills/vue-terminalskills
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Vue.js is a progressive JavaScript framework for building user interfaces. It features the Composition API with reactive refs and computed values, single-file components, and an approachable learning curve with powerful scaling capabilities.Key capabilities
- →Implement reactive state using Composition API
- →Structure applications with Pinia stores
- →Define reusable logic with composables
- →Configure routing with Vue Router
- →Create type-safe components with script setup
How it works
Vue 3 utilizes the Composition API for reactive state management and single-file components. It use a virtual DOM with compiler optimizations to scale from simple prototypes to complex applications.
Inputs & outputs
When to use vue
- →Create a new Vue 3 project with Vite
- →Implement reactive state using Composition API
- →Structure a Vue application with Pinia
- →Build reusable components
About this skill
Vue
Vue 3 uses the Composition API for reactive state management, single-file components (.vue), and a virtual DOM with compiler optimizations. It scales from progressive enhancement to full SPAs.
Installation
# Create Vue project with Vite
npm create vue@latest my-app
cd my-app
npm install
npm run dev
Project Structure
# Vue 3 project layout
src/
├── App.vue # Root component
├── main.ts # Entry point
├── router/index.ts # Vue Router config
├── stores/ # Pinia stores
│ └── articles.ts
├── composables/ # Reusable logic
│ └── useApi.ts
├── components/ # Shared components
│ └── ArticleCard.vue
├── views/ # Page components
│ ├── HomeView.vue
│ └── ArticlesView.vue
└── types/ # TypeScript types
└── article.ts
Components (Composition API)
<!-- src/views/ArticlesView.vue — page component with script setup -->
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import type { Article } from '@/types/article'
import ArticleCard from '@/components/ArticleCard.vue'
const articles = ref<Article[]>([])
const loading = ref(true)
onMounted(async () => {
const res = await fetch('/api/articles')
articles.value = await res.json()
loading.value = false
})
</script>
<template>
<div>
<h1>Articles</h1>
<p v-if="loading">Loading...</p>
<div v-else>
<ArticleCard v-for="article in articles" :key="article.id" :article="article" />
</div>
</div>
</template>
<!-- src/components/ArticleCard.vue — reusable component with props -->
<script setup lang="ts">
import type { Article } from '@/types/article'
const props = defineProps<{ article: Article }>()
const emit = defineEmits<{ (e: 'delete', id: number): void }>()
</script>
<template>
<article class="card">
<RouterLink :to="`/articles/${props.article.slug}`">
<h2>{{ article.title }}</h2>
</RouterLink>
<p>{{ article.excerpt }}</p>
<button @click="emit('delete', article.id)">Delete</button>
</article>
</template>
Reactivity
<!-- src/components/Counter.vue — reactive state demo -->
<script setup lang="ts">
import { ref, computed, watch } from 'vue'
const count = ref(0)
const doubled = computed(() => count.value * 2)
watch(count, (newVal) => {
console.log(`Count changed to ${newVal}`)
})
function increment() {
count.value++
}
</script>
<template>
<div>
<p>Count: {{ count }} (doubled: {{ doubled }})</p>
<button @click="increment">+1</button>
</div>
</template>
Pinia Store
// src/stores/articles.ts — Pinia state management
import { defineStore } from 'pinia'
import { ref, computed } from 'vue'
import type { Article } from '@/types/article'
export const useArticlesStore = defineStore('articles', () => {
const articles = ref<Article[]>([])
const loading = ref(false)
const published = computed(() => articles.value.filter((a) => a.published))
async function fetchAll() {
loading.value = true
const res = await fetch('/api/articles')
articles.value = await res.json()
loading.value = false
}
async function create(data: Partial<Article>) {
const res = await fetch('/api/articles', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
})
const article = await res.json()
articles.value.unshift(article)
}
return { articles, loading, published, fetchAll, create }
})
Composables
// src/composables/useApi.ts — reusable fetch composable
import { ref, type Ref } from 'vue'
export function useApi<T>(url: string) {
const data: Ref<T | null> = ref(null)
const error = ref<string | null>(null)
const loading = ref(false)
async function execute() {
loading.value = true
error.value = null
try {
const res = await fetch(url)
if (!res.ok) throw new Error(`HTTP ${res.status}`)
data.value = await res.json()
} catch (e: any) {
error.value = e.message
} finally {
loading.value = false
}
}
return { data, error, loading, execute }
}
Router
// src/router/index.ts — Vue Router configuration
import { createRouter, createWebHistory } from 'vue-router'
const router = createRouter({
history: createWebHistory(),
routes: [
{ path: '/', component: () => import('@/views/HomeView.vue') },
{ path: '/articles', component: () => import('@/views/ArticlesView.vue') },
{ path: '/articles/:slug', component: () => import('@/views/ArticleView.vue'), props: true },
{
path: '/admin',
component: () => import('@/views/AdminView.vue'),
meta: { requiresAuth: true },
},
],
})
router.beforeEach((to) => {
if (to.meta.requiresAuth && !isAuthenticated()) {
return '/login'
}
})
export default router
Provide/Inject
// src/main.ts — provide global dependencies
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import router from './router'
const app = createApp(App)
app.use(createPinia())
app.use(router)
app.provide('apiBase', '/api')
app.mount('#app')
Key Patterns
- Use
<script setup>for concise component definitions — it's the recommended style - Use
ref()for primitives,reactive()for objects;refis generally preferred - Use Pinia stores for shared state across components
- Extract reusable logic into composables (
use*functions) - Use
defineProps<T>()anddefineEmits<T>()for type-safe component interfaces - Lazy-load route components with dynamic
import()for code splitting
Prerequisites
How it compares
Unlike manual DOM manipulation, this framework uses reactive refs and computed values to automatically sync the user interface with application state.
Compared to similar skills
vue side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| vue (this skill) | 0 | 2mo | Review | Intermediate |
| vue-best-practices | 19 | 4mo | No flags | Intermediate |
| vue-pages | 1 | 6mo | No flags | Intermediate |
| pinia | 1 | 6mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by TerminalSkills
View all by TerminalSkills →You might also like
vue-best-practices
antfu
MUST be used for Vue.js tasks. Strongly recommends Composition API with `<script setup>` and TypeScript as the standard approach. Covers Vue 3, SSR, Volar, vue-tsc. Load for any Vue, .vue files, Vue Router, Pinia, or Vite with Vue work. ALWAYS use Composition API unless the project explicitly requires Options API.
vue-pages
JaguarJack
Generate Vue frontend pages using catch-table for CatchAdmin module with full component features.
pinia
antfu
Pinia official Vue state management library, type-safe and extensible. Use when defining stores, working with state/getters/actions, or implementing store patterns in Vue apps.
vue
valibali
Use when editing .vue files, creating Vue 3 components, writing composables, or testing Vue code - provides Composition API patterns, props/emits best practices, VueUse integration, and reactive destructuring guidance
vue-testing-best-practices
vuejs-ai
Use for Vue.js testing. Covers Vitest, Vue Test Utils, component testing, mocking, testing patterns, and Playwright for E2E testing.
vue-debug-guides
vuejs-ai
Vue 3 debugging and error handling for runtime errors, warnings, async failures, and SSR/hydration issues. Use when diagnosing or fixing Vue issues.