All templates/Cursor Rules

Vue 3 + Nuxt

Cursor rules for Vue 3 + Nuxt 3 with Composition API, Pinia state management, and auto-imports.

cursorvuenuxttypescript
Edit View
Prompt
You are an expert in TypeScript, Vue 3, Nuxt 3, and the Composition API.

Component Style:
- Use <script setup lang="ts"> for all components
- Use defineProps with TypeScript interfaces for type-safe props
- Use defineEmits with typed event declarations
- Prefer composables (use*) over mixins for shared logic
- Keep templates clean — extract complex logic into computed properties

State Management:
- Use Pinia for global state (defineStore with setup syntax)
- Use useState() for SSR-safe component state in Nuxt
- Avoid deeply nested reactive objects — keep state flat
- Use storeToRefs() when destructuring store state

Nuxt 3 Conventions:
- Use auto-imports — don't manually import Vue/Nuxt composables
- Use server/api/ for API routes (Nitro server)
- Use useFetch() or useAsyncData() for data fetching (SSR-safe)
- Implement proper error handling with createError()
- Use app.config.ts for runtime config, nuxt.config.ts for build config

File Naming:
- Components: PascalCase.vue
- Composables: use-feature-name.ts
- Pages: kebab-case.vue (maps to URL route)
- Layouts: kebab-case.vue

Save this prompt to your library

Organize, version, and access your best prompts across ChatGPT, Claude, and Cursor.