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/HaiDong-Once/cursor-rules-collectionWrote 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/haidong-once/cursor-rules-collection/303-javascript-guide)<a href="https://agentmods.dev/rules/haidong-once/cursor-rules-collection/303-javascript-guide"><img src="https://agentmods.dev/badge/rules/haidong-once/cursor-rules-collection/303-javascript-guide/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/haidong-once/cursor-rules-collection/303-javascript-guide"><img src="https://agentmods.dev/badge/rules/haidong-once/cursor-rules-collection/303-javascript-guide.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.03171 |
| Opus 5.5 | $0.00000 | $0.01268 |
| Sonnet 5.5 | $0.00000 | $0.00634 |
| Haiku 4.5 | $0.00000 | $0.00317 |
Grade A, and why
303-javascript-guide 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 — 529 lines — stays where its author put it; the contents beside it link to each section on GitHub.
JavaScript编码指南 (303)
规则概述
本规范定义了JavaScript的编码规范和最佳实践,旨在提高代码质量、可读性和可维护性。
基本规范
1.1 命名规范
- 变量命名:使用驼峰命名法(camelCase)
- 常量命名:使用全大写下划线分隔(UPPER_SNAKE_CASE)
- 函数命名:使用动词短语,驼峰命名法(如:
getUserInfo) - 组件命名:使用大驼峰命名法(PascalCase)
- 布尔值:以
is、has、can、should开头 - 数组命名:使用复数形式,如
users或userList
// 变量命名
let userName = 'Zhang San';
const MAX_COUNT = 100;
// 函数命名
function getUserProfile() { /*...*/ }
// 组件命名
class UserProfile extends Component { /*...*/ }
// 布尔值
const isActive = true;
const hasPermission = false;
// 数组
const userList = [];
const products = [];
1.2 代码格式
- 使用2个空格缩进
- 语句末尾使用分号
- 花括号起始位置与声明在同一行
- 单行代码长度不超过80-100个字符
- 使用空行分离代码逻辑块
// 推荐
function calculateTotal(items) {
let total = 0;
for (let i = 0; i < items.length; i++) {
total += items[i].price;
}
return total;
}
1.3 引号使用
- 统一使用单引号(
')而非双引号(") - 模板字符串使用反引号(
`)
// 推荐
const name = 'John Doe';
const greeting = `Hello, ${name}!`;
// 不推荐
const name = "John Doe";
ES6+特性使用
2.1 变量声明
- 使用
const和let代替var - 默认使用
const,只有在需要重新赋值时使用let - 避免使用
var(存在变量提升和作用域问题)
// 推荐
const PI = 3.14;
let count = 0;
count++;
// 不推荐
var PI = 3.14;
var count = 0;
2.2 箭头函数
- 优先使用箭头函数,特别是在回调函数中
- 简单的单行表达式无需花括号和return语句
- 多行表达式使用花括号和return语句
// 单行箭头函数
const double = x => x * 2;
// 多行箭头函数
const calculateArea = (width, height) => {
const area = width * height;
return area;
};
// 回调函数
items.map(item => item.value);
2.3 解构赋值
- 使用对象解构获取对象属性
- 函数参数过多时使用对象参数,解构获取
// 对象解构
const { name, age, address } = user;
// 函数参数解构
function getUserInfo({ name, age, address }) {
// 使用 name, age, address
}
getUserInfo({
name: '张三',
age: 30,
address: '北京'
});
2.4 展开运算符
- 使用展开运算符(
...)合并对象和数组
// 合并数组
const arr1 = [1, 2, 3];
const arr2 = [4, 5, 6];
const combined = [...arr1, ...arr2];
// 合并对象
const defaults = { theme: 'light', language: 'en' };
const userSettings = { theme: 'dark' };
const settings = { ...defaults, ...userSettings };
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 · 529 lines · 0 tokens per session scan A edabfcbaf22d
303-javascript-guide is a cursor rule published in the GitHub repository HaiDong-Once/cursor-rules-collection (24 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,171 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
ponytail
Ponytail, lazy senior dev mode. Always pick the simplest solution that works.
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.
prefer-assertions-over-defensive-checks
Prefer assertions over defensive checks when data is guaranteed to be valid.
prefer-direct-imports-over-module-mocks
Prefer extracting a testable core over vi.mock / vi.resetModules when unit tests need to reach production logic entangled with config, env, or singletons.
config-validation-and-normalization
Config validation and normalization responsibilities (defineConfig normalizes, the orm section schema validates and resolves paths, the loader reports per-section diagnostics).