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/movebrickschi/harness-engineering-mcp/13-code-logging-standardsgit clone --depth 1 https://github.com/movebrickschi/harness-engineering-mcpWhat 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.00999 | $0.00999 |
| Opus 5 | $0.00500 | $0.00500 |
| Sonnet 5 | $0.00200 | $0.00200 |
| Haiku 4.5 | $0.00100 | $0.00100 |
Grade A, and why
13-code-logging-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 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 — 118 lines — stays where its author put it; the contents beside it link to each section on GitHub.
中文注释 + 代码执行日志规范
一、中文注释要求
每个类、公开方法、字段都必须有中文说明(详见 05-chinese-comments 规则),以下是补充强调:
- 关键
if/else分支必须有一句中文说明其判断意图 - 非显而易见的常量、魔法数字必须注释说明含义
- 不要写只是重复代码语义的废注释(如
// 调用 insert 方法)
二、日志框架使用
统一使用 @Slf4j(Lombok),禁止直接使用 System.out.println。
// ✅ 正确
@Slf4j
@Service
public class OrderService {
public void createOrder(...) {
log.info("[订单服务] 创建订单,userId={}, amount={}", userId, amount);
}
}
// ❌ 禁止
System.out.println("创建订单: " + userId);
三、日志级别选择
| 级别 | 使用场景 |
|---|---|
log.info |
写操作入口(新增/更新/删除)、关键业务节点(登录、支付、状态变更)、操作结果 |
log.debug |
读操作入口、中间过程、循环内部、查询结果 |
log.warn |
业务校验失败、数据异常、可降级的外部调用失败 |
log.error |
系统异常、需要立即处理的错误,必须附带异常对象 log.error("...", e) |
四、各层日志埋点规范
Controller 层
// 写操作:方法入口用 info,完成用 info
@PostMapping
public R<SysUser> createUser(@RequestBody SysUser user) {
log.info("[用户控制器] 新增用户,username={}", user.getUsername());
// ... 业务逻辑 ...
log.info("[用户控制器] 用户新增成功,userId={}", user.getId());
return R.ok(user);
}
// 读操作:方法入口用 debug,完成用 debug
@GetMapping("/list")
public R<IPage<SysUser>> list(...) {
log.debug("[用户控制器] 查询用户列表,page={}, size={}", page, size);
// ...
log.debug("[用户控制器] 用户列表查询完成,总数={}", result.getTotal());
return R.ok(result);
}
Service 层
// 复杂业务流程中的关键步骤各打一条日志
@Transactional
public void assignRoleMenus(Long roleId, List<Long> menuIds) {
log.info("[菜单服务] 为角色分配菜单,roleId={}, 菜单数量={}", roleId, menuIds != null ? menuIds.size() : 0);
// 清空旧关联
sysRoleMenuMapper.delete(...);
log.debug("[菜单服务] 已清空角色原有菜单关联,roleId={}", roleId);
// 插入新关联
if (menuIds != null && !menuIds.isEmpty()) {
records.forEach(sysRoleMenuMapper::insert);
log.info("[菜单服务] 角色菜单分配完成,roleId={}, 分配数量={}", roleId, menuIds.size());
}
}
异常处理
// ✅ 业务校验失败用 warn,系统异常用 error
if (existing == null) {
log.warn("[用户服务] 用户不存在,userId={}", userId);
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "用户不存在");
}
try {
externalApi.call();
} catch (Exception e) {
log.error("[支付服务] 调用支付网关失败,orderId={}", orderId, e);
throw new PaymentException("支付失败", e);
}
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 · 118 lines · 999 tokens per session scan A da7b25e20e11
13-code-logging-standards is a cursor rule published in the GitHub repository movebrickschi/harness-engineering-mcp (2 stars, last pushed 3mo ago), licensed MIT. It adds 999 tokens to every session, about $0.0050 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.
Other cursor rules, from other repositories
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.
cli-error-handling
CLI command error handling patterns.
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.
control-plane-descriptors
Control plane descriptor and instance implementation patterns.
family-instance-domain-actions
Family instance domain action implementation patterns.