shadcn-ui · oakoss — скилл для Claude Code: что делает и как установить
Учит агента работать с shadcn/ui: добавлять компоненты через CLI, настраивать темы на oklch и собирать формы с проверкой через Zod.
MIT 176 установок ★ 29 обновлён 2026-08-17
npx skills add oakoss/agent-skills --skill shadcn-ui -a claude-codeЧто делает shadcn-ui
Скилл объясняет агенту, как устроен shadcn/ui: компоненты не ставятся зависимостью из npm, а копируются в проект через CLI (npx shadcn@latest add) и дальше правятся как свой код. Внутри есть таблица частых команд и типовых промахов, а рядом четыре справочника — темы и тёмный режим, варианты компонентов, формы, CLI и реестры.
Темы строятся на CSS-переменных в :root с цветами в формате oklch и маппингом через @theme inline; тёмный режим переключает значения под классом .dark. Формы собираются на компоненте <Field /> вместе с React Hook Form или TanStack Form и схемой Zod. Старый <Form /> пока работает, но его больше не развивают.
Скилл рассчитан на React 19 и Tailwind CSS 4, поэтому в проекте без Tailwind или на другом фреймворке он мимо: для Vue и Svelte есть отдельные порты. Из полезного — напоминание, что forwardRef в React 19 устарел и ref передаётся обычным пропом.
Какие задачи решает
- добавить компонент shadcn/ui в проект и не тянуть его как npm-зависимость
- перевести палитру на oklch и настроить тёмный режим через
.dark - собрать форму с валидацией на Zod
- сделать свои варианты кнопки через
cva() - описать собственный реестр компонентов и собрать из него JSON
Примеры запросов агенту
- Добавь компонент
dialogчерез shadcn CLI и покажи, куда скопировались файлы - Переведи наши цветовые токены на oklch и настрой тёмную тему через класс
.dark - Собери форму логина на
<Field />, React Hook Form и схеме Zod
Как установить shadcn-ui
1Через Skills CLI (Vercel)
npx skills add oakoss/agent-skills --skill shadcn-ui -a claude-code2Вручную: положить файлы
~/.claude/skills/shadcn-ui/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/shadcn-ui/
1Через Skills CLI (Vercel)
npx skills add oakoss/agent-skills --skill shadcn-ui -a codex2Вручную: положить файлы
.agents/skills/shadcn-ui/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add oakoss/agent-skills --skill shadcn-ui -a cursor2Вручную: положить файлы
.cursor/skills/shadcn-ui/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install oakoss/agent-skills skills/shadcn-ui2Вручную: положить файлы
.github/skills/shadcn-ui/SKILL.md1Через Skills CLI (Vercel)
npx skills add oakoss/agent-skills --skill shadcn-ui -a gemini-cli2Командой платформы
gemini skills install https://github.com/oakoss/agent-skills --path skills/shadcn-uiВручную: положить файлы
.devin/skills/shadcn-ui/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add oakoss/agent-skills --skill shadcn-ui -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о shadcn-ui
Как установить shadcn-ui в Claude Code?
Выполните npx skills add oakoss/agent-skills --skill shadcn-ui -a claude-code. Файл скилла появится по пути ~/.claude/skills/shadcn-ui/SKILL.md.
Что делает скилл shadcn-ui?
Даёт агенту правила работы с shadcn/ui: добавление компонентов через CLI, темы на oklch, формы с Zod, сборка своих реестров.
Подойдёт ли он для Vue или Svelte?
Нет, скилл про React и Tailwind CSS 4. Для Vue и Svelte существуют отдельные порты shadcn-vue и shadcn-svelte.
Исходный текст
SKILL.md · MIT
---
name: shadcn-ui
description: 'Builds accessible, customizable component libraries using shadcn/ui with Radix UI or Base UI, Tailwind CSS 4, and React 19. Covers component ownership, oklch CSS theming, type-safe forms with Field and Zod, CLI workflows, and registry patterns. Use when adding shadcn/ui components, configuring themes, building forms with Zod, creating custom registries, or composing accessible component variants. Use for shadcn CLI, dark mode, component variants, form validation.'
license: MIT
metadata:
author: oakoss
version: '1.0'
source: 'https://ui.shadcn.com/docs'
user-invocable: false
---
# shadcn/ui
## Overview
Guides building accessible, customizable UI with shadcn/ui as a code generation platform (not an npm dependency). Components are copied into your project via the CLI and fully owned. Supports Radix UI or Base UI primitives, Tailwind CSS 4 with oklch color tokens, React 19 direct ref patterns, and type-safe form validation with the Field component and Zod.
**When to use:** Adding shadcn/ui components, theming with CSS variables and oklch colors, building forms with React Hook Form or TanStack Form, creating custom registries, composing accessible component variants, setting up dark mode.
**When NOT to use:** Non-React frameworks (use shadcn-vue or shadcn-svelte instead), projects using a different component library (MUI, Chakra), projects not using Tailwind CSS.
## Quick Reference
| Pattern | API / Approach | Key Points |
| -------------------- | ------------------------------------------ | ----------------------------------------------------- |
| Init project | `npx shadcn@latest init` | Auto-detects framework, configures CSS variables |
| Add component | `npx shadcn@latest add [name]` | Copies source code into your project |
| Custom project | `npx shadcn@latest create` | Pick library (Radix/Base UI), style, theme, fonts |
| Check updates | `npx shadcn@latest diff [component]` | Shows upstream changes for your components |
| Search registry | `npx shadcn@latest search @registry` | Browse and install from namespaced registries |
| Build registry | `npx shadcn@latest build` | Generate registry JSON from `registry.json` |
| Theme tokens | `:root` vars + `@theme inline` mapping | oklch color values, dark mode via `.dark` class |
| Dark mode | `@custom-variant dark (&:is(.dark *))` | Swaps CSS variables under `.dark` selector |
| Component variant | `cva()` from `class-variance-authority` | Type-safe variant definitions |
| Polymorphic slot | `asChild` prop with `<Slot>` from Radix | Merge props onto child element |
| Direct ref | `ref` as a regular prop | `forwardRef` is deprecated in React 19 |
| Form (current) | `<Field />` + React Hook Form + Zod | Replaces legacy `<Form />` component |
| Form (legacy) | `<Form />` + `<FormField />` + Zod | Still works but no longer actively developed |
| Class merging | `cn()` utility wrapping `clsx` + `twMerge` | Safely merge Tailwind classes without conflicts |
| Toast / notification | Sonner (`npx shadcn@latest add sonner`) | Default notification approach; auto-dismiss, stacking |
| Init with blocks | `npx shadcn@latest init sidebar-01` | Bootstrap project with pre-built page blocks |
| RTL support | `dir="rtl"` on root element | Built-in RTL layout support for all components |
| New components | `Spinner`, `Kbd`, `ButtonGroup` | Recently added utility and layout components |
## Common Mistakes
| Mistake | Correct Pattern |
| --------------------------------------------------------- | ----------------------------------------------------------------------- |
| Installing shadcn/ui as an npm dependency | Use the CLI (`npx shadcn@latest add`) to copy source into your project |
| Using `forwardRef` with React 19 components | Pass `ref` directly as a prop -- `forwardRef` is deprecated in React 19 |
| Using HSL values for color tokens | Use oklch format: `--primary: oklch(0.205 0 0)` |
| Wrapping variables with `hsl()` or `oklch()` in utilities | Reference CSS variables directly: `var(--primary)` |
| Putting tokens directly in `@theme {}` | Use `:root` for values + `@theme inline` to map them to Tailwind |
| Using legacy `<Form />` for new forms | Use `<Field />` component with React Hook Form or TanStack Form |
| Skipping Zod validation in form components | Always pair forms with Zod schemas for type-safe validation |
| Using `div` elements for interactive controls | Use Radix or Base UI primitives for semantic HTML and accessibility |
| Modifying components in `node_modules` | Components live in your source tree -- own and customize directly |
| Using old CLI command `shadcn-ui@canary` | Use `npx shadcn@latest` for all CLI operations |
## Delegation
- **Component discovery and primitive lookup**: Use `Explore` agent
- **Theme migration or multi-file refactoring**: Use `Task` agent
- **Design system architecture planning**: Use `Plan` agent
- **Registry setup and distribution**: Use `Task` agent
> If the `tanstack-form` skill is available, delegate advanced form state management (array fields, linked fields, async validation) to it.
> If the `tailwind` skill is available, delegate utility class patterns and design token architecture to it.
## References
- [Theming and dark mode](references/theming-and-dark-mode.md)
- [Component patterns and variants](references/component-patterns.md)
- [Form patterns with Field, React Hook Form, and Zod](references/form-patterns.md)
- [CLI and registry](references/cli-and-registry.md)
© oakoss · MIT · oakoss/agent-skills
Похожие скиллы
Все скиллы по теме «Фронтенд и UI» →Сначала — shadcn-ui от других авторов.