跳到主内容
智客 ZICQ

技能库 智客分类:Agent 工作流 shadcn-ui

Shadcn Ui

提供完整的shadcn/ui组件库模式,包括安装,配置,以及实施可访问的React组件. 在设置shadcn/ui时使用,安装组件,用回钩形式和Zod构建窗体,用Tailwind CSS定制主题,或者执行UI模式,如按钮,对话框,下拉,表格,以及复杂的形式布局等.

22719 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

提供完整的shadcn/ui组件库模式,包括安装、配置和执行可访问的React组件

何时用

在用户请求涉及下列事项时激活:

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:shadcn/ui Component Patterns、Overview、When to Use、Quick Reference、Available Components、Instructions。

文件分析

文件分析:除 SKILL.md 外,正文引用了 references/forms-and-validation.md、references/charts-components.md、references/setup-and-configuration.md、references/ui-components.md,属于带资源的技能包,这些文件按需再读。

官方 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.

shadcn/ui Component PatternsOverviewWhen to UseQuick ReferenceAvailable ComponentsInstructionsInitialize ProjectNew Next.js projectExisting projectInstall componentsBasic Component UsageForm with Zod Validation

· allowed-tools:Read, Write, Bash, Edit, Glob

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
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实验字段,支持情况取决于客户端;字段声明本身不会授予工具权限。
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。
指令中引用的文件 · 4
  • references/forms-and-validation.md
  • references/charts-components.md
  • references/setup-and-configuration.md
  • references/ui-components.md

以下路径提取自原文;文件是否齐全请以来源仓库中的完整目录为准。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

该技能引用了附属文件,请从来源获取完整目录;仅复制 SKILL.md 可能缺少依赖。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「shadcn-ui」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-969ab483edf73ca0-Shadcn-Ui.html
请存为 .cursor/skills/shadcn-ui/SKILL.md 或 .claude/skills/shadcn-ui/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。
该技能还带 scripts/、references/、assets/ 等文件,请从 https://github.com/giuseppe-trisciuoglio/developer-kit 取完整目录,不要只建一个 SKILL.md。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/giuseppe-trisciuoglio/developer-kit' --list

npx skills add 'https://github.com/giuseppe-trisciuoglio/developer-kit' --skill 'shadcn-ui'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版
--- 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 ` ## 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" Default Delete Loading... ``` ### 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>({ resolver: zodResolver(formSchema), defaultValues: { email: "", password: "" }, }) return ( ( Email )} /> ( Password )} /> Login ) } ``` 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" Open Edit Profile {/* content */} ``` ### Toast Notification ```tsx // 1. Add 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 } /> ``` 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>({ resolver: zodResolver(formSchema), defaultValues: { email: "", password: "" }, }) return ( ( Email )} /> ( Password )} /> Login ) } ``` ### 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[] = [ { id: "select", header: ({ table }) => ( ), cell: ({ row }) => ( )}, { accessorKey: "name", header: "Name" }, { accessorKey: "email", header: "Email" }, { id: "actions", cell: ({ row }) => ( Edit )}, ] ``` ### Dialog with Form ```tsx import { Button } from "@/components/ui/button" import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog" Add User Add New User {/* */} ``` ### 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 `` 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

相关技能

Agent 工作流

Skill Creator

创造有效技能指南。 当用户想创造出新的技能(或更新现有的技能),以专业知识,工作流程,或工具集成来扩展克洛德的能力时,应该使用这种技能.

Agent 工作流

Clawdhub

使用ClawdHub CLI搜索,安装,更新并发布从taladhub.com的代理技能. 需要获取苍蝇上的新技能时使用,将安装的技能同步到最新版本或特定版本,或者发布 npm-instainddhub CLI 的新/更新的技能文件夹.

Agent 工作流

Agent Team Orchestration

管弦乐团多代理团队,任务设定周期,交接协议,审查工作流程. 使用时间: (1)建立2+特派员队伍,具有不同专业,(2)确定任务路线和生命周期(收录框_ spec_建设_审查_完成),(3)在特派员之间制定交接协议,(4)建立审查和质量关口,(5)管理特派员之间的交流和文物共享.

Agent 工作流

Superpowers

Spec-first,TDD,子代理驱动的软件开发工作流程. 当:(1)构建任何新功能或应用——触发脑暴_计划_子代理执行回路,(2)调试出一个bug或测试失败——触发系统性的根起过程,(3)用户说"让我们构建","帮助我计划","我想添加X",或"这个被打破",(4)完成一个功…