Use this skill when you are building a React UI with Ant Design (antd) and want consistent, non-ugly screens fast.
1) Confirm stack: React + antd version (v5+ assumed).
2) Choose page pattern:
3) Build layout skeleton first:
Layout + Sider + Header + ContentMenu4) Build the main interaction component:
Form, Form.Item, Input, Select, DatePicker, SwitchTable + column definitions + row actions5) Add feedback loop:
message, notification, Modal.confirm6) Apply theming/tokens via ConfigProvider (global) and component-level overrides.
7) Verify:
Layout with Sider (collapsible), Header for top actions, Content scroll.Flex (or Space) row.Form + Form.Item rules for validation; avoid custom validation unless necessary.Form.useForm() and form.setFieldsValue() for edit flows.rowKey always.Ant Design v5 uses Design Tokens and CSS-in-JS.
Wrap your app in ConfigProvider:
import { ConfigProvider, theme } from 'antd';
export function AppProviders({ children }: { children: React.ReactNode }) {
return (
<ConfigProvider
theme={{
algorithm: theme.defaultAlgorithm,
token: {
colorPrimary: '#1677ff',
borderRadius: 10,
fontSize: 14,
},
components: {
Button: { controlHeight: 40 },
Layout: { headerBg: '#ffffff' },
},
}}
>
{children}
</ConfigProvider>
);
}
Use theme.darkAlgorithm and keep tokens consistent:
const isDark = true;
<ConfigProvider
theme={{
algorithm: isDark ? theme.darkAlgorithm : theme.defaultAlgorithm,
token: { colorPrimary: '#7c3aed' },
}}
/>
Use components. for specific tweaks (Button, Input, Table, etc.).
protocols/ when you want LLM-first contracts (describe UIs as data, then generate code deterministically).references/tokens.md for a tokens cookbook.references/components.md for practical page recipes (CRUD, Settings, Wizard).examples/ when you want ready-to-copy AntD screens.starter/ when you need a runnable Vite + React + AntD skeleton.共 1 个版本