asyrafhussin avatar

Tailwind Best Practices

This is a comprehensive reference for writing maintainable Tailwind CSS, covering both v3 and v4. It automatically detects your version and applies the right patterns, which matters because v4 fundamentally changed how configuration works (CSS-based @theme instead of tailwind.config.js). You get 29 rules across responsive design, dark mode, component variants with clsx/cn utilities, and a full migration guide. The mobile-first examples and conditional class patterns are solid, and the version detection step saves you from mixing incompatible approaches. Most useful when you're setting up dark mode, building component libraries, or migrating an existing project to v4.

skills.sh installs
1K
GitHub stars
102
last updated
Aug 21, 2026

Install

$ npx -y skills add asyrafhussin/agent-skills --skill tailwind-best-practices --agent claude-code

Installs into .claude/skills of the current project.

Files

Tailwind CSS Best Practices

Comprehensive patterns for building consistent, maintainable interfaces with Tailwind CSS v3.4+ and v4. Contains 29 rules covering responsive design, dark mode, component patterns, configuration, and v4 migration.

Metadata

  • Version: 1.0.0
  • Framework: Tailwind CSS v3.4+ / v4.0+
  • Rule Count: 29 rules across 8 categories
  • 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": "^3.x" }  // → v3 rules apply
{ "tailwindcss": "^4.x" }  // → v4 rules apply

Also check for these signals:

SignalVersion
tailwind.config.js existsv3
@import "tailwindcss" in CSSv4
@tailwindcss/vite in dependenciesv4
@tailwindcss/postcss in dependenciesv4
@theme {} block in CSSv4

Sponsors

Details

Repository
github.com/asyrafhussin/agent-skills
Categories
Frontend Development, Documentation, AI & Agent Building, Design & UI/UX
First seen
Jun 3, 2026

More from asyrafhussin/agent-skills

All 14
1mindrally avatarzustand-state-managementmindrally/skillsBest practices for Zustand state management in React and Next.js applications with TypeScript.993skills.sh installs
2davila7 avatarfrontend-designdavila7/claude-code-templatesCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, 981skills.sh installs
3ailabs-393 avatarfrontend-enhancerailabs-393/ai-labs-claude-skillsThis skill should be used when enhancing the visual design and aesthetics of Next.js web applications. It provides modern UI components, design patterns, color 973skills.sh installs
4chrisbanes avatarcompose-state-holder-ui-splitchrisbanes/skillsUse when a Jetpack Compose screen-level composable takes a ViewModel/component/controller, collects state or effects, handles navigation/snackbars, or wires cal969skills.sh installs
5mindrally avatarnuxtjs-vue-typescriptmindrally/skillsNuxtJS and Vue 3 development with TypeScript, Composition API, Shadcn Vue, and Tailwind CSS for modern web applications.862skills.sh installs
6pproenca avatarui-designpproenca/dot-skillsUI/UX and frontend design best practices guidelines (formerly frontend-design). This skill should be used when writing, reviewing, or designing frontend code to827skills.sh installs