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.
git clone --depth 1 https://github.com/wangqiqi/cursor-ai-rulesWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/wangqiqi/cursor-ai-rules/javascript)<a href="https://agentmods.dev/rules/wangqiqi/cursor-ai-rules/javascript"><img src="https://agentmods.dev/badge/rules/wangqiqi/cursor-ai-rules/javascript/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/rules/wangqiqi/cursor-ai-rules/javascript"><img src="https://agentmods.dev/badge/rules/wangqiqi/cursor-ai-rules/javascript.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.02824 |
| Opus 5.5 | $0.00000 | $0.01130 |
| Sonnet 5.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 1mo 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.
- 1mo 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 (17 stars, last pushed 4mo 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
python
Python best practices and patterns for modern software development with Flask and SQLite.
django
Definitive guidelines for writing maintainable, performant, and secure Django applications, emphasizing modern best practices, clear code organization, and efficient patterns.
rich
Definitive guidelines for building robust, maintainable, and visually appealing Python CLI applications using the rich library.
20-testing-generated-and-structure
Testing expectations, generated-file boundaries, and CLI structure contract.
shared-libraries
Shared libraries - condition framework, inventory containers, file-backed DB, itinerary, references.
table-of-contents-standard
Standard section ordering and TOC format for Verus source files.