react
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
Security Assessment
About react
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.
FAQ
When should `createStaticStyles` be used instead of `createStyles`?
`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.
Which UI library components should be preferred when building new interfaces?
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.
What routing library should be used for SPA navigation?
The skill requires the use of `react-router-dom` for SPA navigation. `next/link` should not be used for this routing architecture.
Why do `.desktop.tsx` files need synchronized updates?
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.
What layout practices are recommended for React pages?
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.
Install react
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
lobehub/lobehub