Token导航 LogoToken导航

Agent Skill · 前端设计

tailwind-v4-shadcn(Tailwind CSS V4 shadcn/ui 前端)

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

tailwind-v4-shadcn 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为操作浏览器;许可证为 MIT,第三方扫描已通过,按安装量在前端设计类的 10,216 个 Skill 里排第 2,573。

总安装 2,105周安装 86GitHub Stars 37下载 674核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:tailwind-v4-shadcn(Tailwind CSS V4 shadcn/ui 前端)
来源仓库:https://github.com/ovachiever/droid-tings
仓库路径:skills/tailwind-v4-shadcn
安装命令:
npx skills add https://github.com/ovachiever/droid-tings --skill tailwind-v4-shadcn
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/ovachiever/droid-tings --skill tailwind-v4-shadcn

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

tailwind-v4-shadcn 用于辅助前端页面、组件、样式和交互逻辑的开发与维护。适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码。通过 npx skills add 命令从指定 GitHub 路径安装并使用。

使用时需结合项目现有设计系统与构建方式,避免只生成孤立片段。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/tailwind-v4-shadcn

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/ovachiever/droid-tings --skill tailwind-v4-sha…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要操作浏览器,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

tailwind-v4-shadcn 怎么安装?

在终端执行 npx skills add https://github.com/ovachiever/droid-tings --skill tailwind-v4-shadcn。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

tailwind-v4-shadcn 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

tailwind-v4-shadcn 需要什么权限?

权限级别是操作浏览器。该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

tailwind-v4-shadcn 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

tailwind-v4-shadcn 用的人多吗?

公开数据是累计安装 2,105 次,近一周安装 86 次,下载 674 次,GitHub 37 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

tailwind-v4-shadcn 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理前端设计类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
frontend-design

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
tailwind-v4-shadcn

Tailwind CSS V4 shadcn/ui 前端 · 本页

2,10537操作浏览器MIT通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Tailwind v4 + shadcn/ui Production Stack

Production-tested: WordPress Auditor (https://wordpress-auditor.webfonts.workers.dev) Last Updated: 2025-11-09 Status: Production Ready ✅


⚠️ BEFORE YOU START (READ THIS!)

CRITICAL FOR AI AGENTS: If you're Claude Code helping a user set up Tailwind v4:

  1. Explicitly state you're using this skill at the start of the conversation
  2. Reference patterns from the skill rather than general knowledge
  3. Prevent known issues listed in reference/common-gotchas.md
  4. Don't guess - if unsure, check the skill documentation

USER ACTION REQUIRED: Tell Claude to check this skill first!

Say: "I'm setting up Tailwind v4 + shadcn/ui - check the tailwind-v4-shadcn skill first"

Why This Matters (Real-World Results)

Without skill activation:

  • ❌ Setup time: ~5 minutes
  • ❌ Errors encountered: 2-3 (tw-animate-css, duplicate @layer base)
  • ❌ Manual fixes needed: 2+ commits
  • ❌ Token usage: ~65k
  • ❌ User confidence: Required debugging

With skill activation:

  • ✅ Setup time: ~1 minute
  • ✅ Errors encountered: 0
  • ✅ Manual fixes needed: 0
  • ✅ Token usage: ~20k (70% reduction)
  • ✅ User confidence: Instant success

Known Issues This Skill Prevents

  1. tw-animate-css import error (deprecated in v4)
  2. Duplicate @layer base blocks (shadcn init adds its own)
  3. Wrong template selection (vanilla TS vs React)
  4. Missing post-init cleanup (incompatible CSS rules)
  5. Wrong plugin syntax (using @import or require() instead of @plugin directive)

All of these are handled automatically when the skill is active.


Quick Start (5 Minutes - Follow This Exact Order)

1. Install Dependencies

pnpm add tailwindcss @tailwindcss/vite
pnpm add -D @types/node
pnpm dlx shadcn@latest init

2. Configure Vite

// vite.config.ts
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
import path from 'path'

export default defineConfig({
  plugins: [react(), tailwindcss()],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src')
    }
  }
})

3. Update components.json

{
  "tailwind": {
    "config": "",              // ← CRITICAL: Empty for v4
    "css": "src/index.css",
    "baseColor": "slate",      // Base color palette
    "cssVariables": true,
    "prefix": ""               // No prefix for utility classes
  }
}

4. Delete tailwind.config.ts

rm tailwind.config.ts  # v4 doesn't use this file

The Four-Step Architecture (CRITICAL)

This pattern is mandatory - skipping steps will break your theme.

Step 1: Define CSS Variables at Root Level

/* src/index.css */
@import "tailwindcss";

:root {
  --background: hsl(0 0% 100%);      /* ← hsl() wrapper required */
  --foreground: hsl(222.2 84% 4.9%);
  --primary: hsl(221.2 83.2% 53.3%);
  /* ... all light mode colors */
}

.dark {
  --background: hsl(222.2 84% 4.9%);
  --foreground: hsl(210 40% 98%);
  --primary: hsl(217.2 91.2% 59.8%);
  /* ... all dark mode colors */
}

Critical Rules:

  • ✅ Define at root level (NOT inside @layer base)
  • ✅ Use hsl() wrapper on all color values
  • ✅ Use .dark for dark mode (NOT .dark {@theme {}})

Step 2: Map Variables to Tailwind Utilities

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-primary: var(--primary);
  /* ... map ALL CSS variables */
}

Why This Is Required:

  • Generates utility classes (bg-background, text-primary)
  • Without this, bg-primary etc. won't exist

Step 3: Apply Base Styles

@layer base {
  body {
    background-color: var(--background);  /* NO hsl() here */
    color: var(--foreground);
  }
}

Critical Rules:

  • ✅ Reference variables directly: var(--background)
  • ❌ Never double-wrap: hsl(var(--background))

Step 4: Result - Automatic Dark Mode

<div className="bg-background text-foreground">
  {/* No dark: variants needed - theme switches automatically */}
</div>

Dark Mode Setup

1. Create ThemeProvider

See reference/dark-mode.md for full implementation or use template:

// Copy from: templates/theme-provider.tsx

2. Wrap Your App

// src/main.tsx
import { ThemeProvider } from '@/components/theme-provider'

ReactDOM.createRoot(document.getElementById('root')!).render(
  <React.StrictMode>
    <ThemeProvider defaultTheme="dark" storageKey="vite-ui-theme">
      <App />
    </ThemeProvider>
  </React.StrictMode>,
)

3. Add Theme Toggle

pnpm dlx shadcn@latest add dropdown-menu

See reference/dark-mode.md for ModeToggle component code.


Critical Rules (MUST FOLLOW)

✅ Always Do:

  1. Wrap color values with hsl() in :root and .dark --background: hsl(0 0% 100%); /* ✅ Correct */
  2. Use @theme inline to map all CSS variables @theme inline {--color-background: var(--background);}
  3. Set "tailwind.config": "" in components.json {"tailwind": {"config": ""}}
  4. Delete tailwind.config.ts if it exists
  5. Use @tailwindcss/vite plugin (NOT PostCSS)
  6. Use cn() for conditional classes import {cn} from "@/lib/utils" <div className={cn("base", isActive && "active")} />

❌ Never Do:

  1. Put :root or .dark inside @layer base /* WRONG */ @layer base {:root {--background: hsl(...);}}
  2. Use .dark {@theme {}} pattern /* WRONG - v4 doesn't support nested @theme */.dark {@theme {--color-primary: hsl(...);}}
  3. Double-wrap colors /* WRONG */ body {background-color: hsl(var(--background));}
  4. Use tailwind.config.ts for theme colors /* WRONG - v4 ignores this */ export default {theme: {extend: {colors: {primary: 'hsl(var(--primary))'}}}}
  5. Use @apply directive (deprecated in v4)
  6. Use dark: variants for semantic colors /* WRONG */ <div className="bg-primary dark:bg-primary-dark" /> /* CORRECT */ <div className="bg-primary" />

Semantic Color Tokens

Always use semantic names for colors:

:root {
  --destructive: hsl(0 84.2% 60.2%);        /* Red - errors, critical */
  --success: hsl(142.1 76.2% 36.3%);        /* Green - success states */
  --warning: hsl(38 92% 50%);               /* Yellow - warnings */
  --info: hsl(221.2 83.2% 53.3%);           /* Blue - info, primary */
}

Usage:

<div className="bg-destructive text-destructive-foreground">Critical</div>
<div className="bg-success text-success-foreground">Success</div>
<div className="bg-warning text-warning-foreground">Warning</div>
<div className="bg-info text-info-foreground">Info</div>

Common Issues & Quick Fixes

SymptomCauseFix
bg-primary doesn't workMissing @theme inline mappingAdd @theme inline block
Colors all black/whiteDouble hsl() wrappingUse var(--color) not hsl(var(--color))
Dark mode not switchingMissing ThemeProviderWrap app in <ThemeProvider>
Build failstailwind.config.ts existsDelete the file
Text invisibleWrong contrast colorsCheck color definitions in :root/.dark

See reference/common-gotchas.md for complete troubleshooting guide.


File Templates

All templates are available in the templates/ directory:

  • index.css - Complete CSS setup with all color variables
  • components.json - shadcn/ui v4 configuration
  • vite.config.ts - Vite + Tailwind plugin setup
  • tsconfig.app.json - TypeScript with path aliases
  • theme-provider.tsx - Dark mode provider with localStorage
  • utils.ts - cn() utility for class merging

Copy these files to your project and customize as needed.


Complete Setup Checklist

  • Vite + React + TypeScript project created
  • @tailwindcss/vite installed (NOT postcss)
  • vite.config.ts uses tailwindcss() plugin
  • tsconfig.json has path aliases configured
  • components.json exists with "config": ""
  • NO tailwind.config.ts file exists
  • src/index.css follows v4 pattern:

- :root and .dark at root level (not in @layer) - Colors wrapped with hsl() - @theme inline maps all variables - @layer base uses unwrapped variables

  • Theme provider installed and wrapping app
  • Dark mode toggle component created
  • Test theme switching works in browser

Advanced Topics

Custom Colors

Add new semantic colors:

:root {
  --brand: hsl(280 65% 60%);
  --brand-foreground: hsl(0 0% 100%);
}

.dark {
  --brand: hsl(280 75% 70%);
  --brand-foreground: hsl(280 20% 10%);
}

@theme inline {
  --color-brand: var(--brand);
  --color-brand-foreground: var(--brand-foreground);
}

Usage: <div className="bg-brand text-brand-foreground">Branded</div>

Migration from v3

See reference/migration-guide.md for complete v3 → v4 migration steps.

Component Best Practices

  1. Always use semantic tokens <Button variant="destructive">Delete</Button> /* ✅ */ <Button className="bg-red-600">Delete</Button> /* ❌ */
  2. Use cn() for conditional styling import {cn} from "@/lib/utils" <div className={cn("base-class", isActive && "active-class", hasError && "error-class")} />
  3. Compose shadcn/ui components <Dialog> <DialogTrigger asChild> <Button>Open</Button> </DialogTrigger> <DialogContent> <DialogHeader> <DialogTitle>Title</DialogTitle> </DialogHeader> </DialogContent> </Dialog>

Dependencies

✅ Install These

{
  "dependencies": {
    "tailwindcss": "^4.1.17",
    "@tailwindcss/vite": "^4.1.17",
    "clsx": "^2.1.1",
    "tailwind-merge": "^3.3.1",
    "@radix-ui/react-*": "latest",
    "lucide-react": "^0.553.0",
    "react": "^19.2.0",
    "react-dom": "^19.2.0"
  },
  "devDependencies": {
    "@types/node": "^24.10.0",
    "@vitejs/plugin-react": "^5.1.0",
    "vite": "^7.2.2",
    "typescript": "~5.9.0",
    "tw-animate-css": "^1.4.0"
  }
}

Animation Packages (Updated Nov 2025)

shadcn/ui has deprecated tailwindcss-animate in favor of tw-animate-css for Tailwind v4 compatibility.

✅ DO Install (v4-compatible):

pnpm add -D tw-animate-css

Then add to src/index.css:

@import "tailwindcss";
@import "tw-animate-css";

❌ DO NOT Install:

npm install tailwindcss-animate  # Deprecated - v3 only

Why: tw-animate-css is the official v4-compatible replacement for animations, required by shadcn/ui components.

Reference: https://ui.shadcn.com/docs/tailwind-v4


Tailwind v4 Plugins

Tailwind v4 supports official plugins using the @plugin directive in CSS.

Official Plugins (Tailwind Labs)

Typography Plugin - Style Markdown/CMS Content

When to use: Displaying blog posts, documentation, or any HTML from Markdown/CMS.

Installation:

pnpm add -D @tailwindcss/typography

Configuration (v4 syntax):

/* src/index.css */
@import "tailwindcss";
@plugin "@tailwindcss/typography";

Usage:

<article class="prose lg:prose-xl dark:prose-invert">
  {{ markdown_content }}
</article>

Available classes:

  • prose - Base typography styles
  • prose-sm, prose-base, prose-lg, prose-xl, prose-2xl - Size variants
  • dark:prose-invert - Dark mode styles

Forms Plugin - Reset Form Element Styles

When to use: Building custom forms without shadcn/ui components, or need consistent cross-browser form styling.

Installation:

pnpm add -D @tailwindcss/forms

Configuration (v4 syntax):

/* src/index.css */
@import "tailwindcss";
@plugin "@tailwindcss/forms";

What it does:

  • Resets browser default form styles
  • Makes form elements styleable with Tailwind utilities
  • Fixes cross-browser inconsistencies for inputs, selects, checkboxes, radios

Note: Less critical for shadcn/ui users (they have pre-styled form components), but still useful for basic forms.


Common Plugin Errors

These errors happen when using v3 syntax in v4 projects:

❌ WRONG (v3 config file syntax):

// tailwind.config.js
module.exports = {
  plugins: [require('@tailwindcss/typography')]
}

❌ WRONG (@import instead of @plugin):

@import "@tailwindcss/typography";  /* Doesn't work */

✅ CORRECT (v4 @plugin directive):

/* src/index.css */
@import "tailwindcss";
@plugin "@tailwindcss/typography";
@plugin "@tailwindcss/forms";

Built-in Features (No Plugin Needed)

Container queries are built into Tailwind v4 core - no plugin needed:

<div className="@container">
  <div className="@md:text-lg">
    Responds to container width, not viewport
  </div>
</div>

❌ Don't install: @tailwindcss/container-queries (deprecated, now core feature)


Reference Documentation

For deeper understanding, see:

  • architecture.md - Deep dive into the 4-step pattern
  • dark-mode.md - Complete dark mode implementation
  • common-gotchas.md - All the ways it can break (and fixes)
  • migration-guide.md - Migrating hardcoded colors to CSS variables

Official Documentation


Production Example

This skill is based on the WordPress Auditor project:

All patterns in this skill have been validated in production.


Questions? Issues?

  1. Check reference/common-gotchas.md first
  2. Verify all steps in the 4-step architecture
  3. Ensure components.json has "config": ""
  4. Delete tailwind.config.ts if it exists
  5. Check official docs: https://ui.shadcn.com/docs/tailwind-v4

平台分布

Claude Code

31.27%
按下载量换算211

Antigravity

24.79%
按下载量换算167

Gemini CLI

16.84%
按下载量换算114

OpenCode

14.1%
按下载量换算95

Cursor

7.83%
按下载量换算53

Codex

3.96%
按下载量换算27

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

继续浏览同类 Skills