CODING_RULES

A coding-rules file for DemoApp that defines naming, formatting, exception-handling, resource-cleanup, and file-header conventions. It is written for Delphi-style code, where objects may need explicit cleanup with Free.

In plain words
What is it for?
Use it when writing or reviewing DemoApp code, especially to check names, indentation, try/finally blocks, exception types, object cleanup, constants, and function length.
Why use it?
It gives an agent and developers a shared checklist for consistent code and for avoiding common resource and error-handling mistakes.

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/chinawsb/daofy/coding_rules
Clone the repo
git clone --depth 1 https://github.com/chinawsb/daofy
Per session 277 This file is loaded in full into every session.
When invoked 277 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.00277 $0.00277
Opus 5 $0.00138 $0.00138
Sonnet 5 $0.00055 $0.00055
Haiku 4.5 $0.00028 $0.00028

Measured yesterday against content hash e22abd171621, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

CODING_RULES 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 yesterday.

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.

docs/tutorial/demo-project/CODING_RULES.mdc · 29 lines

What it actually says

DemoApp 编码规范

命名规则

  • 类型名: T + 大驼峰(如 TJsonConfigManager)
  • 方法名: 大驼峰(如 LoadConfig、GetValue)
  • 变量名: L + 大驼峰(局部)、F + 大驼峰(字段)
  • 参数名: A + 大驼峰
  • 常量名: 全大写 + 下划线(如 DEFAULT_PORT)
  • 接口名: I + 大驼峰

格式规则

  • 缩进: 2 空格
  • begin/end 另起一行
  • uses 子句按字母序排列,系统单元在前、自定义单元在后

异常处理

  • 必须使用 try/finally 保护资源
  • catch 使用具体异常类型,不使用 except(Exception): 兜底
  • 自定义异常继承 Exception

文件头

每个单元文件头部包含单元用途的简短注释。

审核要求

  • 检查所有对象创建是否有对应的 Free
  • 检查 try/finally 是否配对
  • 检查魔法数值是否定义为常量
  • 检查函数长度(不超过 80 行)
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. yesterday First seen · 29 lines · 277 tokens per session scan A e22abd171621

Subscribe to this mod's changes

CODING_RULES is a cursor rule published in the GitHub repository chinawsb/daofy (101 stars, last pushed 3d ago), licensed MIT. It adds 277 tokens to every session, about $0.0014 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-30.