技能 ckm:ui-styling
🎨

ckm:ui-styling

低風險 ⚙️ 外部命令⚡ 包含腳本📁 檔案系統存取

UI 樣式工具集 - shadcn/ui、Tailwind CSS 與 Canvas 設計

透過結合 shadcn/ui 的可存取元件庫、Tailwind CSS 的 utility-first 樣式設計與基於 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 元件,並展示一個以卡片為基礎的設定面板

預期結果:

```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 元件建立響應式[儀表板 / 登陸頁面 / 設定面板]版面,需包含:mobile-first 響應式網格、深色模式切換、支援鍵盤操作的無障礙導航,以及正確的語意化 HTML 結構。
無障礙表單實作
使用 shadcn/ui 表單元件建立無障礙[註冊 / 聯絡 / 結帳]表單,需包含:使用 zod 進行欄位驗證、錯誤狀態處理、送出時的載入狀態、螢幕閱讀器適用的 ARIA 標籤、鍵盤 Tab 順序與焦點管理。
Canvas 視覺組合物
根據設計系統理念建立基於 canvas 的視覺[海報 / 品牌圖像 / 插圖],需包含:精緻的色彩調色盤、字型排版層級、空間構圖,以及博物館級的視覺衝擊力。使用最少文字。

最佳實務

  • 從簡單、可組合的 shadcn/ui 基礎元件開始建構複雜 UI,而非打造單一大型元件
  • 直接在 JSX 中使用 Tailwind 工具類別;僅在相同模式出現 3 次以上時才提取為可重複使用元件
  • 採用 mobile-first 響應式設計:從基本行動版樣式開始,再疊加響應式變體(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 指令,導致特殊性衝突
  • 自行建置自訂 modal/dialog 實作,而 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/CD 環境中,您可能希望固定 shadcn 版本或使用離線鏡像。
內含的 canvas 字型是什麼,我可以在我的網站上使用它們嗎?
canvas-fonts/ 目錄包含 TTF 字型檔案及其 SIL Open Font License(OFL)授權文字檔。這些字型採用 SIL OFL 授權,允許自由使用、修改與重新散布。它們專供此技能中的基於 canvas 的視覺設計組合物使用。
這項技能在敏感專案中使用安全嗎?
可以。此技能已通過安全稽核,風險評級為低。唯一執行的外部指令是 `npx shadcn@latest add`(元件安裝),使用的是硬編碼指令。所有 Python 腳本都提供乾執行模式。不會存取環境變數、網路回呼或憑證。未發現任何混淆過的程式碼。

開發者詳情

檔案結構

📁 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