--- trigger: always_on --- | No | Category | Guideline | Description | Do | Don't | Code Good | Code Bad | Severity | Docs URL | |----|------------|----------------------------------|--------------------------------------------------|--------------------------------------------------------------------|--------------------------------------------------------------|--------------------------------------------------------------------------|--------------------------------------------------------------------------|------------|-------------------------------------------------------------------------| | 1 | Setup | Use CLI for installation | Install components via shadcn CLI for proper setup | npx shadcn@latest add component-name | Manual copy-paste from docs | npx shadcn@latest add button | Copy component code manually | High | [shadcn CLI](https://ui.shadcn.com/docs/cli) | | 2 | Setup | Initialize project properly | Run init command to set up components.json and globals.css | npx shadcn@latest init before adding components | Skip init and add components directly | npx shadcn@latest init | npx shadcn@latest add button (without init) | High | [shadcn Installation](https://ui.shadcn.com/docs/installation) | | 3 | Setup | Configure path aliases | Set up proper import aliases in tsconfig and components.json | Use @/components/ui path aliases | Relative imports like ../../components | import { Button } from "@/components/ui/button" | import { Button } from "../../components/ui/button" | Medium | [shadcn Installation](https://ui.shadcn.com/docs/installation) | | 4 | Theming | Use CSS variables for colors | Define colors as CSS variables in globals.css for theming | CSS variables in :root and .dark | Hardcoded color values in components | bg-primary text-primary-foreground | bg-blue-500 text-white | High | [shadcn Theming](https://ui.shadcn.com/docs/theming) | | 5 | Theming | Follow naming convention | Use semantic color names with foreground pattern | primary/primary-foreground secondary/secondary-foreground | Generic color names | --primary --primary-foreground | --blue --light-blue | Medium | [shadcn Theming](https://ui.shadcn.com/docs/theming) | | 6 | Theming | Support dark mode | Include .dark class styles for all custom CSS | Define both :root and .dark color schemes | Only light mode colors | .dark { --background: 240 10% 3.9%; } | No .dark class styles | High | [shadcn Dark Mode](https://ui.shadcn.com/docs/dark-mode) | | 7 | Components | Use component variants | Leverage cva variants for consistent styling | Use variant prop for different styles | Inline conditional classes |