tailwind-best-practices
БесплатноБез исполняемых скриптовНе проверенTailwind CSS patterns and conventions, v4 first with v3.4 legacy and migration. Use when writing responsive designs, implementing dark mode, creating reusable…
от AsyrafHussin★ 112 звёзд на GitHubОб этом скилле
Tailwind CSS Best Practices
Comprehensive patterns for building consistent, maintainable interfaces with Tailwind CSS v4, with v3.4 kept as legacy and a full v3 → v4 migration path. Contains 30 rules covering responsive design, dark mode, component patterns, configuration, v4 setup and migration, and the utilities added in v4.1–4.3.
Metadata
- Version: 2.0.0
- Framework: Tailwind CSS v4.0+ (tested on 4.3); v3.4 legacy
- Rule Count: 30 rules across 5 categories
- Last Updated: November 2026
- License: MIT
- Documentation: tailwindcss.com/docs
Step 1: Detect Tailwind Version
Always check the version before giving any advice. v3 and v4 are fundamentally different.
Check package.json for the installed version:
{ "tailwindcss": "^4.x" } // → v4 rules apply (default)
{ "tailwindcss": "^3.x" } // → v3 legacy rules apply
For minor-version features (4.1 text shadows, 4.2 logical utilities, 4.3 scrollbars), check the exact version with npm ls tailwindcss.
Also check for these signals:
| Signal | Version |
|---|---|
@import "tailwindcss" in CSS |
v4 |
@tailwindcss/vite, @tailwindcss/postcss, @tailwindcss/cli or @tailwindcss/webpack in dependencies |
v4 |
@theme {} block in CSS |
v4 |
@tailwind base; directives in CSS |
v3 |
tailwind.config.js exists and no @config in CSS |
v3 |
tailwind.config.js exists and CSS has @config "..." |
v4 loading a legacy config (mid-migration) |
A tailwind.config.js on its own does not prove v3: v4 ignores it unless the CSS loads it with @config.
If v4 (default): Apply v4- rules plus resp-/responsive-, dark-, comp-/component- rules. Use @theme {}, not tailwind.config.js.
If v3: Apply resp-/responsive-, dark-, comp-/component-, config- rules and the v3 (legacy) sections. Mention that v4 is available.
If migrating v3 → v4: Follow v4-migration directly.
When to Apply
Reference these guidelines when:
- Writing responsive layouts
- Implementing dark mode
- Creating reusable component styles
- Configuring Tailwind (v4
@theme, or v3 config) - Migrating a project from v3 to v4
- Setting up a new project with v4
Rule Categories by Priority
| Priority | Category | Impact | Prefix | Rules | Version |
|---|---|---|---|---|---|
| 1 | Responsive Design | CRITICAL | resp-, responsive- |
6 | v4 / v3 |
| 2 | Dark Mode | CRITICAL | dark- |
6 | v4 / v3 |
| 3 | Component Patterns | HIGH | comp-, component- |
7 | v4 / v3 |
| 4 | Custom Configuration | HIGH | config- |
6 | v3 legacy (v4 equivalents included) |
| 5 | V4 & Migration | HIGH | v4- |
5 | v4 |
Quick Reference
1. Responsive Design (CRITICAL)
resp-mobile-first- Mobile-first approachresponsive-breakpoint-order- Order breakpoints smallest to largestresponsive-container-queries- Container queries (@container,@min-*/@max-*,@container-size)responsive-fluid-typography- Fluid type withclamp()and--text-*theme valuesresponsive-aspect-ratio- Aspect ratio utilitiesresponsive-grid-system- Responsive grid layouts
2. Dark Mode (CRITICAL)
dark-setup- Configure dark mode (v4 default isprefers-color-scheme)dark-class-strategy- Manual toggle with@custom-variant dark/darkMode: 'class'dark-media-strategy- Follow the system preferencedark-color-scheme- Semantic color tokens for both themesdark-custom-colors- Custom palettes and pairingdark-transitions- Smooth theme transitions
3. Component Patterns (HIGH)
comp-clsx-cn- Conditional classes with clsx + tailwind-mergecomponent-btn-variants- Button variantscomponent-card-patterns- Card patternscomponent-form-elements- Form elementscomponent-modals- Modals and dialogscomponent-navigation- Navigationcomponent-tables- Tables
4. Custom Configuration — v3 legacy (HIGH)
config-extend-theme- Extend vs override themeconfig-custom-colors- Custom color paletteconfig-custom-fonts- Custom fontsconfig-custom-spacing- Custom spacingconfig-plugins- Using plugins (@pluginin v4)config-presets- Sharing configuration (a theme CSS file in v4)
5. V4 & Migration (HIGH)
v4-installation- Install v4 with Vite, PostCSS, CLI or webpack;@source,source(),@referencev4-theme-configuration-@theme {}in CSS;@theme inline; sharing a theme;@configas a bridgev4-custom-utilities-@utility,@custom-variant,@variant,@plugin,@layer componentsv4-migration- Step-by-step v3 → v4: renames, removals, changed defaults, syntax changesv4-new-utilities- Built-ins from v4.1–4.3: text shadows, masks, pointer variants, logical properties, scrollbars
Essential Patterns
Mobile-First Responsive Design
// ✅ Mobile-first: start with mobile, add larger bre
Установить tailwind-best-practices в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл tailwind-best-practices?
Tailwind CSS patterns and conventions, v4 first with v3.4 legacy and migration. Use when writing responsive designs, implementing dark mode, creating reusable component styles, configuring Tailwind, or migrating from v3 to v4. Triggers on tasks involving Tailwind classes, responsive design, dark mode, CSS styling, or "migrate to Tailwind v4".
Как установить скилл tailwind-best-practices?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл tailwind-best-practices запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic