AGENTS

Repository rules for Ant Design, a React and TypeScript component library published as the npm package antd. They cover setup, supported environments, code style, naming, testing, and compatibility.

In plain words
What is it for?
Use them when developing components, hooks, tests, builds, documentation, or other changes in the antd source repository.
Why use it?
They give coding agents the project conventions needed to make changes that fit the library and avoid breaking supported React versions.

Cursor rule for Cursor

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/antdigital-ai/agentic-ui/agents
Clone the repo
git clone --depth 1 https://github.com/antdigital-ai/agentic-ui

Made for: Cursor.

Per session 3,867 This file is loaded in full into every session.
When invoked 3,867 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.03867 $0.03867
Opus 5 $0.01934 $0.01934
Sonnet 5 $0.00773 $0.00773
Haiku 4.5 $0.00387 $0.00387

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

Security

Grade A, and why

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

.cursor/rules/AGENTS.mdc · 451 lines

How it starts

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

AGENTS.md

项目背景

这是 ant-design/ant-design(antd)的源代码仓库,是一个 React 组件库,发布为 npm 包 antd。

  • 使用 TypeScript 和 React 开发
  • 兼容 React 16 ~ 19 版本
  • 组件库设计精美,功能完善,广泛应用于企业级中后台产品
  • 遵循 Ant Design 设计规范
  • 支持国际化

安装和设置

开发环境要求

  • Node.js 版本 >= 16
  • 推荐使用 npm 或 yarn 或 pnpm
  • Chrome 80+ 浏览器兼容性

安装依赖

npm install
# 或
yarn install
# 或
pnpm install

开发命令

pnpm start    # 启动开发服务器
pnpm run build # 构建项目
pnpm test     # 运行测试
pnpm run lint # 代码检查

代码风格指南

基本编码规范

  • 使用 TypeScript 和 React 书写
  • 使用函数式组件和 hooks,避免类组件
  • 使用提前返回(early returns)提高代码可读性
  • 避免引入新依赖,严控打包体积
  • 兼容 Chrome 80+ 浏览器
  • 支持服务端渲染
  • 保持向下兼容,避免 breaking change
  • 组件名使用大驼峰(PascalCase)
  • 属性名使用小驼峰(camelCase)
  • 合理使用 React.memo、useMemo 和 useCallback 优化性能

命名规范

Antd 命名要求使用完整名称而非缩写。

Props 命名
  • 初始化属性:default + PropName
  • 强制渲染:forceRender
  • 子组件强制渲染:force + Sub Component Name + Render
  • 子组件渲染:Sub Component Name + Render
  • 数据源:dataSource
  • 面板开启:使用 open,避免使用 visible
  • 显示相关:show + PropName
  • 功能性:PropName + able
  • 禁用:disabled
  • 额外内容:extra
  • 图标:icon
  • 触发器:trigger
  • 类名:className
事件命名
  • 触发事件:on + EventName
  • 子组件事件:on + SubComponentName + EventName
  • 前置事件:before + EventName
  • 后置事件:after + EventName
  • 连续动作完成:on + EventName + Complete
组件引用

组件应提供 ref 属性,结构如下:

ComponentRef {
  nativeElement: HTMLElement;
  focus: VoidFunction;
  // 其他函数
}
组件 Token 命名

格式:variant (optional) + semantic part + semantic part variant (optional) + css property + size/disabled (optional)

API 文档规范

Property Description Type Default
htmlType xxx string button
type xxx horizontal | vertical horizontal
disabled xxx boolean false
minLength xxx number 0
style xxx CSSProperties -

Read the full file on GitHub · 451 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. 2d ago First seen · 451 lines · 3,867 tokens per session scan A 91a55273b545

Subscribe to this mod's changes

AGENTS is a cursor rule published in the GitHub repository antdigital-ai/agentic-ui (224 stars, last pushed 20d ago), licensed MIT. It adds 3,867 tokens to every session, about $0.0193 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.