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/aide-family/moon-webWrote 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/aide-family/moon-web/moon-web-pages-conventions)<a href="https://agentmods.dev/rules/aide-family/moon-web/moon-web-pages-conventions"><img src="https://agentmods.dev/badge/rules/aide-family/moon-web/moon-web-pages-conventions/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/aide-family/moon-web/moon-web-pages-conventions"><img src="https://agentmods.dev/badge/rules/aide-family/moon-web/moon-web-pages-conventions.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.01278 |
| Opus 5 | $0.00000 | $0.00639 |
| Sonnet 5 | $0.00000 | $0.00256 |
| Haiku 4.5 | $0.00000 | $0.00128 |
Grade A, and why
moon-web-pages-conventions 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 10d 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 — 94 lines — stays where its author put it; the contents beside it link to each section on GitHub.
React + TS + Ant Design v6 页面规范
1) 组件与数据流
- 页面组件使用函数式组件 + hooks;避免把副作用写在 render 中。
- 派生状态优先用
useMemo(例如过滤/排序后数据、列定义),避免每次 render 都重建大对象。 - 事件处理函数优先用
useCallback,并保证依赖项正确且完整。 - 页面业务请求只调用
src/api/**的封装;禁止在页面内直接使用底层http。
2) 数据获取与副作用(必做)
- 进行异步请求时,必须处理
loading(至少是页面级loading或局部actionLoading)。 - 需要在卸载后避免 setState:使用
mountedRef/取消逻辑(与当前项目一致的写法优先)。 try/catch/finally必须闭环:成功给用户反馈,失败记录并给出降级 UI(例如空表/空状态)。- 不要在异常里吞掉错误;至少
console.error(或项目约定的 logger)。
示例(结构要求,非强制实现):
setLoading(true)
try {
const res = await apiCall()
setData(res.items ?? [])
} catch (e) {
console.error('xxx失败', e)
setData([])
} finally {
setLoading(false)
}
3) i18n(必做)
- 所有 UI 文案必须走 i18n:使用
const { t } = useLocale()+t('xxx')。 message/Modal/Table/placeholder/Tooltip/Button的文本都必须来自t(...)。- 规则:页面里不允许出现业务文案的硬编码(表格列名、弹窗标题、按钮文本、空状态文案等)。
4) Ant Design v6 用法(必做)
Table
Table必须设置rowKey,且rowKey应为业务稳定字段(如uid)。- 分页/滚动使用受控 props:
pagination.current/pageSize/total与onChange联动。 - 列渲染函数使用类型约束(
ColumnsType<T>),渲染内避免出现未处理的undefined(使用emptyPlaceholder或兜底'-')。
Modal
- 使用
open(v6)而非visible。 onCancel必须回收/重置本地 state(关闭弹窗时把 record 清空、把输入值清空)。footer:- 详情弹窗优先
footer={null}并只读展示 - 有确认逻辑的弹窗使用
onOk+confirmLoading
- 详情弹窗优先
Form
- 表单使用
Form.useForm()管理实例,校验通过用form.validateFields()。 - 处理
validateFields的异常:仅当是errorFields(校验失败)时直接 return;其它异常要记录并提示。
Dropdown
Dropdown使用menu={{ items: ... }}(v6),并避免在 render 中创建会变化但不必要的 handler(可在上层 memo/回调中稳定)。- 删除/危险操作前使用
MENU_DIVIDER(@/utils/menu)与常规菜单项分隔。
代码格式
- 使用项目根目录
prettier.config.js(单引号、无分号、trailingComma: all等);提交前执行pnpm format或依赖编辑器保存时格式化。 - ESLint 与 Prettier 分工:样式由 Prettier 处理,逻辑由 ESLint;勿在 ESLint 中重复配置与 Prettier 冲突的规则。
5) 编辑器悬停文档(JSDoc)
- TypeScript / Cursor 悬停提示只识别
/** JSDoc */,普通//行注释不会出现在悬停里。 - 需要悬停展示说明的函数、变量、接口字段、类型,请写在紧邻声明上方的 JSDoc 中。
- 第三方库(如 antd)的类型说明来自
node_modules中的.d.ts,需保证工作区使用项目内 TypeScript(见.vscode/settings.json中typescript.tsdk)。
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.
- 10d ago First seen · 94 lines · 0 tokens per session scan A 578a527450db
moon-web-pages-conventions is a cursor rule published in the GitHub repository aide-family/moon-web (12 stars, last pushed 2mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,278 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
ai-agent-specialist
Cursor rules for TypeScript, React, Node.js, clean architecture, testing, and WHY-oriented engineering guidance.
react-typescript
Rules for writing frontend code at PostHog (mostly React + Typescript with Kea).
react-typescript
Rules for writing frontend code at PostHog (mostly React + Typescript with Kea).
05-web-development
Use the following format for code blocks.
react-chakra-ui---typescript-usage
Guidance for using TypeScript with Chakra UI components in React. It covers typed component props, custom themes, editor support, and avoiding the unsafe any type.
frontend-patterns
React/TypeScript patterns for src/ code.