4 vue rules available
Cursor has four Vue rules, all at least 250 characters: a long Composition API rule with Pinia, a Pinia state-management rule, Composition API patterns and component design. The .mdc file below attaches to .vue files, composables and stores.
Cursor applies project rules stored as .mdc files in .cursor/rules. Each rule's frontmatter (description, globs, alwaysApply) decides whether it is always included, attached to matching files, chosen by the agent from its description, or only used when you @-mention it. Cursor also reads AGENTS.md in the project root and subdirectories for plain-Markdown instructions.
.cursor/rules/vue.mdcStarting point, not a tested configuration for your repository. Attached when files matching the globs are in context (alwaysApply: false with globs). Review the instructions, adapt the file paths and run your project's existing checks.
---
description: "Vue.js development project conventions"
globs: "**/*.vue,src/composables/**/*.ts,src/stores/**/*.ts"
alwaysApply: false
---
# Vue.js instructions for Cursor
## Focus for this project
- Write new Pinia stores in setup style (defineStore with a function) unless the project uses option stores.
- Use storeToRefs when destructuring state from a store in components.
- Test stores with a fresh Pinia instance per test (setActivePinia(createPinia())).
## Vue.js conventions
- Use <script setup lang="ts"> with type-based defineProps<{ ... }>() and defineEmits for new components; keep the Options API only in files that already use it.
- Use computed for derived values and watch only for side effects.
- Put shared logic in composables named useXxx under src/composables.
- Do not mutate props; emit an event or use defineModel for two-way binding.
## Before you finish
- Run npx vue-tsc --noEmit, the lint script and the unit tests (for example Vitest) and report the actual output. If you cannot run them, say so and list the exact commands instead of saying they pass.
- Summarize which of the rules above affected the change.
- If another attached Cursor rule conflicts with this one, name both rules and follow the one with the narrower globs.
Create your own Cursor rules for Vue.js and share with the community.
Ask for a small change to one matching file. Check the tool's loaded context or instruction view, inspect the diff for the requested convention, and run the relevant build or test. A well-formatted file does not guarantee the model follows every instruction.
Cursor's docs recommend keeping individual rules under 500 lines and splitting large rules into composable ones. Cursor's documentation states that it supports AGENTS.md in the project root and in subdirectories. Use AGENTS.md for plain-Markdown instructions you also want other tools to read, and .mdc rules when you need Cursor's scoping options (globs, description-based selection, always-apply).
Documentation checked 2026-11-05: Cursor docs: Rules
Illustrative input and expected result. This example is a verification guide, not a recorded model run.
You ask Cursor's agent to add a Pinia store and want the setup-store style with typed state and tests.
Add a notifications store with add, dismiss and an unreadCount getter.
src/stores/notifications.ts as a setup store with ref state and a computed unreadCount, a component using storeToRefs, Vitest tests with a fresh Pinia, and vue-tsc output.
Content reviewed 2026-11-05. Confirm instruction activation in your installed client before relying on it.
Pinia state management: domain stores, getters and actions (including async error state), storeToRefs, persistence plugins, typed stores, $reset in setup stores and isolated tests.