frontend-vue
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 }
}
More from projanvil/mindforge
enterprise-java
Enterprise Java development skill covering Spring ecosystem, microservices, design patterns, performance optimization, and Java best practices. Use this skill when building enterprise Java applications, working with Spring Boot, implementing microservices, or need guidance on Java architecture and performance tuning.
12frontend-react
Professional React development skill covering Next.js, React Server Components, Tailwind CSS, and the React ecosystem. Use this skill when building modern React applications, implementing Next.js features, creating UI components with shadcn/ui, or working with complex state management.
10api-design
Professional API design skill covering RESTful APIs, GraphQL, API versioning, authentication, idempotency, and API documentation best practices. Use this skill when designing RESTful APIs, creating GraphQL schemas, implementing API versioning strategies, or need guidance on authentication, error handling, and API documentation.
10testing
Comprehensive software testing skill covering unit tests, integration tests, TDD/BDD, mocking strategies, and test automation across multiple languages. Use this skill when writing test cases, designing test strategies, implementing test automation, or need guidance on testing frameworks and best practices. Ideal for ensuring code quality through comprehensive testing approaches.
9design-pattern
Expert knowledge in software design patterns covering GoF patterns, architectural patterns, and modern design principles. Apply appropriate patterns to improve code maintainability, scalability, and extensibility. Use this skill when designing new software components, refactoring existing code, reviewing code for design quality, resolving complex design problems, or need guidance on applying SOLID principles and identifying code smells.
9tech-documentation
Technical documentation writing skill covering API docs, architecture documentation, deployment guides, and various technical writing best practices. Use this skill when creating technical documentation, writing API documentation, creating architecture design documents, or need templates for deployment and operations manuals.
9