← 返回 Skills 市场
iliaal

ia-tailwind-css

作者 Ilia Alshanetsky · GitHub ↗ · v3.0.3 · MIT-0
cross-platform ✓ 安全检测通过
267
总下载
0
收藏
0
当前安装
10
版本数
在 OpenClaw 中安装
/install compound-eng-tailwind-css
功能描述
Tailwind CSS v4 patterns: CSS-first config, utility classes, component variants, v3 migration. Use when styling with Tailwind, configuring @theme tokens, usi...
使用说明 (SKILL.md)

Tailwind CSS v4

Verify before implementing: For v4-specific syntax (@theme, @variant, CSS-first config), search current docs via search_docs before writing code. Tailwind v4 changed significantly from v3 and training data may be stale.

CSS-First Configuration

v4 eliminates tailwind.config.ts. All configuration lives in CSS.

Directive Purpose
@import "tailwindcss" Entry point (replaces @tailwind base/components/utilities)
@theme { } Define/extend design tokens -- auto-generates utility classes
@theme inline { } Map CSS variables to Tailwind utilities without generating new vars
@theme static { } Define tokens that don't generate utilities
@utility name { } Create custom utilities (replaces @layer components + @apply)
@custom-variant name (selector) Define custom variants
@import "tailwindcss";

@theme {
  --color-brand: oklch(0.72 0.11 178);
  --font-display: "Inter", sans-serif;
  --animate-fade-in: fade-in 0.2s ease-out;
  @keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
}

@custom-variant dark (&:where(.dark, .dark *));

Tokens defined with @theme become utilities automatically: --color-brand produces bg-brand, text-brand, border-brand. Define z-index as tokens (--z-modal: 50) and reference via z-(--z-modal) instead of arbitrary z-50.

CSS Modules: when using .module.css with Tailwind v4, add @reference "#tailwind"; at the top of the module file to enable theme token access inside the module.

Animations (tw-animate-css): use animate-in/animate-out base classes combined with effect classes (fade-in, slide-in-from-top). Decimal spacing gotcha: use bracket notation [0.625rem] instead of fractional values like 2.5.

v3 to v4 Migration

For projects upgrading from v3 to v4, see v3-to-v4-migration.md for the full breaking-change table and codemod guidance. For greenfield v4 work, current patterns are above.

Coding Rules

  • gap over space-x/space-y -- gap handles wrapping; space-* breaks on wrap
  • size-* over w-* h-* -- for equal dimensions
  • min-h-dvh over min-h-screen -- dvh accounts for mobile browser chrome
  • Opacity modifier (bg-black/50) -- *-opacity-* utilities are removed in v4
  • Design tokens over arbitrary values -- check @theme before using [#hex]
  • Never construct classes dynamically -- text-${color}-500 won't be detected; use complete class names
  • @utility over @apply with @layer -- @apply on @layer classes fails in v4
  • Parent padding over last-child margin -- use padding on containers instead of bottom margins on the last child

ESLint Integration

Use eslint-plugin-better-tailwindcss for automated class validation:

  • no-conflicting-classes -- catches text-red-500 text-blue-500
  • no-unknown-classes -- flags typos
  • enforce-canonical-classes -- normalizes shorthand
  • no-duplicate-classes -- removes redundant entries
  • no-deprecated-classes -- catches v3 classes removed in v4
  • useSortedClasses -- enforces canonical class order; configure attributes: ["classList"] and functions: ["clsx", "cva", "cn", "tv", "tw"] to cover JSX utility functions

Class Merging

Use cn() combining clsx + tailwind-merge for conditional/dynamic classes. Use plain strings for static className attributes.

import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); }
// Static: plain string
\x3Cbutton className="rounded-lg px-4 py-2 font-medium bg-blue-600">

// Conditional: use cn()
\x3Cbutton className={cn("rounded-lg px-4 py-2", isActive ? "bg-blue-600" : "bg-gray-700")} />

Component Variants

Use tailwind-variants (tv()) for type-safe variant components. Alternative: class-variance-authority (cva()).

import { tv } from "tailwind-variants";
const button = tv({
  base: "rounded-lg px-4 py-2 font-medium transition-colors",
  variants: {
    color: { primary: "bg-blue-600 text-white", secondary: "bg-gray-200 text-gray-800" },
    size: { sm: "text-sm px-3 py-1", md: "text-base", lg: "text-lg px-6 py-3" },
  },
  defaultVariants: { color: "primary", size: "md" },
});

See tailwind-variants patterns for slots, composition, and responsive variants.

Common Errors

Symptom Fix
bg-primary doesn't work Add @theme inline { --color-primary: var(--primary); }
Colors all black/white Double hsl() wrapping -- use var(--color) not hsl(var(--color))
@apply fails on custom class Use @utility instead of @layer components
Build fails after migration Delete tailwind.config.ts
Animations broken Replace tailwindcss-animate with tw-animate-css
.dark { @theme { } } fails v4 does not support nested @theme -- use :root/.dark CSS vars mapped via @theme inline

Dark Mode (v4 Pattern)

:root { --background: hsl(0 0% 100%); --foreground: hsl(222 84% 4.9%); }
.dark { --background: hsl(222 84% 4.9%); --foreground: hsl(210 40% 98%); }
@theme inline { --color-background: var(--background); --color-foreground: var(--foreground); }

Semantic classes (bg-background, text-foreground) auto-switch -- no dark: variants needed for themed colors.

Verify

  • Build passes with zero errors (npm run build or equivalent)
  • No v3 class names remain in changed files (check with @tailwindcss/upgrade --dry-run if available)
  • No conflicting classes on the same element

References

安全使用建议
This skill is documentation and migration guidance only — it doesn't request credentials or install code. Before applying any changes the skill suggests: run its suggestions in a local branch, review diffs, run your test/build pipeline, and confirm your project is actually targeting Tailwind v4. If the agent proposes codemods or automated edits, inspect those changes manually and ensure ESLint/plugin upgrades are compatible with your toolchain. Finally, limit the agent's repository access to the project you want to modify (don't grant it broader system or cloud credentials).
功能分析
Type: OpenClaw Skill Name: compound-eng-tailwind-css Version: 3.0.3 The skill bundle provides legitimate documentation and technical instructions for implementing Tailwind CSS v4 patterns. It covers CSS-first configuration, migration from v3, and integration with standard libraries like tailwind-variants and CVA. There are no signs of malicious intent, data exfiltration, or harmful prompt injections; all instructions and code snippets in SKILL.md and the reference files are strictly aligned with the stated purpose of front-end styling.
能力评估
Purpose & Capability
Name/description match the contents: the SKILL.md and reference docs provide Tailwind v4 migration patterns, config guidance, utilities, and lint/plugin recommendations. There are no unrelated environment variables, binaries, or surprising requirements.
Instruction Scope
Runtime instructions are documentation-style guidance for editing CSS and tailwind config files (front-matter paths target **/*.css and tailwind.config.*). It suggests verifying docs with a search helper before changing code. The instructions do not direct the agent to read unrelated system files, exfiltrate secrets, or call outside endpoints.
Install Mechanism
No install spec and no code files — the skill is instruction-only, so nothing is written to disk or downloaded during install.
Credentials
The skill declares no required env vars, credentials, or config paths. Recommendations to use ESLint plugins and npm packages are appropriate for the stated purpose and are not requested as secrets.
Persistence & Privilege
Flags show always:false and default model invocation behavior. The skill does not request permanent presence or privileges beyond normal agent invocation.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install compound-eng-tailwind-css
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /compound-eng-tailwind-css 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v3.0.4
v3.0.4
v3.0.3
v3.0.3
v3.0.2
v3.0.2
v3.0.1
v3.0.1
v3.0.0
v3.0.0
v2.56.1
v2.56.1
v2.56.0
v2.56.0
v2.55.1
v2.55.1
v2.55.0
v2.55.0
v2.53.2
v2.53.2
v2.53.0
v2.53.0
元数据
Slug compound-eng-tailwind-css
版本 3.0.3
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 10
常见问题

ia-tailwind-css 是什么?

Tailwind CSS v4 patterns: CSS-first config, utility classes, component variants, v3 migration. Use when styling with Tailwind, configuring @theme tokens, usi... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 267 次。

如何安装 ia-tailwind-css?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install compound-eng-tailwind-css」即可一键安装,无需额外配置。

ia-tailwind-css 是免费的吗?

是的,ia-tailwind-css 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

ia-tailwind-css 支持哪些平台?

ia-tailwind-css 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 ia-tailwind-css?

由 Ilia Alshanetsky(@iliaal)开发并维护,当前版本 v3.0.3。

💬 留言讨论