vue

A set of coding rules for Vue 3 applications. Vue is a JavaScript framework for building user interfaces, and these rules focus on its Composition API, components, reactive data, and Pinia state management.

In plain words
What is it for?
Use it when creating or reviewing Vue components, managing reactive state, defining typed properties and events, and organizing `<script setup>`, templates, and styles.
Why use it?
It gives Vue code a consistent structure and helps avoid common mistakes with changing data, derived values, component inputs, and events.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/nedcodes-ok/cursorrules-collection/vue
Clone the repo
git clone --depth 1 https://github.com/nedcodes-ok/cursorrules-collection
Per session 866 This file is loaded in full into every session.
When invoked 866 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00866 $0.00866
Opus 5 $0.00433 $0.00433
Sonnet 5 $0.00173 $0.00173
Haiku 4.5 $0.00087 $0.00087

Measured 2d ago against content hash 7052ccca3d7b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

vue scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

  • vue — 100% identical, 0 lines differ
rules-mdc/frameworks/vue.mdc · 52 lines

How it starts

The opening of the file, as written. The whole thing — 52 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Vue Cursor Rules

You are an expert Vue 3 developer (v3.4+). Follow these rules:

Composition API

  • Use <script setup> for all components — it's the default, compiles away boilerplate, and auto-exposes everything to template
  • ref() for primitives and values you reassign. reactive() for objects you mutate in place. Don't destructure a reactive() object — you lose reactivity. Use toRefs() if you must destructure
  • computed() for derived state — it caches until dependencies change. Don't use methods in templates for derived values, they re-run every render
  • watchEffect() for side effects that auto-track dependencies. watch() when you need the old value, explicit deps, or lazy execution
  • shallowRef() for large objects where you replace the whole value instead of mutating nested properties — avoids deep reactivity overhead

Components

  • SFC block order: <script setup><template><style scoped>
  • PascalCase for component names in script, kebab-case or PascalCase in templates (both work, pick one per project and stick to it)
  • defineProps with TypeScript interface for type safety. defineEmits with typed event signatures
  • Never mutate props — emit events to parent. Vue warns in dev but silently fails in prod
  • defineModel() (v3.4+) for two-way binding — replaces the modelValue + update:modelValue boilerplate
  • Use defineExpose() only when a parent genuinely needs to call a child method — don't expose by default

Composables

  • Extract reusable stateful logic into use* composables (useAuth, useDebounce, useFetch)
  • Always return refs, not raw values — callers need to maintain reactivity
  • Handle cleanup in onUnmounted or return a cleanup function for manual teardown
  • One concern per composable. useUser() that also manages notifications is doing too much
  • Composables must be called at the top level of setup — not inside conditionals or callbacks (same rule as React hooks, same reason)

State (Pinia)

  • Use setup syntax stores (defineStore('id', () => { ... })) for full Composition API — options syntax exists but limits composable reuse
  • Actions for async operations and mutations, getters for derived/computed state
  • Local component state is fine for UI-only concerns (isOpen, isHovered) — not everything belongs in a store
  • storeToRefs() when destructuring store state — plain destructuring loses reactivity
  • Stores are singletons — don't create store instances per component, that defeats the purpose

Read the full file on GitHub · 52 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 52 lines · 866 tokens per session scan A 7052ccca3d7b

Subscribe to this mod's changes

vue is a cursor rule published in the GitHub repository nedcodes-ok/cursorrules-collection (37 stars, last pushed 6mo ago), licensed MIT. It adds 866 tokens to every session, about $0.0043 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.