用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/mikailustuner/OmniRule --skill tailwind-expert命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | tailwind-expert |
| description | Tailwind 4: Theme architecture, Responsive strategy, Component patterns, Dark mode approach. |
| triggers | {"extensions":[".tsx",".html"],"filenames":["tailwind.config.js","tailwind.config.ts"],"keywords":["Tailwind","class","utility","tw","@apply","theme","extend"]} |
| auto_load_when | Writing Tailwind CSS classes or config |
| agent | style-architect |
| tools | ["Read","Write","Bash"] |
Version: Tailwind 4.1 | Focus: Design system, strategy, patterns
What goes in @theme?
├── Design tokens only (colors, spacing, fonts, radii)
├── NOT component styles (those are in components)
└── NOT complex utilities (use @utility for those)
Theme-first approach:
├── Define tokens in @theme
├── Use semantic names (--color-primary, NOT --color-blue-500)
├── Allow runtime overrides with CSS variables
└── Generate utilities automatically from tokens
When NOT to use @theme:
[100px]How to handle responsive?
├── Mobile-first (default): classes apply to all, add md: for larger
│ └── div className="base md:large"
│ └── Small: base applies, md: applies at md+
│
├── Breakpoint system:
│ └── sm: 640px, md: 768px, lg: 1024px, xl: 1280px
│
└── When NOT to use responsive:
└── Container queries (@container) - adapt to parent, not viewport
Media queries (viewport-based):
├── Sidebar hide on mobile
├── Font size changes with screen
└── Use when: layout responds to WINDOW size
Container queries (parent-based):
├── Card content adapts to card width
├── Product grid adapts to container
└── Use when: component behavior depends on ITS CONTAINER
Pattern: @container on parent, @md: on children
How to structure components?
├── Variant-based (recommended for simple components)
│ └── Button({ variant = 'primary' | 'secondary' })
│ └── Map variant to CSS classes
│ └── Good for: buttons, inputs, cards
│
├── Composition (recommended for complex)
│ └── Wrapper + Header + Body + Footer
│ └── Each part is optional
│ └── Good for: layouts, complex cards
│
└── Polymorphic (for flexibility)
└── Render as different elements
└── Good for: typography, links
Dark mode implementation:
├── System preference (auto): className="dark:bg-black"
└── Manual toggle: className="bg-white dark:bg-black"
When to use each:
├── Auto: user controls via OS, no toggle needed
└── Manual: user explicitly chooses, needs toggle button
Implementation:
├── CSS variables for colors
├── .dark class overrides variables
└── @media (prefers-color-scheme: dark) sets default
Color hierarchy:
├── Semantic: --color-primary, --color-success (use in theme)
├── Brand: --color-brand-50 through --color-brand-900 (define in theme)
└── Functional: --color-bg, --color-text (optional abstraction)
When to use specific:
├── Semantic → when meaning is clear (primary, success, error)
├── Brand → when it's your actual brand color
└── Neutral → gray/slate for text, borders, backgrounds
When to compose utilities:
├── Multiple values: className="flex items-center justify-between"
├── Conditional: className={cn(base, condition && variant)}
└── Reusable: extract to component
When to create custom utility:
├── Pattern used 3+ times
├── Complex selector logic
└── Not achievable with existing utilities
Migration priority:
├── 1. Install @tailwindcss/vite
├── 2. Replace @tailwind with @import "tailwindcss"
├── 3. Move config.js to @theme in CSS
├── 4. Remove content array (auto-detect)
├── 5. Update ring-offset to outline-offset
├── 6. Test functionality
└── 7. Review generated CSS size
When to upgrade:
❌ Overriding Tailwind with arbaitrary [value] everywhere
✅ Extend theme in tailwind.config.ts; use custom tokens
❌ Long className strings that repeat across components
✅ Extract to component with cva() (class-variance-authority)
❌ Purging accidentally removes used classes (dynamic class strings)
✅ Safelist dynamic classes or construct full class names in code
❌ Mixing Tailwind with global CSS for the same styles
✅ Tailwind for all layout/spacing; CSS for animations not in Tailwind
❌ No dark mode strategy — adding dark: to every class
✅ Centralize dark mode in design tokens via CSS variables
| Pattern | Implementation | Note |
|---|---|---|
| Component variants | cva() + cn() | Type-safe variants |
| Responsive | sm: md: lg: | Mobile-first |
| Dark mode | dark: prefix | class or media strategy |
| Animation | animate-* + @keyframes | Extend in config |
| Arbitrary value | w-[37px] | Use sparingly |
| Custom token | extend.colors.brand | In tailwind.config.ts |