frontend-vue
2
总安装量
2
周安装量
#65883
全站排名
安装命令
npx skills add https://github.com/projanvil/mindforge --skill frontend-vue
Agent 安装分布
opencode
2
gemini-cli
2
openhands
2
claude-code
2
github-copilot
2
codex
2
Skill 文档
Vue Development Skill
Comprehensive skill for modern Vue.js development, focusing on Nuxt 3, Vue 3 Composition API, Tailwind CSS, and the Vue ecosystem.
Technology Stack
Core Framework: Vue 3 + Nuxt 3
Vue 3 Features
- Composition API: Logic reuse with
<script setup> - Reactivity System:
ref,reactive,computed,watch - Teleport: Rendering content outside the component DOM hierarchy
- Fragments: Multiple root nodes support
- Suspense: Handling async dependencies
Nuxt 3 Features
- Auto-imports: Automatically imports Vue APIs and component components
- File-based Routing: Pages in
pages/directory create routes - Server Engine (Nitro): Universal deployment
- Data Fetching:
useFetch,useAsyncData - Server Routes: API endpoints in
server/api/ - SEO/Meta:
useHead,useSeoMeta
UI Framework: Tailwind CSS + shadcn-vue
Tailwind CSS
- Utility-first architecture
- Configured via
tailwind.config.ts - Optimized with PostCSS
shadcn-vue (or similar)
- Vue port of shadcn/ui
- Accessible components based on Radix Vue
- Key Components: Button, Input, Select, Dialog, Toast
State Management
- Pinia: The official state management library for Vue
- Modular stores
- TypeScript support
- DevTools integration
- No mutations (only actions)
Project Architecture
Recommend Directory Structure (Nuxt 3)
project-root/
âââ app.vue # Root component
âââ nuxt.config.ts # Configuration
âââ components/ # Auto-imported components
â âââ ui/ # UI library components
â â âââ button/
â â âââ ...
â âââ Header.vue
âââ pages/ # Routes
â âââ index.vue
â âââ about.vue
âââ layouts/ # Layout wrappers
â âââ default.vue
âââ composables/ # Auto-imported logic
â âââ useUser.ts
âââ server/ # Server API
â âââ api/
â âââ hello.ts
âââ stores/ # Pinia stores
â âââ counter.ts
âââ assets/ # CSS, images
âââ main.css
Best Practices
Composition API with <script setup>
- Use
constfor reactive variables. - Keep logic organized by feature.
- Extract complex logic into composables (
composables/).
Performance
- Async Components: Use
defineAsyncComponentfor lazy loading. - Lazy Fetching: Use
lazy: trueoption inuseFetchfor non-critical data. - Asset Optimization: Use Nuxt Image for image optimization.
Nuxt Specifics
- Hydration Mismatch: Ensure HTML rendered on server matches client. Avoid random IDs or dates during initial render.
- Middleware: Use Route Middleware for auth guards (
middleware/auth.ts).
Common Code Patterns
Nuxt Page with Data Fetching
<script setup lang="ts">
const { data: user, error } = await useFetch('/api/user/1')
if (error.value) {
console.error(error.value)
}
</script>
<template>
<div v-if="user" class="p-4">
<h1 class="text-2xl font-bold">{{ user.name }}</h1>
<p>{{ user.email }}</p>
</div>
<div v-else>Loading...</div>
</template>
Pinia Store
// stores/counter.ts
import { defineStore } from 'pinia'
export const useCounterStore = defineStore('counter', () => {
const count = ref(0)
const doubleCount = computed(() => count.value * 2)
function increment() {
count.value++
}
return { count, doubleCount, increment }
})
Composable
// composables/useMouse.ts
export function useMouse() {
const x = ref(0)
const y = ref(0)
function update(event) {
x.value = event.pageX
y.value = event.pageY
}
onMounted(() => window.addEventListener('mousemove', update))
onUnmounted(() => window.removeEventListener('mousemove', update))
return { x, y }
}