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.
npx agentmods add rules/wangqiqi/cursor-ai-rules/javascriptgit clone --depth 1 https://github.com/wangqiqi/cursor-ai-rulesWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.02824 |
| Opus 5 | $0.00000 | $0.01412 |
| Sonnet 5 | $0.00000 | $0.00565 |
| Haiku 4.5 | $0.00000 | $0.00282 |
Grade A, and why
javascript 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.
How it starts
The opening of the file, as written. The whole thing — 389 lines — stays where its author put it; the contents beside it link to each section on GitHub.
📜 JavaScript 开发规则
版本: v4.3.0 | 最后更新: 2026-01-22 | 作者: Cursor AI Rules
🎯 适用场景
- Node.js 后端开发
- 浏览器前端开发
- 服务端 JavaScript 应用
- 命令行工具和脚本
- 跨平台桌面应用
- 嵌入式 JavaScript 运行时
🏗️ 架构原则
模块化设计
- ES6 模块: 优先使用
import/export - CommonJS: Node.js 环境下的模块系统
- 清晰的模块边界: 每个模块职责单一
- 依赖注入: 避免硬编码依赖关系
代码组织
- 关注点分离: 业务逻辑、数据访问、表示层分离
- 单一职责: 每个函数、类、模块只做一件事
- 开闭原则: 对扩展开放,对修改关闭
📝 编码规范
命名约定
// ✅ 推荐 - 变量和函数
const userName = 'john_doe'
const isUserActive = true
let currentUser = null
function getUserById(userId) {
// 函数体
}
function calculateTotalPrice(items) {
// 函数体
}
// ✅ 推荐 - 常量
const MAX_RETRY_COUNT = 3
const API_BASE_URL = 'https://api.example.com'
const DEFAULT_TIMEOUT = 5000
// ✅ 推荐 - 类和构造函数
class UserManager {
constructor() {
this.users = []
}
addUser(user) {
this.users.push(user)
}
findUserById(id) {
return this.users.find(user => user.id === id)
}
}
// ❌ 避免 - 不一致的命名
const user_name = 'john' // 使用 camelCase
const is_user_active = true // 使用 camelCase
let CurrentUser = null // 使用 camelCase
函数设计
- 单一职责: 每个函数只做一件事
- 参数限制: 最多3-4个参数,考虑使用对象参数
- 纯函数优先: 无副作用的函数更容易测试和推理
// ✅ 好的函数设计
function calculateUserScore(activities) {
return activities
.filter(activity => activity.completed)
.reduce((score, activity) => score + activity.points, 0)
}
// ✅ 参数对象化
function createUser({ name, email, age, role = 'user' }) {
return {
id: generateId(),
name,
email,
age,
role,
createdAt: new Date()
}
}
// ❌ 避免的函数设计
function processUserData(user, options = {}) {
// 参数太多且类型不明确
if (options.validate) {
// 验证逻辑
}
if (options.save) {
// 保存逻辑
}
if (options.notify) {
// 通知逻辑
}
// 做了太多事情
}
🔧 工具链配置
ESLint 配置
{
"env": {
"browser": true,
"node": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"prettier"
],
"rules": {
"no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
"no-console": "warn",
"prefer-const": "error",
"no-var": "error"
},
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
}
}
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.
- 2d ago First seen · 389 lines · 0 tokens per session scan A da1ff4611c32
javascript is a cursor rule published in the GitHub repository wangqiqi/cursor-ai-rules (15 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,824 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-30.
Other cursor rules, from other repositories
cypress-e2e-testing-cursorrules-prompt-file
Cursor rules for Cypress development with E2E testing.
vasu-playwright-utils
../../templates/cursor-rules/vasu-playwright-utils.mdc.
vla-registry
Multi-model GUI/VL registry — browser wllama grounding (ShowUI-2B is default + E2E gate).
dev-browser
Fallback browser automation with persistent Chrome state. Use only when Browser Use is unavailable or blocked.
node-dependencies
Enforce Node.js versioning and package management best practices.
security-standards
Cursor rule "security-standards" from wjgogogo/cursor-rules, covering 安全规范, 核心原则 [p0], 输入验证, xss 防护 and csrf 防护.