vue-claude-stack — Cursor rule: what it does and how to install
This rule guides code generation for Vue 3 and Nuxt 3, covering Composition API, TypeScript, and Pinia. Use it to give an agent consistent project conventions.
.cursor/rules/vue-claude-stack.mdcWhat vue-claude-stack does
The rule targets files matching **/* and sets conventions for Vue and Nuxt. It directs the agent to use Composition API with <script setup lang="ts">, typed props and events, and composables for reactive logic. Options API, any, and v-html with user input are disallowed. These rules shape both new components and code changes.
For Pinia, it calls for setup stores and storeToRefs() when unpacking state. Nuxt guidance covers useFetch or useAsyncData, file-based routes, and server handlers under server/api/. Tests use Vitest and @vue/test-utils, with test files beside their source. Check your Vue version: the defineModel() guidance is for Vue 3.4+.
The metadata sets globs: **/* and alwaysApply: false. In Cursor, place the rule at .cursor/rules/vue-claude-stack.mdc.
What it helps with
- guide component generation toward Composition API
- add types to props, events, and Pinia state
- structure Nuxt data fetching for SSR
- set conventions for Vue component tests
- avoid
v-htmlwith user-provided content
Example prompts for the agent
- Create a Vue component with
<script setup lang="ts">and typed props. - Add a Pinia setup store and use
storeToRefs()for its state. - Write a colocated test with Vitest and
@vue/test-utils.
How to install vue-claude-stack
Manually: put the files in place
.cursor/rules/vue-claude-stack.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.claude/rules/vue-claude-stack.mdThe paths frontmatter field limits the files: move globs from the source into paths
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.github/instructions/vue-claude-stack.instructions.mdThe applyTo field sets which files it applies to: move globs from the source into applyTo
Manually: put the files in place
.devin/rules/vue-claude-stack.mdManually: put the files in place
.clinerules/vue-claude-stack.mdStep by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules
Questions about vue-claude-stack
How do I install vue-claude-stack in Cursor?
Place the rule file at .cursor/rules/vue-claude-stack.mdc.
What does vue-claude-stack do?
It sets coding conventions for Vue 3 and Nuxt 3, including Composition API, TypeScript, Pinia, routing, and tests.
Which Vue version is needed for defineModel()?
The rule uses defineModel() for Vue 3.4 and later.
Source text
vue-claude-stack.mdc · CC0-1.0
---
description: "Complete AI coding setup for Vue 3 & Nuxt 3 — .cursorrules + CLAUDE.md + Copilot instructions + generation skills."
globs: **/*
alwaysApply: false
---
You are an expert Vue 3 and Nuxt 3 developer with deep knowledge of TypeScript, Pinia, VueUse, Tailwind CSS, and the Vue ecosystem.
## Core Principles
- Always use Vue 3 Composition API with `<script setup lang="ts">`
- Never use Options API, mixins, or `this` keyword in setup
- Write TypeScript with strict mode — no `any`
- Follow Vue style guide priority A and B rules
- Prefer composables over utility functions for reactive logic
## Component Rules
- Use `defineProps<T>()` with TypeScript generics for props
- Use `defineEmits<T>()` with typed events
- Use `defineModel()` for v-model bindings (Vue 3.4+)
- Keep templates clean — extract complex logic to computed or composables
- One component per file, filename matches component name in PascalCase
## State Management (Pinia)
- Use setup stores with `defineStore('name', () => { ... })`
- Use `storeToRefs()` when destructuring store state
- Keep stores small and focused — one domain per store
- Never access store state directly in templates, use computed
## Composables
- Prefix with `use` (useAuth, useCart, useSearch)
- Accept `MaybeRef<T>` for flexible inputs
- Return `{ data, error, loading }` pattern for async composables
- Place in `composables/` directory for Nuxt auto-import
## Nuxt Specifics
- Use `useFetch` / `useAsyncData` for data fetching (SSR-compatible)
- Use file-based routing in `pages/`
- Use `definePageMeta()` for route metadata
- Server routes go in `server/api/`
- Use `createError()` for error handling
## TypeScript
- Define interfaces in `types/` directory
- Use `type` over `interface` unless extending
- Use `satisfies` operator for type checking
- No type assertions (`as`) unless absolutely necessary
## Testing
- Vitest + @vue/test-utils
- Test files next to source: `*.test.ts`
- Test behavior, not implementation
- Use `mount()` over `shallowMount()`
## Tailwind CSS
- Use utility classes directly in templates
- Extract repeated patterns to components, not CSS classes
- Use `@apply` sparingly — only in base styles
- Dark mode: use `dark:` variant
## Do NOT
- Generate Options API code
- Use `any` type — use `unknown` and narrow
- Put business logic in components
- Skip TypeScript on any file
- Use `v-html` with user input
- Mutate props
- Use `var` — always `const` or `let`
© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules