

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
1# Ant Design Repository Copilot Instructions23This is the Ant Design (antd) repository - a React component library with enterprise-class UI design language, widely used for building professional web applications.45> For deeper, project-wide conventions (demo/test import rules, documentation format, changelog rules, PR templates, etc.), see [`AGENTS.md`](../AGENTS.md) at the repository root. This file is a concise, suggestion-time reference designed to keep AI tools from hallucinating non-existent components or APIs.67## Project Context89- **Framework**: TypeScript + React (compatible with React 16-19)10- **Package**: Published as npm package `antd`11- **Purpose**: Enterprise-class UI components for React applications12- **Design System**: Follows Ant Design specifications13- **Internationalization**: Full i18n support1415## Authoritative Component List1617The following are the **only** top-level exports of `antd`. Do **not** invent components outside this list (e.g. `antd` does not export `Container`, `Stack`, `Heading`, `Box`, `Sidebar`, `Navbar`, `IconButton`, etc.).1819`Affix`, `Alert`, `Anchor`, `App`, `AutoComplete`, `Avatar`, `BackTop` (deprecated — use `FloatButton.BackTop`), `Badge`, `BorderBeam`, `Breadcrumb`, `Button`, `Calendar`, `Card`, `Carousel`, `Cascader`, `Checkbox`, `Col`, `Collapse`, `ColorPicker`, `ConfigProvider`, `DatePicker`, `Descriptions`, `Divider`, `Drawer`, `Dropdown`, `Empty`, `Flex`, `FloatButton`, `Form`, `Grid`, `Image`, `Input`, `InputNumber`, `Layout`, `List`, `Masonry`, `Mentions`, `Menu`, `Modal`, `Pagination`, `Popconfirm`, `Popover`, `Progress`, `QRCode`, `Radio`, `Rate`, `Result`, `Row`, `Segmented`, `Select`, `Skeleton`, `Slider`, `Space`, `Spin`, `Splitter`, `Statistic`, `Steps`, `Switch`, `Table`, `Tabs`, `Tag`, `TimePicker`, `Timeline`, `Tooltip`, `Tour`, `Transfer`, `Tree`, `TreeSelect`, `Typography`, `Upload`, `Watermark`.2021Function exports (lowercase): `message`, `notification`, `theme`, `version`, `unstableSetRender`.2223When in doubt, verify against `components/index.ts` (the source of truth for public exports). Icons live in a **separate** package: `@ant-design/icons` — never import icons from `antd`.2425## Import Patterns2627```tsx28// Components and types2930// Icons live in a separate package31import { SearchOutlined } from '@ant-design/icons';32import { Button, Form, Input, type FormProps } from 'antd';33// Locales live under antd/locale (not from the main entry)34import enUS from 'antd/locale/en_US';35// DatePicker / TimePicker / Calendar require a date library wrapper.36// The default uses dayjs — moment is no longer the default since v5.37import dayjs from 'dayjs';38```3940## API Migration Notes (Do Not Hallucinate the Old Names)4142The current major version uses these renames. Use the **new** API in suggestions:4344| Component | Deprecated (do not suggest) | Use instead |45| --- | --- | --- |46| Modal, Drawer, Dropdown, Tooltip, Popover, Popconfirm, Cascader, Select, AutoComplete, TreeSelect, etc. | `visible`, `onVisibleChange` | `open`, `onOpenChange` |47| Modal, Drawer, Tabs, etc. | `destroyOnClose` | `destroyOnHidden` |48| Tabs | `<Tabs><Tabs.TabPane /></Tabs>` (children API) | `<Tabs items={[{ key, label, children }]} />` |49| Menu | `<Menu><Menu.Item /></Menu>` (children API) | `<Menu items={[{ key, label }]} />` |50| Breadcrumb | `routes`, `<Breadcrumb.Item />` (children API) | `items={[{ title }]}` |51| Anchor | children-based `<Anchor.Link />` | `items={[{ key, href, title }]}` |52| AutoComplete, Cascader, Select | `dropdownClassName`, `dropdownStyle`, `dropdownRender`, `dropdownMatchSelectWidth` | `classNames.popup.root`, `styles.popup.root`, `popupRender`, `popupMatchSelectWidth` |53| AutoComplete, Cascader | `onDropdownVisibleChange` | `onOpenChange` |54| Card | `bordered` | `variant` |55| Avatar.Group | `maxCount`, `maxStyle`, `maxPopoverPlacement` | `max={{ count, style, popover }}` |56| BackTop | top-level `BackTop` | `FloatButton.BackTop` |57| Calendar | `dateCellRender`, `dateFullCellRender` | `cellRender`, `fullCellRender` |5859Internally these are flagged via `warning.deprecated(...)` and `@deprecated` JSDoc tags; check the component's `interface.ts` / `index.tsx` if unsure.6061## Code Standards & Best Practices6263### TypeScript Requirements6465- Always use TypeScript with strict type checking66- Never use `any` type - define precise types instead67- Use interfaces (not type aliases) for object structures68- Export all public interface types69- Component props interfaces should be named `ComponentNameProps`70- Component ref types should use `React.ForwardRefRenderFunction`71- Prefer union types over enums, use `as const` for constants7273### React Component Guidelines7475- Use functional components with hooks exclusively (no class components)76- Use early returns to improve readability77- Apply performance optimizations with React.memo, useMemo, useCallback appropriately78- Support server-side rendering79- Maintain backward compatibility - avoid breaking changes80- Components must support ref forwarding with this structure:81```tsx82 ComponentRef {83 nativeElement: HTMLElement;84 focus: VoidFunction;85 // other methods86 }87```8889### Naming Conventions9091- **Components**: PascalCase (e.g., `Button`, `DatePicker`)92- **Props**: camelCase with specific patterns:93 - Default values: `default` + `PropName` (e.g., `defaultValue`)94 - Force rendering: `forceRender`95 - Panel state: use `open` instead of `visible`96 - Display toggles: `show` + `PropName`97 - Capabilities: `PropName` + `able`98 - Data source: `dataSource`99 - Disabled state: `disabled`100 - Additional content: `extra`101 - Icons: `icon`102 - Triggers: `trigger`103 - CSS classes: `className`104- **Events**: `on` + `EventName` (e.g., `onClick`, `onChange`)105- **Sub-component events**: `on` + `SubComponentName` + `EventName`106- Use complete names, never abbreviations107108### Styling Approach109110- Use `@ant-design/cssinjs` for all styling111- Place component styles in `style/` directory112- Generate styles with functions named `gen[ComponentName]Style`113- Use design tokens from the Ant Design token system (read tokens via the `theme.useToken()` hook, or `token` argument inside style functions) — never hardcode colors, sizes, or spacing values114- Support both light and dark themes115- Use CSS logical properties for RTL support (e.g., `margin-inline-start` instead of `margin-left`)116- Respect `prefers-reduced-motion` for animations117118### Bundle & Performance119120- Avoid introducing new dependencies121- Maintain strict bundle size control122- Support tree shaking123- Browser compatibility: Chrome 80+124- Optimize for minimal re-renders125126### Testing Requirements127128- Write comprehensive tests using Jest and React Testing Library129- Target 100% test coverage130- Place tests in `__tests__` directory as `index.test.tsx` or `componentName.test.tsx`131- Include snapshot tests for UI components132- Inside `components/**/__tests__/` use **relative** paths (`../`, `../../_util/...`) — never `antd`, `antd/es/*`, or path aliases. See [`AGENTS.md`](../AGENTS.md) for the full rule.133134### Demo & Documentation135136- Keep demo code concise and copy-pasteable137- Focus each demo on a single feature138- Provide both English and Chinese documentation (`index.en-US.md` and `index.zh-CN.md`)139- Inside `components/**/demo/` use **absolute** imports (`antd`, `antd/es/*`, `antd/locale/*`) — never relative paths to component internals. The semantic demos (`_semantic*.tsx`) are an exception. See [`AGENTS.md`](../AGENTS.md) for the full rule.140- Follow import order: React → dependencies → antd components → custom components → types → styles141- Use 2-space indentation142- Prefer antd built-in components over external dependencies143144### Type Checks (Utility)145146Prefer the helpers in `components/_util/is.ts` (`isNumber`, `isString`, `isPlainObject`, `isFunction`, `isThenable`, `isPrimitive`, `isNonNullable`) over inline `typeof` / `instanceof` checks when the helper covers the case.147148### API Documentation Format149150When documenting component APIs, use this table structure:151152- String defaults in backticks: `"default"`153- Boolean defaults as literal values: `true` or `false`154- Number defaults as literal values: `0`, `100`155- No default value: `-`156- Descriptions start with capital letter, no ending period157- Sort API properties alphabetically (ignoring common props like `className`, `style`; place event callbacks last)158159### Internationalization160161- Locale configuration files use pattern: `locale_COUNTRY.ts` (e.g., `zh_CN.ts`)162- Use `useLocale` hook from `components/locale/index.tsx`163- When modifying locale strings, update ALL language files under `components/locale/`164- Locale content should be plain strings with `${}` placeholders for variables165166### File Organization167168- Components in `components/[component-name]/` directory (kebab-case directory name, PascalCase implementation file)169- Demos in `components/[component-name]/demo/` as `.tsx` files paired with `.md` documentation170- Use kebab-case for demo filenames: `basic.tsx`, `custom-filter.tsx`171- Each component exports through `components/[component-name]/index.tsx`172173## Development Commands174175- `npm start` - Development server176- `npm run build` - Build project177- `npm test` - Run tests178- `npm run lint` - Code linting179- `npm run format` - Code formatting180181## Quality Standards182183- Pass all ESLint and TypeScript checks184- Achieve 100% test coverage185- Support accessibility (WCAG 2.1 AA)186- Maintain cross-browser compatibility187- No console errors or warnings188189When contributing code, ensure it follows these patterns and integrates seamlessly with the existing Ant Design ecosystem.190
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| ant-design/ant-designAGENTS.md · 99k | AGENTS.md | testgitapiui+1 | 74/100 | today |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| chihebnabil/lovable-boilerplate.github/instructions/global.instructions.md · 65 | Copilot instructions | buildlint-formatstylearch+4 | 100/100 | 14 days ago | |
| louislam/uptime-kuma.github/copilot-instructions.md · 90k | Copilot instructions | setupbuildtestlint-format+9 | 100/100 | 14 days ago | |
| bagisto/bagisto.github/copilot-instructions.md · 28k | Copilot instructions | setupbuildteststyle+5 | 97/100 | 14 days ago | |
| JCodesMore/ai-website-cloner-template.github/copilot-instructions.md · 32k | Copilot instructions | buildlint-formatstylearch+3 | 97/100 | 7 days ago | |
| nerolis-lab/nerolis-lab.github/copilot-instructions.md · 32 | Copilot instructions | setupbuildtestlint-format+11 | 96/100 | 14 days ago | |
| darkmatter/nixmac.github/copilot-instructions.md · 25 | Copilot instructions | setupbuildtestlint-format+8 | 96/100 | 14 days ago | |
| thangaram611/second-brain.github/copilot-instructions.md · 0 | Copilot instructions | setupteststylearch+4 | 96/100 | 14 days ago | |
| doubts-suplab/eeik-bootstrap.github/instructions/cdk-terraform.instructions.md · 1 | Copilot instructions | teststylearchtypes+2 | 96/100 | today |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/ant-design-ant-design-github-copilot-instructions)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.