Shadcn UI Rules
Defines import paths and component usage rules for Shadcn UI primitives in a Next.js project.
What this file does
Defines import paths and component usage rules for Shadcn UI primitives in a Next.js project.
When to use it
- Starting a new project with Shadcn UI and Next.js
- Enforcing consistent import paths for Shadcn components
- Teaching a team when to use Button vs styled Link
- Documenting available Shadcn primitives for reference
Assumes this stack
trigger: glob globs: *.tsx
Shadcn UI Rules
<author>blefnk/rules</author> <version>1.0.0</version>
Context
- For integrating Shadcn UI primitives
- Maintains consistency and design standards
Requirements
- Import Shadcn primitives from
$/lib/primitives. - Keep app-specific components in
$/lib/components. - Match Shadcn design and naming conventions.
- Style <Link> using
cn()andbuttonVariantswhen you need a button-like style. - Use <Button> only when you need to call a function.
Available Shadcn UI Component Primitives
Accordion, Alert, Alert Dialog, Aspect Ratio, Avatar, Badge, Breadcrumb, Button, Calendar, Card, Carousel, Chart, Checkbox, Collapsible, Combobox, Command, Context Menu, Data Table, Date Picker, Dialog, Drawer, Dropdown Menu, Form, Hover Card, Input, Input OTP, Label, Menubar, Navigation Menu, Pagination, Popover, Progress, Radio Group, Resizable, Scroll Area, Select, Separator, Sheet, Sidebar, Skeleton, Slider, Sonner, Switch, Table, Tabs, Textarea, Toast, Toggle, Toggle Group, Tooltip
Examples
<example> import { Button } from "~/ui/primitives/button";export function ConfirmButton() { return <Button>Confirm</Button>; } </example>
<example type="invalid"> import { Button } from "shadcn-ui";export function ConfirmButton() { return <Button>Confirm</Button>; } </example>
<example>import { Link } from "next/link";
import { cn } from "~/lib/utils";
import { buttonVariants } from "~/ui/primitives/button";
export function HomeLink() {
return (
<Link
href="/"
className={cn(
buttonVariants({
variant: "default",
className: "mx-auto mt-4 w-fit",
})
)}
>
Home
</Link>
);
}
</example>
<example type="invalid">
import { Link } from "next/link";
import { Button } from "~/ui/primitives/button";
export function HomeLink() {
return (
<Button
className="mx-auto mt-4 w-fit"
>
<Link href="/">Home</Link>
</Button>
);
}
</example>What's inside
1 trigger glob, 3 context items, 5 requirements, 1 component list, 4 code examples
Change this for your project
- Replace
$/lib/primitiveswith your project's actual import path - Replace
$/lib/componentswith your project's actual components path - Replace
~/ui/primitives/buttonin examples with your project's import alias - Replace
~/lib/utilswith your project's utility module path
Where it goes
Keep in docs/ or alongside the feature. Agents read it to implement against a defined contract.
Related Documents
Community AI Agent Skills Discovery Sources
Catalogs 50+ platforms, repositories, directories, and communities for discovering and sharing AI agent skills across multiple coding tools.
GPU Selection Guide for Large Language Models (LLMs)
Guides GPU selection for LLM inference, fine-tuning, and training by mapping model sizes, precision levels, and budgets to VRAM requirements.
ReleaseKit - Technical Requirements Document
Specifies a Go library and CLI for release automation with conventional commit parsing, validation checks, and workflow orchestration.
Python Development Environment Setup with Ruff
Defines a complete Python development environment using Ruff for linting and formatting, with pytest, mypy, pre-commit hooks, and VSCode configuration.