一键导入
nachui-component-development
Use when creating, modifying, or refactoring React components in the packages/ui directory of NachUI.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when creating, modifying, or refactoring React components in the packages/ui directory of NachUI.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when modifying or extending CLI commands, prompts, build configurations, or API integrations in packages/cli.
Use when building, extending, or consuming compound components — components made of multiple sub-parts assembled via dot notation (e.g. Dialog.Trigger, Card.Header, Accordion.Item).
Use when styling, designing, or adjusting UI layout, colors, variables, typography, and visual assets in NachUI.
Use when modifying documentation pages, routing, next-intl translations, MDX schemas, or AI functionality in apps/docs.
Use when writing or running automated tests inside packages/ui or verify regressions in NachUI.
Use when consuming, importing, or integrating NachUI components inside apps/web or any app that depends on @repo/ui.
| name | nachui-component-development |
| description | Use when creating, modifying, or refactoring React components in the packages/ui directory of NachUI. |
You are an expert React 19 developer building components for the NachUI library. Follow these strict guidelines and patterns when authoring or modifying components.
'use client' directive only if using React hooks (useState, useEffect, useContext, etc.) or accessing client-only DOM APIs.tailwind.config.js. Tailwind CSS v4 uses CSS variables defined in globals.css. Use these variable tokens (e.g., var(--surface-muted)) rather than literal hex/RGB codes.cn(...) utility helper to merge and conditionalize classes. Never build Tailwind strings manually.layout (e.g., flex, grid) → spacing (e.g., p-4, m-2) → typography (e.g., text-sm) → color (e.g., text-foreground) → effects (e.g., shadow-md).cva variant configurations outside the component function block. Export the configuration and its VariantProps type.import { cva, type VariantProps } from 'class-variance-authority'
export const buttonVariants = cva(
'inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors',
{
variants: {
variant: {
default: 'bg-primary text-primary-foreground hover:bg-primary/90',
destructive:
'bg-destructive text-destructive-foreground hover:bg-destructive/90',
},
size: {
default: 'h-10 px-4 py-2',
sm: 'h-9 rounded-md px-3',
},
},
defaultVariants: {
variant: 'default',
size: 'default',
},
},
)
variants and transitions as top-level constants. This avoids unnecessary re-evaluation during render cycles and keeps code clean.displayName at the bottom.import * as React from 'react';
import { cn } from '@/lib/cn';
export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {}
export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, ...props }, ref) => {
return (
<button
className={cn(buttonVariants({ variant, size }), className)}
ref={ref}
{...props}
/>
);
}
);
Button.displayName = 'Button';
const AlertContext = React.createContext<AlertContextValue | null>(null)
export const useAlertContext = () => {
const context = React.useContext(AlertContext)
if (!context) {
throw new Error('useAlertContext must be used within an AlertProvider')
}
return context
}
Organize imports cleanly with groups separated by a single empty line:
react, next/navigation).framer-motion, lucide-react, etc.).@repo/ui, @/lib, @/components)../button-utils, ../types).import type { ... } explicitly.