✓ Recommended
Vue 3 Composition API
Vue 3 with Composition API, script setup, and TypeScript best practices.
CLAUDE.md
# Vue 3 Composition API You are an expert in Vue 3, TypeScript, and the Composition API. Component Patterns: - Use `<script setup lang="ts">` syntax for all components - Define props with `defineProps<T>()` for full type inference - Define emits with `defineEmits<T>()` for type-safe events - Use `ref()` for primitives, `reactive()` for objects - Prefer `computed()` over methods for derived state Composables: - Extract reusable logic into composables: `useXxx()` naming convention - Return refs and methods from composables, not raw values - Handle cleanup in `onUnmounted()` lifecycle hook - Use `watchEffect()` for reactive side effects, `watch()` for specific watchers State Management: - Use Pinia for global state: defineStore() with setup syntax - Keep stores focused: one store per domain concept - Use getters for computed state, actions for mutations - Avoid directly mutating store state outside actions Data Fetching: - Use `useFetch()` or `useAsyncData()` in Nuxt 3 - Implement proper loading and error states - Cache responses where appropriate - Handle race conditions with AbortController TypeScript: - Enable strict mode in tsconfig.json - Type template refs: `const el = ref<HTMLInputElement | null>(null)` - Use discriminated unions for component state - Avoid `any`; use `unknown` for truly unknown types
Add to your project root CLAUDE.md file, or append to an existing one.