tailwind-v4
Skill này làm gì
Skill này là hướng dẫn viết mã Tailwind CSS phiên bản 4 đúng cách. Nó chỉ ra các mẫu của phiên bản 3 không nên xuất hiện trong mã mới.
Khi nào nên dùng
- ✓Khi bạn đang viết hoặc thay đổi kiểu Tailwind trong một dự án.
- ✓Khi bạn muốn chuyển mã Tailwind phiên bản 3 cũ sang phiên bản 4.
- ✓Khi bạn muốn thiết lập màu chủ đề tùy chỉnh theo kiểu cấu hình mới.
Liên kết skill
https://github.com/mastra-ai/mastra/blob/main/.claude/skills/tailwind-v4/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Cập nhật kiểu của thành phần này sang cú pháp Tailwind phiên bản 4 và xóa các mẫu phiên bản 3 cũ.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent dùng cấu hình dựa trên CSS của Tailwind phiên bản 4 thay vì file cấu hình JavaScript, và kiểm tra rằng các tiện ích có trong phiên bản dự án đang dùng trước khi sử dụng chúng.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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:
- Utility/variant reference: https://tailwindcss.com/docs
- v3 → v4 migration: https://tailwindcss.com/docs/upgrade-guide
- What each minor added: https://tailwindcss.com/blog/tailwindcss-v4 (and
/tailwindcss-v4-1,/tailwindcss-v4-3, ...)
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
Câu hỏi thường gặp
Dự án còn cần file cấu hình tailwind không?
Với công việc mới, cấu hình được viết bằng CSS thay vì file cấu hình JavaScript.
Làm sao biết tính năng nào có sẵn?
Nó kiểm tra phiên bản Tailwind mà dự án ghim và tham khảo tài liệu chính thức khi chưa chắc.
Cú pháp cũ có bị lỗi không?
Phần lớn vẫn biên dịch được, nhưng skill hướng mã mới tránh xa chúng.
Chi tiết
Mô tả gốc của tác giả
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
Độ phổ biến
- Sao GitHub
- 29k
- Vị trí xếp hạng
- #9366
- Giấy phép
- —
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
debugging-difficult-bugs
29kGiúp agent của bạn gỡ một lỗi khó bằng cách ghi nhật ký những gì chương trình thật sự làm lúc chạy, thay vì đoán chỉ từ các bài kiểm thử.
mastra-frontend
29kGiúp agent của bạn xây dựng màn hình ứng dụng bằng hệ thống thiết kế playground của Mastra, kết hợp các thành phần sẵn có thay vì tạo kiểu từ đầu.
pr-explainer
29kGiúp agent của bạn biến một pull request thành trang HTML độc lập, giải thích thay đổi cho người review một cách rõ ràng.
pr-splitter
29kGiúp agent của bạn chia một pull request lớn, lộn xộn thành nhiều pull request nhỏ dễ review, đồng thời giữ an toàn cho công việc gốc.
Skill tương tự
angular-developer
280kGiúp agent của bạn viết code Angular và tư vấn cấu trúc dự án, hữu ích khi bắt đầu dự án mới hoặc cải thiện hiệu suất.
frontend-a11y
280kGiúp agent của bạn làm cho giao diện web dễ tiếp cận với mọi người. Đảm bảo website và ứng dụng hoạt động tốt với trình đọc màn hình và điều hướng bằng bàn phím.
frontend-patterns
280kGiúp agent của bạn áp dụng các mẫu hiện đại trong phát triển frontend. Tối ưu hiệu năng, quản lý trạng thái và tuân theo thực hành tốt nhất với React và Next.js.