300-frontend-team-code-standards

300-frontend-team-code-standards is a cursor rule for Cursor from HaiDong-Once/cursor-rules-collection. It costs 0 tokens per session (4,825 once invoked), scanned A, original, MIT.

A Chinese-language set of frontend coding standards covering naming, files, HTML, constants, and related practices for web applications.

In plain words
What is it for?
Use it when writing or reviewing JavaScript, Vue, React, and HTML code, especially naming components, avoiding unexplained numbers, and formatting files.
Why use it?
It gives a team shared rules for making frontend code more consistent and easier to understand.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

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/haidong-once/cursor-rules-collection/300-frontend-team-code-standards
Clone the repo
git clone --depth 1 https://github.com/HaiDong-Once/cursor-rules-collection

Made for: Cursor.

Wrote 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.

agentmods badge for 300-frontend-team-code-standards

README.md
[![agentmods](https://agentmods.dev/badge/rules/haidong-once/cursor-rules-collection/300-frontend-team-code-standards.svg)](https://agentmods.dev/rules/haidong-once/cursor-rules-collection/300-frontend-team-code-standards)
Your own site
<a href="https://agentmods.dev/rules/haidong-once/cursor-rules-collection/300-frontend-team-code-standards"><img src="https://agentmods.dev/badge/rules/haidong-once/cursor-rules-collection/300-frontend-team-code-standards.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 4,825 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.1 $0.00000 $0.04825
Opus 5 $0.00000 $0.02413
Sonnet 5 $0.00000 $0.00965
Haiku 4.5 $0.00000 $0.00483

Measured 6d ago against content hash 10ef1d88cf8a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

300-frontend-team-code-standards 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 6d 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.

frontend/300-frontend-team-code-standards.mdc · 681 lines

How it starts

The opening of the file, as written. The whole thing — 681 lines — stays where its author put it; the contents beside it link to each section on GitHub.

前端团队开发规范

本规范旨在提高代码质量和开发效率,建立统一的开发标准和实践。

❤️ 表示强制遵守的规范,其余为建议性规范。

1. 命名规范

变量命名 ❤️

  • 使用驼峰命名法:let userInfo = {}const orderId = 123
  • 尽量避免缩写:使用完整的描述性命名,let buttonSubmitbtnSub 更清晰
  • 布尔值应以 is, has, can, should 开头,如:isValid, hasError
  • 常量使用全大写下划线分隔命名(力求语义表达完整清楚,不嫌名字长):const API_ENDPOINT = "https://a"
  • 数组命名:名词+List, 名词+s, 如:userList

函数命名 ❤️

  • 使用动词短语或(动词 或者 动词+名词 形式):getUserInfo(), fetchData(), validateForm()
  • 常用动词参考文档底部「命名规范常用动词参考」

组件命名 ❤️

  • Vue 和 React 组件名使用大驼峰命名法:UserProfile, OrderList

文件命名 ❤️

  • 全部采用小写方式,以中划线分隔:user-profile.vueorder-list.js
  • 每个文件只包含一个组件或一个功能模块,避免混杂多个功能

命名严谨性(可读性)❤️

  • 代码中的命名严禁使用拼音与英文混合的方式,更不允许直接使用中文的方式(除特殊含义命名:如shuidi,jingdong)
  • 杜绝完全不规范的缩写,避免望文不知义

避免魔法数字

// 魔法数字
if (state === 1 || state === 2) {
  // ...
} else if (state === 3) {
  // ...
}

// 魔法数字改用常量映射
const UNPUBLISHED = 1;
const PUBLISHED = 2;
const DELETED = 3;

if (state === UNPUBLISHED || state === PUBLISHED) {
  // ...
} else if (state === DELETED) {
  // ...
}

2. HTML规范

基本规范

  • 缩进:缩进使用 2 个空格(一个 tab)
  • 分块注释:在每一个组件模块,加上一对 HTML 注释
  • 优先使用语义化标签:<header></header> <footer></footer>
  • 引号:统一使用双引号(" ") 而不是单引号(' ')

3. CSS规范

命名 ❤️

  • 使用有意义的类名,避免过于抽象的命名

选择器 ❤️

  • CSS 选择器中避免使用标签名
  • 使用直接子选择器
/* 不推荐 */
.content .title {
   font-size: 2rem;
}

/* 推荐 */
.content > .title {
   font-size: 2rem;
}

属性简写

  • 尽量使用缩写属性
/* 不推荐 */
border-top-style: none; 
font-family: palatino, georgia, serif; 
font-size: 100%; 
line-height: 1.6; 
padding-bottom: 2em; 
padding-left: 1em;
padding-right: 1em; 
padding-top: 0;

/* 推荐 */
border-top: 0; 
font: 100%/1.6 palatino, georgia, serif; 
padding: 0 1em 2em;
  • 省略 0 后面的单位
/* 不推荐 */
div {
   padding-bottom: 0px; 
   margin: 0em;
}

/* 推荐 */
div {
   padding-bottom: 0; 
   margin: 0; 
}
  • 尽量避免使用 ID 选择器及全局标签选择器防止污染全局样式

LESS 规范 ❤️

  • 将公共 less 文件放置在同一全局文件夹
  • 顺序组织
    1. @import
    2. 变量声明
    3. 样式声明
  • 避免嵌套层级过多

Read the full file on GitHub · 681 lines

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. 6d ago First seen · 681 lines · 0 tokens per session scan A 10ef1d88cf8a

Subscribe to this mod's changes

300-frontend-team-code-standards 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 4,825 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.