技能 ckm:ui-styling
🎨

ckm:ui-styling

低风险 ⚙️ 外部命令⚡ 包含脚本📁 文件系统访问

UI 样式工具包 - shadcn/ui、Tailwind CSS 与 Canvas 设计系统

通过将 shadcn/ui 的可访问组件库与 Tailwind CSS 实用优先样式及基于 Canvas 的可视化设计系统相结合,消除 UI 开发摩擦。本技能提供 40+ 个 shadcn/ui 组件的全面参考文档、主题及深色模式方案、可访问性指南、响应式设计实用工具,以及用于组件安装和 Tailwind 配置生成的 Python 自动化脚本。

支持: Claude Codex Code(CC)
🥉 75 青铜
1

下载技能 ZIP

2

在 Claude 中上传

前往 设置 → 功能 → 技能 → 上传技能

3

开启并开始使用

测试它

正在使用“ckm:ui-styling”。 安装 shadcn/ui 的 button、card 和 dialog 组件,并展示一个基于 card 的设置面板

预期结果:

```bash
npx shadcn@latest add button card dialog
```

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

export function SettingsPanel() {
return (
<div className="container mx-auto p-6 space-y-6">
<Card>
<CardHeader>
<CardTitle>Profile Settings</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<p className="text-sm text-muted-foreground">
Manage your account settings and preferences
</p>
<Dialog>
<DialogTrigger asChild>
<Button variant="outline">Edit Profile</Button>
</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Edit Profile</DialogTitle>
</DialogHeader>
<div className="space-y-4 py-4">
<p className="text-sm text-muted-foreground">
Profile editing form content here
</p>
<Button className="w-full">Save Changes</Button>
</div>
</DialogContent>
</Dialog>
</CardContent>
</Card>
</div>
)
}
```

正在使用“ckm:ui-styling”。 使用 shadcn/ui 创建一个兼容深色模式的响应式导航头部

预期结果:

```tsx
import { Button } from "@/components/ui/button"
import {
NavigationMenu,
NavigationMenuList,
NavigationMenuItem,
NavigationMenuLink,
} from "@/components/ui/navigation-menu"
import { Moon, Sun } from "lucide-react"
import { useTheme } from "next-themes"

export function Header() {
const { theme, setTheme } = useTheme()

return (
<header className="sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60">
<div className="container flex h-16 items-center justify-between">
<NavigationMenu>
<NavigationMenuList>
<NavigationMenuItem>
<NavigationMenuLink className="font-bold text-xl">
Logo
</NavigationMenuLink>
</NavigationMenuItem>
</NavigationMenuList>
</NavigationMenu>
<Button
variant="ghost"
size="icon"
onClick={() => setTheme(theme === "dark" ? "light" : "dark")}
>
<Sun className="h-5 w-5 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />
<Moon className="absolute h-5 w-5 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" />
</Button>
</div>
</header>
)
}
```

安全审计

低风险
v1 • 5/26/2026

This skill is safe to publish. It provides UI component documentation and styling guidance. The only executable code is two Python utility scripts: shadcn_add.py (installs shadcn/ui components via npx subprocess) and tailwind_config_gen.py (generates Tailwind CSS config files). The subprocess.run() calls in shadcn_add.py use hardcoded command arguments (npx shadcn@latest add) with dry-run support, making them low-risk. All 770 static analysis findings were reviewed - the vast majority are false positives from font license files (SIL OFL text with URLs), SQLite coverage database binary data, and documentation markdown files containing code examples. No obfuscation, network callbacks, credential access, or dangerous code injection patterns were found.

44
已扫描文件
7,414
分析行数
5
发现项
1
审计总数
低风险问题 (2)
External command execution via subprocess.run
shadcn_add.py uses subprocess.run() to execute npx for installing shadcn/ui components. The commands are hardcoded to 'npx shadcn@latest add [components]' which is expected behavior for a component installer. A dry-run mode prevents actual execution. Risk is low because: (1) the command base is hardcoded, (2) it only adds shadcn/ui components, (3) dry-run flag is available, and (4) the skill is only invoked by AI assistants where the user has already consented to tool execution.
Script filesystem write operations
tailwind_config_gen.py writes configuration files to disk and reads from the filesystem. shadcn_add.py reads components.json config and writes component files via npx. These are intentional, documented features for legitimate project configuration.
审计者: claude

质量评分

68
架构
100
可维护性
87
内容
39
社区
86
安全
74
规范符合性

你能构建什么

构建管理后台

使用 shadcn/ui 组件和 Tailwind 工具类,快速搭建包含数据表格、导航菜单、带验证的表单和响应式卡片布局的管理界面。

实施设计系统

通过生成包含自定义颜色、字体、间距和断点的 Tailwind 配置,在项目中建立一致的设计令牌,并将其应用到 shadcn/ui 主题化组件中。

创建无障碍表单

使用 shadcn/ui 表单组件、react-hook-form 进行验证,以及符合 ARIA 标准的键盘导航和屏幕阅读器模式,构建具有完整无障碍支持的生产级表单。

快速 UI 原型设计

按需安装 shadcn/ui 组件,应用响应式 Tailwind 布局,使用工具类迭代可视化设计,无需编写自定义 CSS,快速实现 UI 概念原型。

视觉品牌素材

使用 Canvas 设计系统模式生成基于 Canvas 的可视化设计作品、海报和品牌素材,并可访问精选字体搭配和设计理念指导。

试试这些提示

安装并使用 shadcn/ui 组件
为我的项目安装以下 shadcn/ui 组件:[button, card, dialog, form, table]。然后展示一个完整的用法示例,将它们组合成具有合理布局和深色模式支持的[仪表盘页面/设置面板/数据视图]。
生成自定义 Tailwind 配置
为我的 [Next.js / Vite / Astro] 项目生成 tailwind.config.ts:自定义调色板 [主色: 蓝色, 强调色: 紫色],字体 [正文使用 Inter, 等宽使用 JetBrains Mono],自定义间距 [18: 4.5rem, 22: 5.5rem],以及额外断点 [3xl: 1920px]。包含推荐的插件。
构建带深色模式的响应式布局
使用 shadcn/ui 组件创建响应式[仪表盘/落地页/设置面板]布局:移动优先的响应式网格、深色模式切换开关、支持键盘导航的可访问导航、以及正确的语义化 HTML 结构。
无障碍表单实现
使用 shadcn/ui 表单组件构建无障碍[注册/联系/结账]表单:使用 zod 进行字段验证、错误状态处理、提交时加载状态、面向屏幕阅读器的 ARIA 标签、键盘 Tab 顺序和焦点管理。
Canvas 视觉设计组合
使用设计系统理念创建基于 Canvas 的[海报/品牌图形/插画]:精致的调色板、排版层次、空间构图和博物馆级的视觉冲击力。尽量少用文字。

最佳实践

  • 从简单、可组合的 shadcn/ui 原语构建复杂 UI,而非创建单体组件
  • 直接在 JSX 中使用 Tailwind 工具类;仅在相同模式出现 3 次以上时才提取可复用组件
  • 采用移动优先的响应式设计:从基础移动端样式开始,然后叠加响应式变体(sm:、md:、lg:)
  • 充分利用 Radix UI 内置的无障碍功能;始终添加可见的焦点指示器并使用语义化 HTML
  • 维护一致的设计令牌:使用 tailwind.config 中定义的间距体系、调色板和排版系统
  • 对所有主题化元素一致地应用 dark: 变体,防止出现半主题化的深色模式
  • 通过避免动态构建类名,充分利用 Tailwind 的自动 CSS 清除功能
  • 对 shadcn/ui 组件使用完整的 TypeScript 类型安全,以获得更好的开发体验并尽早捕获错误
  • 让视觉设计引导注意力分配;有目的地使用间距、颜色和排版层次
  • 将 UI 视为一门工艺,每个细节都很重要——从微交互到色彩对比度

避免

  • 使用字符串拼接动态构建 Tailwind 类名(如 `bg-${color}-500`),这会阻止 CSS 清除;应使用完整类名或 safelist 配置选项
  • 直接覆盖 shadcn/ui 组件源文件,而不是使用 CSS 变量主题系统或 variant slots
  • 在组件提取中嵌套使用 Tailwind @apply 指令,导致产生特异性冲突
  • 在 shadcn/ui 的 Dialog 或 Drawer 组件已提供可访问、经过测试的弹窗时,仍自行构建自定义弹窗/对话框实现
  • 通过复制整个组件树来应用深色模式;应在单个工具类上使用 dark: 变体前缀
  • 在项目中同时包含 .js 和 .ts 的 tailwind 配置文件(应只保留一个生效)
  • 在未先执行 `npx shadcn@latest init` 初始化的情况下运行 shadcn/ui 组件安装——components.json 配置是必需的
  • 将 Canvas API 用于布局和结构,而非其预期用途:视觉设计组合和图形绘制
  • 在非按钮元素上实现自定义点击处理程序时,忽略键盘用户所需的 focus-visible 样式

常见问题

使用此技能前需要安装什么吗?
需要。本技能提供参考文档和自动化脚本,但实际的 shadcn/ui 组件需要安装到您的项目中。您需要:Node.js(用于 npx)、一个 React/Next.js/Vite 项目,并且应首先运行 `npx shadcn@latest init` 来设置配置。Python 自动化脚本需要 Python 3.x,但无需外部依赖。
此技能是否适用于 React 以外的框架?
shadcn/ui 主要面向基于 React 的框架(Next.js、Vite、Remix、Astro)构建。Tailwind CSS 参考和 Canvas 设计系统与框架无关。配置生成器支持 React、Vue、Svelte 和 Next.js 框架的内容路径。
自动化脚本可以在生产 CI/CD 中使用吗?
脚本包含 --dry-run 标志,可显示将要执行的操作而不实际进行更改。组件安装器(shadcn_add.py)运行 npx 从 npm 获取资源。在生产 CI 环境中,您可能需要固定 shadcn 版本或使用离线镜像。
包含的 Canvas 字体是什么?我可以在我的网站上使用它们吗?
canvas-fonts/ 目录包含 TTF 字体文件及其 SIL Open Font License (OFL) 许可文本文件。这些字体采用 SIL OFL 许可,允许自由使用、修改和再分发。它们旨在用于此技能中的基于 Canvas 的视觉设计组合。
此技能在敏感项目中使用安全吗?
可以。该技能已通过安全审计,被评为低风险。唯一执行的外部命令是 `npx shadcn@latest add`(组件安装),使用硬编码的命令。所有 Python 脚本都包含 dry-run 模式。不执行环境变量、网络回调或凭据访问。未发现混淆代码。

开发者详情

文件结构

📁 canvas-fonts/

📄 ArsenalSC-OFL.txt

📄 ArsenalSC-Regular.ttf

📄 BigShoulders-Bold.ttf

📄 BigShoulders-OFL.txt

📄 BigShoulders-Regular.ttf

📄 Boldonse-OFL.txt

📄 Boldonse-Regular.ttf

📄 BricolageGrotesque-Bold.ttf

📄 BricolageGrotesque-OFL.txt

📄 BricolageGrotesque-Regular.ttf

📄 CrimsonPro-Bold.ttf

📄 CrimsonPro-Italic.ttf

📄 CrimsonPro-OFL.txt

📄 CrimsonPro-Regular.ttf

📄 DMMono-OFL.txt

📄 DMMono-Regular.ttf

📄 EricaOne-OFL.txt

📄 EricaOne-Regular.ttf

📄 GeistMono-Bold.ttf

📄 GeistMono-OFL.txt

📄 GeistMono-Regular.ttf

📄 Gloock-OFL.txt

📄 Gloock-Regular.ttf

📄 IBMPlexMono-Bold.ttf

📄 IBMPlexMono-OFL.txt

📄 IBMPlexMono-Regular.ttf

📄 IBMPlexSerif-Bold.ttf

📄 IBMPlexSerif-BoldItalic.ttf

📄 IBMPlexSerif-Italic.ttf

📄 IBMPlexSerif-Regular.ttf

📄 InstrumentSans-Bold.ttf

📄 InstrumentSans-BoldItalic.ttf

📄 InstrumentSans-Italic.ttf

📄 InstrumentSans-OFL.txt

📄 InstrumentSans-Regular.ttf

📄 InstrumentSerif-Italic.ttf

📄 InstrumentSerif-Regular.ttf

📄 Italiana-OFL.txt

📄 Italiana-Regular.ttf

📄 JetBrainsMono-Bold.ttf

📄 JetBrainsMono-OFL.txt

📄 JetBrainsMono-Regular.ttf

📄 Jura-Light.ttf

📄 Jura-Medium.ttf

📄 Jura-OFL.txt

📄 LibreBaskerville-OFL.txt

📄 LibreBaskerville-Regular.ttf

📄 Lora-Bold.ttf

📄 Lora-BoldItalic.ttf

📄 Lora-Italic.ttf

📄 Lora-OFL.txt

📄 Lora-Regular.ttf

📄 NationalPark-Bold.ttf

📄 NationalPark-OFL.txt

📄 NationalPark-Regular.ttf

📄 NothingYouCouldDo-OFL.txt

📄 NothingYouCouldDo-Regular.ttf

📄 Outfit-Bold.ttf

📄 Outfit-OFL.txt

📄 Outfit-Regular.ttf

📄 PixelifySans-Medium.ttf

📄 PixelifySans-OFL.txt

📄 PoiretOne-OFL.txt

📄 PoiretOne-Regular.ttf

📄 RedHatMono-Bold.ttf

📄 RedHatMono-OFL.txt

📄 RedHatMono-Regular.ttf

📄 Silkscreen-OFL.txt

📄 Silkscreen-Regular.ttf

📄 SmoochSans-Medium.ttf

📄 SmoochSans-OFL.txt

📄 Tektur-Medium.ttf

📄 Tektur-OFL.txt

📄 Tektur-Regular.ttf

📄 WorkSans-Bold.ttf

📄 WorkSans-BoldItalic.ttf

📄 WorkSans-Italic.ttf

📄 WorkSans-OFL.txt

📄 WorkSans-Regular.ttf

📄 YoungSerif-OFL.txt

📄 YoungSerif-Regular.ttf

📁 references/

📄 canvas-design-system.md

📄 shadcn-accessibility.md

📄 shadcn-components.md

📄 shadcn-theming.md

📄 tailwind-customization.md

📄 tailwind-responsive.md

📄 tailwind-utilities.md

📁 scripts/

📁 tests/

📄 coverage-ui.json

📄 requirements.txt

📄 test_shadcn_add.py

📄 test_tailwind_config_gen.py

📄 requirements.txt

📄 shadcn_add.py

📄 tailwind_config_gen.py

📄 LICENSE.txt

📄 SKILL.md