05-chinese-comments

05-chinese-comments is a cursor rule for coding agents from movebrickschi/harness-engineering-mcp. It costs 620 tokens per session, scanned A, original, MIT.

Rules requiring Chinese comments in code, including documentation for classes, methods, fields, and complex logic.

In plain words
What is it for?
Use it when writing or reviewing Java code that must include Chinese documentation for APIs, data fields, business logic, and error behavior.
Why use it?
They make code documentation consistent for teams that read Chinese and ensure important responsibilities, parameters, return values, and exceptions are recorded.

Cursor rule

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/movebrickschi/harness-engineering-mcp/05-chinese-comments
Clone the repo
git clone --depth 1 https://github.com/movebrickschi/harness-engineering-mcp

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 05-chinese-comments

README.md
[![agentmods](https://agentmods.dev/badge/rules/movebrickschi/harness-engineering-mcp/05-chinese-comments.svg)](https://agentmods.dev/rules/movebrickschi/harness-engineering-mcp/05-chinese-comments)
Your own site
<a href="https://agentmods.dev/rules/movebrickschi/harness-engineering-mcp/05-chinese-comments"><img src="https://agentmods.dev/badge/rules/movebrickschi/harness-engineering-mcp/05-chinese-comments.svg" alt="Measured on agentmods" height="20"></a>
Per session 620 This file is loaded in full into every session.
When invoked 620 The same file — it is already loaded in full.
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.00620 $0.00620
Opus 5 $0.00310 $0.00310
Sonnet 5 $0.00124 $0.00124
Haiku 4.5 $0.00062 $0.00062

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

Security

Grade A, and why

05-chinese-comments 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 4d 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.

assets/rules/05-chinese-comments.mdc · 100 lines

What it actually says

中文注释编码规范

所有代码文件必须添加中文注释,确保代码可读性和可维护性。

类 / 接口注释

每个类和接口必须有中文 Javadoc,说明职责和用途。

// ✅ 正确
/**
 * 用户管理控制器
 * 提供用户注册、登录、信息查询等接口
 */
@RestController
@RequestMapping("/v1/user")
public class UserController { }

// ❌ 缺少类注释
@RestController
@RequestMapping("/v1/user")
public class UserController { }

方法注释

每个公开方法必须有中文 Javadoc,包含功能说明、参数、返回值和异常描述。

// ✅ 正确
/**
 * 根据用户ID查询用户详情
 *
 * @param userId 用户ID
 * @return 用户详情信息
 * @throws NotFoundException 用户不存在时抛出
 */
public UserVO getUserById(Long userId) { }

// ❌ 缺少方法注释
public UserVO getUserById(Long userId) { }

字段注释

Entity、DTO、VO 的字段必须添加中文注释说明含义。

// ✅ 正确
public class UserEntity {
    /** 用户昵称 */
    private String nickname;

    /** 账号状态:0-禁用 1-启用 */
    private Integer status;
}

// ❌ 缺少字段注释
public class UserEntity {
    private String nickname;
    private Integer status;
}

关键逻辑注释

复杂业务逻辑、条件分支、算法步骤必须添加中文行内注释。

// ✅ 正确
public void processOrder(Order order) {
    // 校验库存是否充足
    if (inventory.getStock() < order.getQuantity()) {
        throw new BusinessException("库存不足");
    }
    // 计算折扣后的实际支付金额
    BigDecimal finalPrice = calculateDiscount(order);
    // 扣减库存并生成支付记录
    deductStock(order);
    createPaymentRecord(order, finalPrice);
}

不需要注释的场景

  • Lombok 自动生成的 getter/setter
  • 含义显而易见的简单赋值(如 this.name = name
  • 已有 Swagger 注解充分描述的 DTO 字段(@ApiPropertydescription 已说明含义时,可省略重复的字段注释)

配置与 SQL 文件

  • application.yaml:非显而易见的配置项添加行内中文注释
  • SQL 脚本:表和字段必须有 COMMENT 说明(参照 04-table-common-fields 规范)
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. 4d ago First seen · 100 lines · 620 tokens per session scan A 71caed869c8c

Subscribe to this mod's changes

05-chinese-comments is a cursor rule published in the GitHub repository movebrickschi/harness-engineering-mcp (2 stars, last pushed 3mo ago), licensed MIT. It adds 620 tokens to every session, about $0.0031 per session on Opus 5. 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.