LobeHub React component conventions — styling via `antd-style` `createStaticStyles` + `cssVar.*` (zero-runtime preferred over `createStyles` + `token`), `@lobehub/ui` over antd when both exist, routing via `react-router-dom` (not `next/link`). Use when writing or editing any `.tsx` under `src/**`. Triggers on `createStaticStyles`, `createStyles`, `cssVar`, `antd-style`, `Flexbox`, `Center`, `Select`, `Modal`, `Drawer`, `Button`, `Tooltip`, `DropdownMenu`, `Popover`, `Switch`, `ScrollArea`, `Link
The react skill provides guidance and conventions for writing and editing React components within a LobeHub-based codebase. It standardizes component structure, styling patterns, layout practices, and routing behavior for `.tsx` files under `src/**`. The skill focuses on enforcing consistent frontend architecture by prioritizing zero-runtime styling with `antd-style` and `createStaticStyles`, encouraging the use of `cssVar.*` variables, and preventing direct dependency on lower-level UI frameworks when higher-level abstractions already exist. It also ensures developers follow the correct SPA routing patterns using `react-router-dom` instead of `next/link`.
The skill includes detailed recommendations for component selection and UI composition. It prioritizes reusable project-specific components from `src/components`, then headless primitives from `@lobehub/ui/base-ui`, followed by higher-level components from `@lobehub/ui`. It provides guidance for layout construction using `Flexbox` and `Center`, including spacing and overflow management patterns. The documentation also defines rules for dynamic versus static styling, explains when `createStyles` should be used as a last resort, and highlights synchronization requirements between standard `.tsx` files and `.desktop.tsx` Electron variants to prevent routing or rendering issues.
This skill is intended for frontend engineers working on React applications that follow the LobeHub architecture and component ecosystem. It is especially useful for developers creating new pages, editing layouts, adding styles, managing routing behavior, or integrating reusable UI primitives. Teams maintaining shared design systems or Electron-compatible React applications can use this guidance to maintain consistency, reduce styling overhead, and avoid synchronization problems between desktop and web implementations.
`createStaticStyles` should be used in most cases because it provides zero-runtime styling and works with `cssVar.*`. `createStyles` should only be used for truly dynamic styling scenarios such as JavaScript color functions.
The preferred order is project-specific components in `src/components`, then primitives from `@lobehub/ui/base-ui`, followed by higher-level components from `@lobehub/ui`. Direct use of antd is considered a last resort.
The skill requires the use of `react-router-dom` for SPA navigation. `next/link` should not be used for this routing architecture.
Desktop-specific variants must stay synchronized with their web counterparts to prevent Electron rendering issues such as blank pages caused by routing or import drift.
The skill recommends using `Flexbox` and `Center` from `@lobehub/ui`, using `gap` for spacing, `flex={1}` for filling available space, and nested flex layouts with controlled overflow for scrollable regions.
Quick Setup:
.claude/skills/Repository
lobehub/lobehub