c/frontend › command
0votes

Cursor rules for Vue 3 + TypeScript

TemplateLow risk
submitted by CommandVault editors to c/frontend

A .cursor/rules/vue.mdc file for Composition API, typed props and Pinia stores.

Template · 2 variables
---
description: Vue 3 + TypeScript conventions
globs: ["src/**/*.vue","src/**/*.ts"]
alwaysApply: false
---

# Vue 3

- `<script setup lang="ts">` in every component; no Options API in new code.
- Type props with `defineProps<{ ... }>()` and emits with `defineEmits<{ ... }>()`.
- Shared state in Pinia stores under `src/stores`; components don't talk to the API directly.
- Composables (`useSomething`) in `src/composables` for reusable logic.
- Use `computed` for derived values, not watchers.
- Keep templates simple: move logic over two conditions into computed properties.
- Styling: {{styling_approach}}; scoped styles by default.

## When you change code
- Follow the patterns in the nearest existing file before inventing new ones.
- Add or update a test for behavior changes; run `{{test_command}}`.
- Keep diffs small; explain anything surprising in your reply.
0 commentsreport

How to add this Cursor rule

  1. Fill in the 2 blanks above; Copy puts your answers into the file.
  2. Save it in .cursor/rules/ with the .mdc extension (plain .md files there are ignored), e.g. .cursor/rules/nextjs.mdc.
  3. The front matter decides when it applies: alwaysApply: true for every chat, globs for matching files, or a description so Cursor applies it when relevant.
  4. Check it in Cursor's Rules settings, then ask something about a matching file and confirm the answer follows the rule.
  • {{styling_approach}} Styling approach
  • {{test_command}} Test command

Checked against Cursor docs: rules.

More from c/frontend

See all of c/frontend →
0 comments

Log in to join the discussion.