本文へスキップ
Skillpedia
WebサイトとUI(フロントエンド)29k · #9366

tailwind-v4

できること

このスキルは、Tailwind CSS v4のコードを正しく書くためのガイドです。新しいコードに現れるべきでない、古いバージョン3のパターンを指摘します。

使う場面

  • ✓プロジェクトでTailwindのスタイルを書いたり変えたりしているとき。
  • ✓古いTailwind v3のコードをv4に移行したいとき。
  • ✓新しい設定方式で、カスタムのテーマの色を設定したいとき。

スキルのリンク

https://github.com/mastra-ai/mastra/blob/main/.claude/skills/tailwind-v4/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/mastra-ai/mastra/blob/main/.claude/skills/tailwind-v4/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“このコンポーネントのスタイルをTailwind v4の構文に更新し、古いv3のパターンを取り除いてください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは、JavaScriptの設定ファイルではなく、Tailwind v4のCSSベースの設定を使います。使う前に、そのユーティリティがプロジェクトで使うバージョンに存在するかを確認します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Tailwind CSS v4

How to write idiomatic Tailwind v4 and spot v3-era syntax that still compiles but should not appear in new code.

Version and sources

Check the pinned version before using recent utilities: the playground packages pin tailwindcss in their package.json (4.3.3 at the time of writing, including v4.3 utilities like scrollbar-*, zoom-*, and tab-*). When unsure whether a utility, variant, or directive exists in the pinned version, verify against the docs instead of guessing:

CSS-first configuration

Tailwind v4 is configured in CSS, not JavaScript.

Use Never use (v3-era)
@import 'tailwindcss' @tailwind base/components/utilities
@theme { --color-x: ...; } for tokens that should generate utilities tailwind.config.ts for new work
@utility name { ... } for custom utilities (works with variants) @layer utilities { .name { ... } }
@custom-variant dark (&:is(.dark *)) JS plugins / addVariant
@source "path" / @source inline("...") for extra sources / safelisting content array / safelist config
@variant dark { ... } to apply a Tailwind variant inside custom CSS duplicating media queries / selectors
@reference "app.css" for @apply in scoped styles (Vue, CSS Modules) duplicating stylesheet imports
var(--color-x) in CSS, getComputedStyle in JS theme() function, resolveConfig
@config "…" / @plugin "…" only for existing JS-config integrations adding new JS configs or plugins

@theme variables are API: each one emits a native CSS variable AND generates utilities (--color-* → bg-*/text-*/border-*/..., --text-* → text-*, --shadow-* → shadow-*, --animate-* → animate-*, --breakpoint-* → responsive variants). A plain :root { --x: ...; } variable generates nothing — use it for runtime-only values. When a token's value references another variable (--color-x: var(--y)), declare it in @theme inline so the utility resolves the reference at the declaration site. In custom CSS, --alpha(var(--color-x) / 50%) and --spacing(4) replace v3 theme() math.

v3 → v4 renames

Bare names shifted one step down the scale, so the v3 spelling silently renders smaller or lighter:

v3 v4
shadow-sm / shadow shadow-xs / shadow-sm
drop-shadow-sm / drop-shadow drop-shadow-xs / drop-shadow-sm
blur-sm / blur blur-xs / blur-sm
rounded-sm / rounded rounded-xs / rounded-sm
outline-none outline-hidden (a11y-safe); outline-none now truly removes it
ring (3px) ring-3; the default ring is now 1px currentColor
bg-opacity-50, text-opacity-* opacity modifier: bg-black/50, text-white/50
bg-gradient-to-r bg-linear-to-r (plus new bg-conic-*, bg-radial-*)
!bg-red-500 (prefix) bg-red-500! (suffix)
flex-shrink-* / flex-grow-* shrink-* / grow-*
bg-[--var] bg-(--var); brackets now require bg-[var(--var)]
grid-cols-[a,b] (commas) underscores: grid-cols-[max-content_auto]

Prefer generated utilities over arbitrary values

The spacing scale is infinite — every number compiles via calc(var(--spacing) * n) — so mo

よくある質問

プロジェクトにはまだtailwindの設定ファイルが必要ですか?

新しい作業では、設定はJavaScriptの設定ファイルではなくCSSで書かれます。

どの機能が使えるかはどう分かりますか?

プロジェクトが固定しているTailwindのバージョンを確認し、確信が持てないときは公式のドキュメントを参照します。

古い構文は壊れていますか?

その多くはまだコンパイルできますが、スキルは新しいコードがそれを使わないよう導きます。

詳細

作者による元の説明

Tailwind CSS v4 usage guide and v3-to-v4 differences. This skill should be used when writing, reviewing, or refactoring any Tailwind CSS code in this repo. Triggers on tasks involving Tailwind classes, @theme blocks, CSS-first configuration, or cleanup of v3-era syntax.

repo: mastra-ai/mastra

人気

GitHubのスター
29k
ランキング
#9366
ライセンス
—
更新日
2026/11/2

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル