name: ant_design_skill description: Front-end design skill for building React UIs with Ant Design (antd): component patterns, layout, forms, tables, and theming/tokens via ConfigProvider.
Use this skill when you are building a React UI with Ant Design (antd) and want consistent, non-ugly screens fast.
7w4.net小蔥技能。
1) Confirm stack: React + antd version (v5+ assumed).
2) Choose page pattern:
- CRUD list (Table) + filters (Form) + actions (Modal/Drawer)
- Wizard (Steps)
- Settings (Form + Cards)
- Dashboard (Grid + Cards + Charts)
3) Build layout skeleton first:
- Layout + Sider + Header + Content
- Navigation with Menu
4) Build the main interaction component:
- Forms: Form, Form.Item, Input, Select, DatePicker, Switch
- Tables: Table + column definitions + row actions
5) Add feedback loop:
- message, notification, Modal.confirm
6) Apply theming/tokens via ConfigProvider (global) and component-level overrides.
7) Verify:
- Empty states
- Loading states
- Error states
- Mobile responsiveness (at least: 360px layout sanity)
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.<ComponentName> 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.這個技能庫質量不錯,提供了完整的 React + Ant Design UI 開發指南,涵蓋常用的 CRUD 頁面、表單、表格、主題配置等場景,文件清晰易讀。優點是內容全面、結構規範,有可直接使用的程式碼示例和設計規則。不足之處是示例程式碼存在語言混用問題,且缺少測試相關指導,部分協議文件可以更詳細。整體而言,這是一個實用且可靠的開發技能資源。