vue

A set of Vue development rules for component names, component structure, properties, events, styles, performance, state, and routes. Vue is a framework for building web interfaces from reusable components.

In plain words
What is it for?
Use it when creating or reviewing Vue single-file components, props, events, scoped styles, Pinia stores, routes, lists, and loading behavior.
Why use it?
It gives a project consistent conventions for building and maintaining Vue components. The rules reduce common mistakes around naming, defaults, events, rendering, and shared state.

Cursor rule for Cursor

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/wangtingyeye/llm-agent-study/vue
Clone the repo
git clone --depth 1 https://github.com/WangTingYeYe/llm-agent-study

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 587 The whole file, excluding the scripts and references it only reads on demand.
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.00000 $0.00587
Opus 5 $0.00000 $0.00293
Sonnet 5 $0.00000 $0.00117
Haiku 4.5 $0.00000 $0.00059

Measured 2d ago against content hash d253bf569ba7, 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.

.cursor/rules/backup/vue/vue.mdc · 68 lines

What it actually says

Vue 开发规范

组件命名

  • 组件名应该始终使用多词组合,避免与HTML元素冲突
  • 使用PascalCase命名组件:TodoItem.vueUserProfile.vue
  • 基础组件应使用特定前缀,如BaseAppV
  • 组件名应该是描述性的,不要过于简略

组件结构

  • 使用<script setup>语法糖
  • 使用组合式API (Composition API)
  • 组件选项/属性顺序:
    1. name
    2. components
    3. props
    4. emits
    5. setup()
    6. data()
    7. computed
    8. methods
    9. 生命周期钩子
  • 使用单文件组件(SFC)格式

Props 规范

  • Prop名使用camelCase
  • Prop需要定义类型和默认值
  • 避免使用数组或对象的默认值,应该使用工厂函数返回默认值
  • Prop应该尽可能详细地定义,包括类型、是否必须和验证函数

事件命名

  • 事件名应使用kebab-case,如item-clickmenu-select
  • 自定义事件应该有明确的含义,表示发生了什么
  • 避免使用容易混淆的事件名称

样式指南

  • 优先使用scoped CSS
  • 避免使用!important
  • 组件特定样式应该有特定的前缀
  • 考虑使用CSS变量实现主题

性能优化

  • 使用v-show代替v-if进行频繁切换
  • 长列表使用虚拟滚动
  • 避免在计算属性中进行复杂操作
  • 使用keep-alive缓存组件
  • 合理使用异步组件和懒加载

状态管理

  • 使用Pinia进行状态管理
  • store应该按功能模块划分
  • 保持store简单,避免过度设计

路由

  • 路由名称应当与组件名称匹配
  • 使用懒加载减少初始加载时间
  • 路由守卫应当简洁,避免复杂逻辑

通用建议

  • 避免使用this.$parentthis.$refs直接操作DOM
  • 优先使用计算属性而不是复杂的模板表达式
  • 使用v-for时必须提供key
  • 不要在同一元素上同时使用v-if和v-for
  • 复用组件时使用key确保完全重新渲染
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 · 68 lines · 587 tokens per session scan A d253bf569ba7

Subscribe to this mod's changes

vue is a cursor rule published in the GitHub repository WangTingYeYe/llm-agent-study (4 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 587 tokens. 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-31.