vuejs

A set of coding rules for Vue.js, a JavaScript framework for building web interfaces, including its component structure, state handling, routing, forms, and TypeScript use.

In plain words
What is it for?
Use it when creating or reviewing Vue files to guide Composition API usage, Pinia stores, props and events, reusable composables, routing, form validation, testing, and Vite builds.
Why use it?
It gives Vue components a consistent structure and helps avoid common problems with shared state, reactivity, performance, and asynchronous operations.

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/vuejs
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 638 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.00638
Opus 5 $0.00000 $0.00319
Sonnet 5 $0.00000 $0.00128
Haiku 4.5 $0.00000 $0.00064

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

Security

Grade A, and why

vuejs 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/frameworks/vuejs.mdc · 93 lines

What it actually says


description: Vue.js 编码规则和最佳实践 globs: **/*.vue alwaysApply: false

Vue.js 规则

组件结构

  • 使用组合式 API 而非选项式 API
  • 保持组件小巧且专注
  • 正确集成 TypeScript
  • 实现适当的 props 验证
  • 使用正确的 emit 声明
  • 保持模板逻辑简洁

组合式 API

  • 正确使用 ref 和 reactive
  • 实现适当的生命周期钩子
  • 使用 composables 实现可复用逻辑
  • 保持 setup 函数整洁
  • 正确使用计算属性
  • 实现适当的侦听器

状态管理

  • 使用 Pinia 进行状态管理
  • 保持 stores 模块化
  • 使用适当的状态组合
  • 实现适当的 actions
  • 正确使用 getters
  • 适当处理异步状态

性能

  • 正确使用组件懒加载
  • 实现适当的缓存
  • 正确使用计算属性
  • 避免不必要的侦听器
  • 正确使用 v-show 与 v-if
  • 实现适当的 key 管理

路由

  • 正确使用 Vue Router
  • 实现适当的导航守卫
  • 正确使用路由元字段
  • 适当处理路由参数
  • 实现适当的懒加载
  • 使用适当的导航方法

表单

  • 正确使用 v-model
  • 实现适当的验证
  • 适当处理表单提交
  • 显示适当的加载状态
  • 使用适当的错误处理
  • 实现适当的表单重置

TypeScript 集成

  • 使用适当的组件类型定义
  • 实现适当的 prop 类型
  • 使用适当的 emit 声明
  • 处理适当的类型推断
  • 使用适当的 composable 类型
  • 实现适当的 store 类型

测试

  • 编写适当的单元测试
  • 实现适当的组件测试
  • 正确使用 Vue Test Utils
  • 适当测试 composables
  • 实现适当的模拟
  • 测试异步操作

最佳实践

  • 遵循 Vue 风格指南
  • 使用适当的命名约定
  • 保持组件组织有序
  • 实现适当的错误处理
  • 使用适当的事件处理
  • 为复杂逻辑编写文档

构建和工具

  • 使用 Vite 进行开发
  • 配置适当的构建设置
  • 正确使用环境变量
  • 实现适当的代码分割
  • 使用适当的资源处理
  • 配置适当的优化
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 · 93 lines · 0 tokens per session scan A c6db4648862f

Subscribe to this mod's changes

vuejs 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 638 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.