Communitygithub.com

網頁UI排版與視覺設計技能

使用 shadcn/ui 元件(基於 Radix UI + Tailwind)、Tailwind CSS 工具優先樣式與基於畫布的視覺設計,建立美觀、易於存取的使用者介面。適用於建構 UI、實作設計系統、建立響應式版面、加入可存取元件(對話框、下拉選單、表單、表格)、自訂主題與色彩、實作深色模式、產生視覺設計與海報,或建立一致樣式模式。

網頁UI排版與視覺設計技能 是什麼?

此技能整合 shadcn/ui、Tailwind CSS 與 Canvas 視覺設計系統,協助開發者快速建立美觀且可存取的 React 使用者介面。它支援基於 React 的架構(如 Next.js、Vite、Remix、Astro),並提供完整的元件庫、佈局工具、主題自訂、深色模式及視覺設計哲學。技能文件詳細說明從安裝、元件使用、表單驗證、響應式設計到高級主題配置的完整流程,並包含大量可複製的程式碼範例與最佳實踐。開發者可透過 CLI 指令初始化專案、安裝元件,並利用工具優先樣式與 Radix UI 的可存取性原語,快速建構一致且專業的 UI。此外,技能還提供 Python 自動化腳本,用於批次安裝元件與產生 Tailwind 設定檔,進一步提升開發效率。

相容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/tmnhutwork/Landingpage-Photo-Retouch/tree/HEAD/.agents/skills/ui-styling

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

UI 樣式技能

整合 shadcn/ui 元件、Tailwind CSS 工具優先樣式與基於畫布的視覺設計系統,建立美觀且易於存取的使用者介面的綜合技能。

參考資料

使用時機

適用於:

  • 使用基於 React 的框架(Next.js、Vite、Remix、Astro)建構 UI
  • 實作可存取元件(對話框、表單、表格、導航)
  • 採用工具優先 CSS 方法進行樣式設計
  • 建立響應式、行動優先的版面
  • 實作深色模式與主題自訂
  • 使用一致設計代幣建構設計系統
  • 產生視覺設計、海報或品牌素材
  • 透過即時視覺反饋進行快速原型設計
  • 加入複雜 UI 模式(資料表格、圖表、指令面板)

核心技術棧

元件層:shadcn/ui

  • 透過 Radix UI 原語提供預建的可存取元件
  • 複製貼上分發模式(元件存在於你的程式碼庫中)
  • 優先使用 TypeScript,具備完整型別安全
  • 可組合的原語用於複雜 UI
  • 基於 CLI 的安裝與管理

樣式層:Tailwind CSS

  • 工具優先的 CSS 框架
  • 建置時處理,零執行時開銷
  • 行動優先的響應式設計
  • 一致的設計代幣(顏色、間距、排版)
  • 自動清除未使用的程式碼

視覺設計層:Canvas

  • 博物館品質的視覺構圖
  • 哲學驅動的設計方法
  • 精緻的視覺溝通
  • 最少文字,最大視覺衝擊
  • 系統化模式與精煉美學

快速入門

元件 + 樣式設定

使用 Tailwind 安裝 shadcn/ui:

npx shadcn@latest init

CLI 會提示框架、TypeScript、路徑和主題偏好。這將同時配置 shadcn/ui 和 Tailwind CSS。

加入元件:

npx shadcn@latest add button card dialog form

使用工具樣式搭配元件:

import { Button } from "@/components/ui/button"
import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card"

export function Dashboard() {
  return (
    <div className="container mx-auto p-6 grid gap-6 md:grid-cols-2 lg:grid-cols-3">
      <Card className="hover:shadow-lg transition-shadow">
        <CardHeader>
          <CardTitle className="text-2xl font-bold">分析</CardTitle>
        </CardHeader>
        <CardContent className="space-y-4">
          <p className="text-muted-foreground">查看您的指標</p>
          <Button variant="default" className="w-full">
            檢視詳細
          </Button>
        </CardContent>
      </Card>
    </div>
  )
}

替代方案:純 Tailwind 設定

Vite 專案:

npm install -D tailwindcss @tailwindcss/vite
// vite.config.ts
import tailwindcss from '@tailwindcss/vite'
export default { plugins: [tailwindcss()] }
/* src/index.css */
@import "tailwindcss";

元件庫指南

完整的元件目錄,包含使用模式、安裝方法與組合範例。

詳見:references/shadcn-components.md

涵蓋:

  • 表單與輸入元件(Button、Input、Select、Checkbox、DatePicker、表單驗證)
  • 版面與導航(Card、Tabs、Accordion、Navigation Menu)
  • 覆蓋層與對話框(Dialog、Drawer、Popover、Toast、Command)
  • 反饋與狀態(Alert、Progress、Skeleton)
  • 顯示元件(Table、Data Table、Avatar、Badge)

主題與自訂

主題設定、CSS 變數、深色模式實作與元件自訂。

詳見:references/shadcn-theming.md

涵蓋:

  • 使用 next-themes 設定深色模式
  • CSS 變數系統
  • 顏色自訂與色板
  • 元件變體自訂
  • 主題切換實作

可存取性模式

ARIA 模式、鍵盤導覽、螢幕閱讀器支援與可存取元件用法。

詳見:references/shadcn-accessibility.md

涵蓋:

  • Radix UI 可存取性功能
  • 鍵盤導覽模式
  • 焦點管理
  • 螢幕閱讀器宣告
  • 表單驗證可存取性

Tailwind 工具

用於版面、間距、排版、顏色、邊框與陰影的核心工具類別。

詳見:references/tailwind-utilities.md

涵蓋:

  • 版面工具(Flexbox、Grid、定位)
  • 間距系統(padding、margin、gap)
  • 排版(字型大小、字重、對齊、行高)
  • 顏色與背景
  • 邊框與陰影
  • 自訂樣式的任意值

響應式設計

行動優先中斷點、響應式工具與適應性版面。

詳見:references/tailwind-responsive.md

涵蓋:

  • 行動優先方法
  • 中斷點系統(sm、md、lg、xl、2xl)
  • 響應式工具模式
  • 容器查詢
  • 最大寬度查詢
  • 自訂中斷點

Tailwind 自訂

設定檔結構、自訂工具、外掛與主題擴充。

詳見:references/tailwind-customization.md

涵蓋:

  • @theme 指令用於自訂代幣
  • 自訂顏色與字型
  • 間距與中斷點擴充
  • 自訂工具建立
  • 自訂變體
  • 圖層組織(@layer base、components、utilities)
  • Apply 指令用於元件擷取

視覺設計系統

基於 Canvas 的設計哲學、視覺溝通原則與精緻構圖。

詳見:references/canvas-design-system.md

涵蓋:

  • 設計哲學方法
  • 視覺溝通優先於文字
  • 系統化模式與構圖
  • 顏色、形狀與空間設計
  • 最小文字整合
  • 博物館品質執行
  • 多頁設計系統

工具腳本

用於元件安裝與設定產生的 Python 自動化工具。

shadcn_add.py

加入 shadcn/ui 元件並處理依賴:

python scripts/shadcn_add.py button card dialog

tailwind_config_gen.py

產生含有自訂主題的 tailwind.config.js:

python scripts/tailwind_config_gen.py --colors brand:blue --fonts display:Inter

最佳實踐

  1. 元件組合:從簡單、可組合的原語建構複雜 UI
  2. 工具優先樣式:直接使用 Tailwind 類別;僅在真正重複時才擷取為元件
  3. 行動優先響應式:從行動樣式開始,分層加入響應式變體
  4. 可存取性優先:利用 Radix UI 原語,加入焦點狀態,使用語意化 HTML
  5. 設計代幣:使用一致的間距比例、顏色色板、排版系統
  6. 深色模式一致性:將深色變體套用至所有主題元素
  7. 效能:利用自動 CSS 清除,避免動態類別名稱
  8. TypeScript:使用完整型別安全以獲得更好的開發體驗
  9. 視覺層級:讓構圖引導注意力,有意識地使用間距與顏色
  10. 專家工藝:每個細節都很重要——將 UI 視為一門工藝

參考導航

元件庫

  • references/shadcn-components.md - 完整元件目錄
  • references/shadcn-theming.md - 主題與自訂
  • references/shadcn-accessibility.md - 可存取性模式

樣式系統

  • references/tailwind-utilities.md - 核心工具類別
  • references/tailwind-responsive.md - 響應式設計
  • references/tailwind-customization.md - 設定與擴充

視覺設計

  • references/canvas-design-system.md - 設計哲學與 Canvas 工作流程

自動化

  • scripts/shadcn_add.py - 元件安裝
  • scripts/tailwind_config_gen.py - 設定產生

常見模式

含驗證的表單:

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

const schema = z.object({
  email: z.string().email(),
  password: z.string().min(8)
})

export function LoginForm() {
  const form = useForm({
    resolver: zodResolver(schema),
    defaultValues: { email: "", password: "" }
  })

  return (
    <Form {...form}>
      <form onSubmit={form.handleSubmit(console.log)} className="space-y-6">
        <FormField control={form.control} name="email" render={({ field }) => (
          <FormItem>
            <FormLabel>電子郵件</FormLabel>
            <FormControl>
              <Input type="email" {...field} />
            </FormControl>
            <FormMessage />
          </FormItem>
        )} />
        <Button type="submit" className="w-full">登入</Button>
      </form>
    </Form>
  )
}

含深色模式的響應式版面:

<div className="min-h-screen bg-white dark:bg-gray-900">
  <div className="container mx-auto px-4 py-8">
    <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
      <Card className="bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700">
        <CardContent className="p-6">
          <h3 className="text-xl font-semibold text-gray-900 dark:text-white">
            內容
          </h3>
        </CardContent>
      </Card>
    </div>
  </div>
</div>

資源

Individual skills in this repo

This repo contains 15 individual skills — each has its own dedicated page.

tmnhutwork/Landingpage-Photo-Retouch

Run a WCAG 2.1 AA accessibility audit on a design or page. Trigger with "audit accessibility", "check a11y", "is this accessible?", or when reviewing a design for color contrast, keyboard navigation, touch target size, or screen reader behavior before handoff.

tmnhutwork/Landingpage-Photo-Retouch

Get structured design feedback on usability, hierarchy, and consistency. Trigger with "review this design", "critique this mockup", "what do you think of this screen?", or when sharing a Figma link or screenshot for feedback at any stage from exploration to final polish.

tmnhutwork/Landingpage-Photo-Retouch

Generate developer handoff specs from a design. Use when a design is ready for engineering and needs a spec sheet covering layout, design tokens, component props, interaction states, responsive breakpoints, edge cases, and animation details.

tmnhutwork/Landingpage-Photo-Retouch

Audit, document, or extend your design system. Use when checking for naming inconsistencies or hardcoded values across components, writing documentation for a component's variants, states, and accessibility notes, or designing a new pattern that fits the existing system.

tmnhutwork/Landingpage-Photo-Retouch

Synthesize user research into themes, insights, and recommendations. Use when you have interview transcripts, survey results, usability test notes, support tickets, or NPS responses that need to be distilled into patterns, user segments, and prioritized next steps.

tmnhutwork/Landingpage-Photo-Retouch

Plan, conduct, and synthesize user research. Trigger with "user research plan", "interview guide", "usability test", "survey design", "research questions", or when the user needs help with any aspect of understanding their users through research.

tmnhutwork/Landingpage-Photo-Retouch

Write or review UX copy — microcopy, error messages, empty states, CTAs. Trigger with "write copy for", "what should this button say?", "review this error message", or when naming a CTA, wording a confirmation dialog, filling an empty state, or writing onboarding text.

tmnhutwork/Landingpage-Photo-Retouch

Design banners for social media, ads, website heroes, creative assets, and print. Multiple art direction options with AI-generated visuals. Actions: design, create, generate banner. Platforms: Facebook, Twitter/X, LinkedIn, YouTube, Instagram, Google Display, website hero, print. Styles: minimalist, gradient, bold typography, photo-based, illustrated, geometric, retro, glassmorphism, 3D, neon, duotone, editorial, collage. Uses ui-ux-pro-max, frontend-design, ai-artist, ai-multimodal skills.

tmnhutwork/Landingpage-Photo-Retouch

Brand voice, visual identity, messaging frameworks, asset management, brand consistency. Activate for branded content, tone of voice, marketing assets, brand compliance, style guides.

tmnhutwork/Landingpage-Photo-Retouch

Comprehensive design skill: brand identity, design tokens, UI styling, logo generation (55 styles, Gemini AI), corporate identity program (50 deliverables, CIP mockups), HTML presentations (Chart.js), banner design (22 styles, social/ads/web/print), icon design (15 styles, SVG, Gemini 3.1 Pro), social photos (HTML→screenshot, multi-platform). Actions: design logo, create CIP, generate mockups, build slides, design banner, generate icon, create social photos, social media images, brand identity, design system. Platforms: Facebook, Twitter, LinkedIn, YouTube, Instagram, Pinterest, TikTok, Threads, Google Ads.

tmnhutwork/Landingpage-Photo-Retouch

Audit, document, or extend your design system. Use when checking for naming inconsistencies or hardcoded values across components, writing documentation for a component's variants, states, and accessibility notes, or designing a new pattern that fits the existing system.

tmnhutwork/Landingpage-Photo-Retouch

Translates Figma designs into production-ready application code with 1:1 visual fidelity. Use when implementing UI code from Figma files, when user mentions "implement design", "generate code", "implement component", provides Figma URLs, or asks to build components matching Figma specs. For Figma canvas writes via `use_figma`, use `figma-use`.

tmnhutwork/Landingpage-Photo-Retouch

Use the Figma MCP server to fetch design context, screenshots, variables, and assets from Figma, and to translate Figma nodes into production code. Trigger when a task involves Figma URLs, node IDs, design-to-code implementation, or Figma MCP setup and troubleshooting.

tmnhutwork/Landingpage-Photo-Retouch

Create strategic HTML presentations with Chart.js, design tokens, responsive layouts, copywriting formulas, and contextual slide strategies.

tmnhutwork/Landingpage-Photo-Retouch

UI/UX design intelligence for web, mobile, and desktop. This skill should be used when designing, building, reviewing, or fixing interfaces, including pages, components, design systems, accessibility, interaction, responsive layout, typography, color, charts, and stack-specific UI implementation. Searchable local data: 79 searchable styles (50 active), 192 product palettes and reasoning profiles, 74 font pairings, 119 UX guidelines, 105 icons, 17 GSAP presets, 25 chart types, and 22 stacks.

相關技能