rcr-frontend
Component development rules specific to Red Cliff Record. Use when working with React components, Tailwind CSS styling, Radix/Shadcn primitives, icons, buttons, forms, or frontend code in this project. Triggers on component files, styling questions, design tokens, Tailwind v4, Shadcn, Radix, TanStack Forms, Lucide icons, or UI primitive usage patterns (sizing, spacing, layout).
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
RCR Frontend
Supplements global react-guidelines and frontend-html-css-guidelines skills.
Component Organization
- Reusable components:
src/app/components/with kebab-case naming (includes all Shadcn-derived primitives) - No separate
ui/directory — everything lives directly undersrc/app/components/ - Page-specific components:
-components/directory or-component.tsxsuffix
Styling
-
Tailwind CSS v4 with
c-*design tokens fromsrc/app/styles/theme.css - Semantic color pattern:
c-main/c-main-contrast,c-destructive/c-destructive-contrast. Never invent token names — checksrc/app/styles/app.cssfor the full list -
Never use legacy Shadcn theme variables (
bg-background,text-foreground, etc.) -
Detecting invalid classes: Oxfmt sorts unknown classes to the front. If classes appear out of order after
bun check, they're misspelled or missing from the theme
Radix & Shadcn
- Always import Radix from the
radix-uipackage (import { HoverCard as HoverCardPrimitive } from 'radix-ui'), not from subpackages like@radix-ui/react-hover-card - Use
asChildto compose styling (e.g., dropdown trigger styled as Button) rather than duplicating inline styles - Mark key DOM nodes with
data-slotattributes for styling hooks
Component Primitives
Buttons
The Button component handles sizing, text, and icon dimensions internally. Never override these with utility classes.
-
Dimensions: use the
sizeprop (default|sm|icon), never manualh-x w-x p-0. For icon-only buttons,size="icon"givessize-9. -
Text size: baked into the base (
text-sm). Never addtext-xs,text-sm, etc. viaclassName. -
Icon size: the base rule
[&_svg:not([class*='size-'])]:size-4auto-sizes child SVGs. Never addh-x w-xorsize-xto icons inside buttons — omit sizing entirely and let the button handle it. - Content over positioning: put content (counts, badges) as regular children in flow — never absolutely-positioned overlays.
Icons
- Lucide icons with
Iconsuffix:HomeIcon, notHome - Icons inherit size from surrounding text automatically.
size-[1em]is redundant — omit it. - Only add explicit
size-*when overriding the contextual size (e.g., a larger icon in small text). - Use
<Spinner />from@/components/spinnerfor loading states
Tailwind Shorthand
- When width and height are equal, use
size-xinstead ofw-x h-x - No custom/arbitrary text sizes (
text-[10px],text-[13px], etc.) — use design system tokens (text-xs,text-sm, etc.) unless there's a specific constraint preventing it
Event Handlers
- No inline arrow functions in JSX
onClick/onChangeprops — extract to a named handler or a component with its own handler
Forms
- TanStack Forms + Zod schemas for form management and validation
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-03-11
- 索引更新时间
- 2026-03-11
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!