关于 tailwind
Tailwind 是一套按主题组织的 Tailwind CSS v4 参考技能,覆盖实用类、主题、响应状态、自定义样式、性能和无障碍。它还提供将 Figma 变量转换为主题 CSS 的工作流。
主要功能
- 01实用类优先模型与类组合
- 02主题变量与设计令牌
- 03响应式、交互及深色模式变体
- 04自定义样式与工具类
- 05构建扫描与性能指导
- 06将 Figma 变量转换为 Tailwind 主题 CSS
适用场景
- 01查阅 Tailwind v4 配置指南
- 02定义或调整主题令牌
- 03添加响应式、焦点或深色模式样式
- 04根据 Figma 变量生成主题 CSS
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ display-design-studio/ skills --skill tailwind安装后在 Claude Code 中输入/tailwind确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
figma-tokens/breakpoints.csscolors.cssradius-shadows.cssspacing.csstypography.cssrules/_coverage-map.md_sections.mda11y-and-dark-mode.mdcore-custom-styles.mdcore-responsive-and-states.mdcore-theme-variables.mdcore-utility-model.mdfigma-to-theme-workflow.mdperf-purging-and-scanning.md详细介绍
Tailwind CSS 最佳实践
Tailwind CSS v4 指南,按模块化规则组织。涵盖实用类优先模型、@theme 变量、响应式/状态变体、自定义样式、性能、无障碍,以及用于直接从 Figma 变量生成设计令牌的 Figma → Tailwind 主题工作流。
路由:加载哪个规则文件
如果要设置 Tailwind 或了解实用类的工作方式:
→ 阅读 rules/core-utility-model.md
如果要处理主题变量(@theme)、设计令牌、颜色、字体、间距:
→ 阅读 rules/core-theme-variables.md
如果要处理响应式设计、悬停/焦点状态、深色模式或自定义变体:
→ 阅读 rules/core-responsive-and-states.md
如果要添加自定义 CSS、组件类、基础样式或自定义实用类:
→ 阅读 rules/core-custom-styles.md
如果要优化构建体积、清除未使用的类或配置内容检测:
→ 阅读 rules/perf-purging-and-scanning.md
如果要处理无障碍或深色模式策略:
→ 阅读 rules/a11y-and-dark-mode.md
如果要将 Figma 变量/设计令牌转换为 Tailwind v4 主题 CSS:
→ 阅读 rules/figma-to-theme-workflow.md + 查看 figma-tokens/ 模板
规则索引
| 主题 | 描述 | 文件 |
|---|---|---|
| 章节概览 | 分类和阅读顺序 | rules/_sections.md |
| 实用类模型 | 实用类优先原则、组合类、任意值 | rules/core-utility-model.md |
| 主题变量 | @theme 指令、命名空间、扩展/覆盖、inline/static | rules/core-theme-variables.md |
| 响应式与状态 | 断点、悬停/焦点/深色变体、自定义变体 | rules/core-responsive-and-states.md |
| 自定义样式 | @layer、@utility、@variant、组件类 | rules/core-custom-styles.md |
| 性能 | 内容检测、JIT、构建优化 | rules/perf-purging-and-scanning.md |
| 无障碍与深色模式 | 无障碍实用类、深色模式模式 | rules/a11y-and-dark-mode.md |
| Figma 工作流 | Agent 工作流:Figma 变量 → Tailwind @theme CSS | rules/figma-to-theme-workflow.md |
Figma → Tailwind 主题工作流
此技能包含专用的 Agent 工作流,可将 Figma 设计变量转换为 Tailwind v4 @theme CSS 文件。工作流详见 rules/figma-to-theme-workflow.md,并使用 figma-tokens/ 中带注释的模板作为输出目标。
**如何触发:**将 Figma CSS 变量粘贴到聊天中,并让 Agent 生成 Tailwind 主题文件。
figma-tokens/ 中的模板文件:
colors.css—--color-*命名空间typography.css—--font-*、--text-*、--font-weight-*、--tracking-*、--leading-*spacing.css—--spacing和--spacing-*radius-shadows.css—--radius-*、--shadow-*breakpoints.css—--breakpoint-*
按优先级划分的规则类别
| 优先级 | 类别 | 影响 | 前缀 |
|---|---|---|---|
| 1 | 实用类模型与主题 | CRITICAL | core- |
| 2 | 响应式与状态 | HIGH | core- |
| 3 | 自定义样式 | HIGH | core- |
| 4 | Figma 工作流 | HIGH | (独立) |
| 5 | 性能 | MEDIUM-HIGH | perf- |
| 6 | 无障碍 | MEDIUM | a11y- |
覆盖范围与维护
- 覆盖范围映射:
rules/_coverage-map.md - 来源:https://tailwindcss.com/docs (v4.2)
- 当 Tailwind 发布会导致
@theme发生破坏性变更的新主/次版本时更新。