К основному содержанию
скилл CX Codex

shadcn-ui · giuseppe-trisciuoglio — скилл для Claude Code: компоненты React и формы

Скилл подсказывает агенту, как ставить и настраивать компоненты shadcn/ui: кнопки, диалоги, таблицы, формы с React Hook Form и Zod.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add giuseppe-trisciuoglio/developer-kit --skill shadcn-ui -a claude-code
Открыть на GitHub

Что делает shadcn-ui

Скилл добавляет агенту рабочие шаблоны shadcn/ui: команды установки компонентов, готовые сниппеты для кнопок, диалогов, тостов, таблиц и графиков на Recharts. Внутри — таблица компонентов с командами вида npx shadcn@latest add button, примеры форм с валидацией через React Hook Form и Zod, а также ссылки на файлы в references/ по формам и графикам.

Компоненты shadcn/ui копируются прямо в проект, поэтому код остаётся у вас и его можно править. Стили и темы строятся на Tailwind CSS и CSS-переменных, доступность обеспечивают примитивы Radix UI. Скилл умеет работать с тёмной темой и кастомными темами.

Скилл рассчитан на React-проект с Tailwind. Если вы ставите shadcn/ui в существующий проект, сначала понадобится npx shadcn@latest init и зависимости вроде tailwindcss-animate, class-variance-authority, clsx, tailwind-merge и lucide-react. Без этого команды добавления компонентов не сработают. Инструкции обрезаны на разделе с примерами, так что часть продвинутых сценариев опирается на файлы в references/.

Какие задачи решает

  • инициализировать shadcn/ui в новом или существующем проекте
  • добавить кнопку, инпут, диалог или таблицу одной командой
  • собрать форму с валидацией через React Hook Form и Zod
  • настроить тёмную тему и CSS-переменные в Tailwind
  • построить график на Recharts внутри компонента chart

Примеры запросов агенту

  • Поставь shadcn/ui в проект и добавь компоненты button, input и form
  • Сделай форму логина с валидацией email и пароля через React Hook Form и Zod
  • Добавь диалог редактирования профиля и тост об успешном сохранении

Как установить shadcn-ui

1Через Skills CLI (Vercel)

npx skills add giuseppe-trisciuoglio/developer-kit --skill shadcn-ui -a claude-code

2Вручную: положить файлы

~/.claude/skills/shadcn-ui/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/shadcn-ui/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о shadcn-ui

Как установить shadcn-ui в Claude?

Выполните npx skills add giuseppe-trisciuoglio/developer-kit --skill shadcn-ui -a claude-code. Файл скилла окажется в ~/.claude/skills/shadcn-ui/SKILL.md.

Что делает скилл shadcn-ui?

Даёт агенту шаблоны и команды для установки и настройки компонентов shadcn/ui: кнопок, диалогов, таблиц, тостов, форм с валидацией и графиков на Recharts.

Что нужно для работы скилла?

React-проект с Tailwind CSS. Для существующего проекта сначала ставятся зависимости вроде tailwindcss-animate, class-variance-authority, clsx, tailwind-merge и lucide-react, затем npx shadcn@latest init.

Исходный текст

SKILL.md · MIT
---
name: shadcn-ui
description: Provides complete shadcn/ui component library patterns including installation, configuration, and implementation of accessible React components. Use when setting up shadcn/ui, installing components, building forms with React Hook Form and Zod, customizing themes with Tailwind CSS, or implementing UI patterns like buttons, dialogs, dropdowns, tables, and complex form layouts.
allowed-tools: Read, Write, Bash, Edit, Glob
---

# shadcn/ui Component Patterns

Build accessible, customizable UI components with shadcn/ui, Radix UI, and Tailwind CSS.

## Overview

- Components are **copied into your project** — you own and customize the code
- Built on **Radix UI** primitives for full accessibility
- Styled with **Tailwind CSS** and CSS variables for theming
- CLI-based installation: `npx shadcn@latest add <component>`

## When to Use

Activate when user requests involve:
- "Set up shadcn/ui", "initialize shadcn", "add shadcn components"
- "Install button/input/form/dialog/card/select/toast/table/chart"
- "React Hook Form", "Zod validation", "form with validation"
- "accessible components", "Radix UI", "Tailwind theme"
- "shadcn button", "shadcn dialog", "shadcn sheet", "shadcn table"
- "dark mode", "CSS variables", "custom theme"
- "charts with Recharts", "bar chart", "line chart", "pie chart"

## Quick Reference

### Available Components

| Component | Install Command | Description |
|-----------|----------------|-------------|
| `button` | `npx shadcn@latest add button` | Variants: default, destructive, outline, secondary, ghost, link |
| `input` | `npx shadcn@latest add input` | Text input field |
| `form` | `npx shadcn@latest add form` | React Hook Form integration with validation |
| `card` | `npx shadcn@latest add card` | Container with header, content, footer |
| `dialog` | `npx shadcn@latest add dialog` | Modal overlay |
| `sheet` | `npx shadcn@latest add sheet` | Slide-over panel (top/right/bottom/left) |
| `select` | `npx shadcn@latest add select` | Dropdown select |
| `toast` | `npx shadcn@latest add toast` | Notification toasts |
| `table` | `npx shadcn@latest add table` | Data table |
| `menubar` | `npx shadcn@latest add menubar` | Desktop-style menubar |
| `chart` | `npx shadcn@latest add chart` | Recharts wrapper with theming |
| `textarea` | `npx shadcn@latest add textarea` | Multi-line text input |
| `checkbox` | `npx shadcn@latest add checkbox` | Checkbox input |
| `label` | `npx shadcn@latest add label` | Accessible form label |

## Instructions

### Initialize Project

```bash
# New Next.js project
npx create-next-app@latest my-app --typescript --tailwind --eslint --app
cd my-app
npx shadcn@latest init

# Existing project
npm install tailwindcss-animate class-variance-authority clsx tailwind-merge lucide-react
npx shadcn@latest init

# Install components
npx shadcn@latest add button input form card dialog select toast
```

### Basic Component Usage

```tsx
// Button with variants and sizes
import { Button } from "@/components/ui/button"

<Button variant="default">Default</Button>
<Button variant="destructive" size="sm">Delete</Button>
<Button variant="outline" disabled>Loading...</Button>
```

### Form with Zod Validation

```tsx
"use client"

import { zodResolver } from "@hookform/resolvers/zod"
import { useForm } from "react-hook-form"
import { z } from "zod"
import { Button } from "@/components/ui/button"
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form"
import { Input } from "@/components/ui/input"

const formSchema = z.object({
  email: z.string().email("Invalid email"),
  password: z.string().min(8, "Password must be at least 8 characters"),
})

export function LoginForm() {
  const form = useForm<z.infer<typeof formSchema>>({
    resolver: zodResolver(formSchema),
    defaultValues: { email: "", password: "" },
  })

  return (
    <Form {...form}>
      <form onSubmit={form.handleSubmit(console.log)} className="space-y-4">
        <FormField name="email" control={form.control} render={({ field }) => (
          <FormItem>
            <FormLabel>Email</FormLabel>
            <FormControl><Input type="email" {...field} /></FormControl>
            <FormMessage />
          </FormItem>
        )} />
        <FormField name="password" control={form.control} render={({ field }) => (
          <FormItem>
            <FormLabel>Password</FormLabel>
            <FormControl><Input type="password" {...field} /></FormControl>
            <FormMessage />
          </FormItem>
        )} />
        <Button type="submit">Login</Button>
      </form>
    </Form>
  )
}
```

See [references/forms-and-validation.md](references/forms-and-validation.md) for advanced multi-field forms, contact forms with API submission, and login card patterns.

### Dialog (Modal)

```tsx
import { Button } from "@/components/ui/button"
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog"

<Dialog>
  <DialogTrigger asChild>
    <Button variant="outline">Open</Button>
  </DialogTrigger>
  <DialogContent>
    <DialogHeader>
      <DialogTitle>Edit Profile</DialogTitle>
    </DialogHeader>
    {/* content */}
  </DialogContent>
</Dialog>
```

### Toast Notification

```tsx
// 1. Add <Toaster /> to app/layout.tsx
import { Toaster } from "@/components/ui/toaster"

// 2. Use in components
import { useToast } from "@/components/ui/use-toast"

const { toast } = useToast()
toast({ title: "Success", description: "Changes saved." })
toast({ variant: "destructive", title: "Error", description: "Something went wrong." })
```

### Bar Chart

```tsx
import { Bar, BarChart, CartesianGrid, XAxis } from "recharts"
import { ChartContainer, ChartTooltipContent } from "@/components/ui/chart"

const chartConfig = {
  desktop: { label: "Desktop", color: "var(--chart-1)" },
} satisfies import("@/components/ui/chart").ChartConfig

<ChartContainer config={chartConfig} className="min-h-[200px] w-full">
  <BarChart data={data}>
    <CartesianGrid vertical={false} />
    <XAxis dataKey="month" />
    <Bar dataKey="desktop" fill="var(--color-desktop)" radius={4} />
    <ChartTooltip content={<ChartTooltipContent />} />
  </BarChart>
</ChartContainer>
```

See [references/charts-components.md](references/charts-components.md) for Line, Area, and Pie chart examples.

## Examples

### Login Form with Validation
```tsx
"use client"
import { zodResolver } from "@hookform/resolvers/zod"
import { useForm } from "react-hook-form"
import { z } from "zod"
import { Button } from "@/components/ui/button"
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form"
import { Input } from "@/components/ui/input"

const formSchema = z.object({
  email: z.string().email("Invalid email"),
  password: z.string().min(8, "Min 8 characters"),
})

export function LoginForm() {
  const form = useForm<z.infer<typeof formSchema>>({
    resolver: zodResolver(formSchema),
    defaultValues: { email: "", password: "" },
  })

  return (
    <Form {...form}>
      <form onSubmit={form.handleSubmit(console.log)} className="space-y-4">
        <FormField name="email" control={form.control} render={({ field }) => (
          <FormItem>
            <FormLabel>Email</FormLabel>
            <FormControl><Input type="email" {...field} /></FormControl>
            <FormMessage />
          </FormItem>
        )} />
        <FormField name="password" control={form.control} render={({ field }) => (
          <FormItem>
            <FormLabel>Password</FormLabel>
            <FormControl><Input type="password" {...field} /></FormControl>
            <FormMessage />
          </FormItem>
        )} />
        <Button type="submit">Login</Button>
      </form>
    </Form>
  )
}
```

### Data Table with Actions
```tsx
import { ColumnDef } from "@tanstack/react-table"
import { Button } from "@/components/ui/button"
import { Checkbox } from "@/components/ui/checkbox"
import { DataTable } from "@/components/ui/data-table"

const columns: ColumnDef<User>[] = [
  { id: "select", header: ({ table }) => (
    <Checkbox checked={table.getIsAllPageRowsSelected()} />
  ), cell: ({ row }) => (
    <Checkbox checked={row.getIsSelected()} />
  )},
  { accessorKey: "name", header: "Name" },
  { accessorKey: "email", header: "Email" },
  { id: "actions", cell: ({ row }) => (
    <Button variant="ghost" size="sm">Edit</Button>
  )},
]
```

### Dialog with Form
```tsx
import { Button } from "@/components/ui/button"
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog"

<Dialog>
  <DialogTrigger asChild>
    <Button variant="outline">Add User</Button>
  </DialogTrigger>
  <DialogContent>
    <DialogHeader>
      <DialogTitle>Add New User</DialogTitle>
    </DialogHeader>
    {/* <LoginForm /> */}
  </DialogContent>
</Dialog>
```

### Toast Notifications
```tsx
import { useToast } from "@/components/ui/use-toast"
import { Button } from "@/components/ui/button"

const { toast } = useToast()

toast({ title: "Saved", description: "Changes saved successfully." })
toast({ variant: "destructive", title: "Error", description: "Failed to save." })
```

## Best Practices

- **Accessibility**: Use Radix UI primitives — ARIA attributes are built in
- **Client Components**: Add `"use client"` for interactive components (hooks, events)
- **Type Safety**: Use TypeScript and Zod schemas for form validation
- **Theming**: Configure CSS variables in `globals.css` for consistent design
- **Customization**: Modify component files directly — you own the code
- **Path Aliases**: Ensure `@` alias is configured in `tsconfig.json`
- **Registry Security**: Only install components from trusted registries; review generated code before production use
- **Dark Mode**: Set up with CSS variables strategy and `next-themes`
- **Forms**: Always use `Form`, `FormField`, `FormItem`, `FormLabel`, `FormMessage` together
- **Toaster**: Add `<Toaster />` once to root layout

## Constraints and Warnings

- **Not an NPM Package**: Components are copied to your project; they are not a versioned dependency
- **Registry Security**: Components from `npx shadcn@latest add` are fetched remotely; always verify the registry source is trusted before installation
- **Client Components**: Most interactive components require `"use client"` directive
- **Radix Dependencies**: Ensure all `@radix-ui` packages are installed
- **Tailwind Required**: Components rely on Tailwind CSS utilities
- **Path Aliases**: Configure `@` alias in `tsconfig.json` for imports

## References

Consult these files for detailed patterns and code examples:

- **[references/setup-and-configuration.md](references/setup-and-configuration.md)** — Full installation, tsconfig, tailwind config, CSS variables
- **[references/ui-components.md](references/ui-components.md)** — Button, Input, Card, Dialog, Sheet, Select, Toast, Table, Menubar
- **[references/forms-and-validation.md](references/forms-and-validation.md)** — React Hook Form + Zod, advanced forms, login card, contact form
- **[references/charts-components.md](references/charts-components.md)** — Bar, Line, Area, Pie charts with ChartContainer and theming
- **[references/nextjs-integration.md](references/nextjs-integration.md)** — App Router, Server/Client Components, dark mode, metadata
- **[references/customization.md](references/customization.md)** — Custom variants, CSS variables, cn() utility, extending components

© giuseppe-trisciuoglio · MIT · giuseppe-trisciuoglio/developer-kit

Похожие скиллы

Всё по теме «Фронтенд и UI» →

Сначала — shadcn-ui от других авторов.

shadcn-ui официальный google-labs-code Помогает находить, добавлять и настраивать компоненты shadcn/ui в React-проектах. Пригодится для сборки интерфейсов с Tailwind CSS. CX Codex +1 53 400установок shadcn-ui nexu-io Скилл помогает агенту собирать структурированные и доступные UI-компоненты с shadcn/ui. Пригодится на этапе планирования интерфейса. CX Codex +1 2 900установок shadcn-ui jezweb Ставит и настраивает компоненты shadcn/ui в React-проекте: подбирает их по задаче, следит за порядком установки и зависимостями. CX Codex +1 3 600установок shadcn-ui existential-birds Подсказывает агенту, как собирать компоненты на shadcn/ui: Radix, Tailwind, CVA-варианты и data-slot. CX Codex +1 351установок ui-components OrchestKit Скилл задаёт правила разработки интерфейсов на базе shadcn/ui и Radix Primitives. Помогает строить дизайн-системы, настраивать стили v4 и связывать формы с Zod. CX Codex +1 1 500установок ui-design-system samhvw8 Скилл для сборки и разбора React-интерфейсов на TailwindCSS, Radix UI и shadcn/ui. Пригодится, когда компоненты уже расползлись и нужен порядок. CX Codex +1 3 200установок shadcn PyModel Скилл с набором правил для работы с shadcn/ui: архитектура компонентов, доступность, темы, формы и таблицы. Пригодится, когда агент пишет или правит UI на React. CX Codex +1 458установок tailwind-v4-shadcn secondsky Скилл настраивает связку Tailwind CSS v4, shadcn/ui и React в проектах на Vite. Помогает избежать ошибок импорта и поломки CSS-переменных при переключении тем оформления. CX Codex +1 8 100установок cursor-ai-react-typescript-shadcn-ui-cursorrules-p PatrickJS Правило для Cursor, которое настраивает агента писать на React и TypeScript так, как принято в проектах с shadcn/ui и Tailwind CSS. ★ 41 011звёзд репо nextjs-shadcn laguagu Скилл помогает агенту собрать интерфейс Next.js с shadcn/ui: выбрать шрифты, тему, фон и эффекты под задачу продукта. CX Codex +1 835установок

Из того же набора93

tailwind-css-patterns Скилл с готовыми паттернами Tailwind CSS: адаптивные сетки, карточки, формы, тёмная тема. Пригодится, когда агент верстает компоненты на React, Vue или Svelte. CX Codex +1 17 700установок drizzle-orm-patterns Помогает писать типобезопасные схемы, запросы и миграции на Drizzle ORM. Пригодится при работе с таблицами, связями и транзакциями. CX Codex +1 5 400установок nextjs-performance Скилл по оптимизации Next.js: Core Web Vitals, картинки и шрифты, кеширование, стриминг, размер бандла. Пригодится, когда сайт тормозит и надо понять, с чего начать. CX Codex +1 4 900установок unit-test-bean-validation Скилл помогает писать изолированные тесты для Jakarta Bean Validation на JUnit 5 без запуска Spring. Пригодится при проверке DTO и кастомных валидаторов. CX Codex +1 4 900установок react-patterns Подсказывает агенту паттерны React 19: Server Components, Server Actions, useOptimistic, Suspense. Пригодится, когда пишете приложение на Next.js App Router. CX Codex +1 4 800установок tailwind-design-system Скилл помогает развернуть дизайн-систему на Tailwind CSS v4.1+ и shadcn/ui. Он настраивает токены в формате oklch, CSS-переменные и обёртки над базовыми компонентами. CX Codex +1 4 500установок spring-boot-test-patterns Скилл подсказывает агенту, как писать тесты Spring Boot: юнит-тесты с Mockito, срезы @DataJpaTest и @WebMvcTest, интеграционные с Testcontainers. CX Codex +1 4 300установок react-code-review Скилл проверяет React-компоненты и хуки перед мержем: архитектура, зависимости в useEffect, доступность, типы. Полезен, когда правки уже готовы и нужен разбор по серьёзности. CX Codex +1 4 300установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой