install
source · Clone the upstream repo
git clone https://github.com/ComeOnOliver/skillshub
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ComeOnOliver/skillshub "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/pproenca/dot-skills/tailwind-refactor" ~/.claude/skills/comeonoliver-skillshub-tailwind-refactor && rm -rf "$T"
manifest:
skills/pproenca/dot-skills/tailwind-refactor/SKILL.mdsource content
Community Tailwind CSS Refactoring Best Practices
Comprehensive code quality refactoring guide for Tailwind CSS applications targeting v4. Contains 50 rules across 8 categories, prioritized by migration urgency. Every transformation preserves the existing look and feel — this skill is purely about cleaner code, modern syntax, and v4 compatibility.
Companion skills: Use tailwind-ui-refactor for visual design improvements and tailwind-responsive-ui for responsive layout patterns.
When to Apply
Before manual migration: Run
npx @tailwindcss/upgrade first — it handles most configuration and renamed utility changes automatically. Then use this skill for patterns the automated tool does not cover.
Reference these guidelines when:
- Migrating a project from Tailwind CSS v3 to v4
- Cleaning up deprecated or renamed utility classes
- Consolidating verbose multi-class patterns
- Replacing arbitrary values with design tokens
- Removing
overuse in CSS files@apply - Modernizing syntax to v4 conventions
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Configuration Migration | CRITICAL | |
| 2 | Deprecated Utility Replacement | CRITICAL | |
| 3 | Renamed Utility Updates | HIGH | |
| 4 | Class Consolidation | HIGH | |
| 5 | Arbitrary Value Cleanup | MEDIUM-HIGH | |
| 6 | Syntax Modernization | MEDIUM | |
| 7 | @apply & Architecture Cleanup | MEDIUM | |
| 8 | Modern Feature Adoption | LOW-MEDIUM | |
Quick Reference
1. Configuration Migration (CRITICAL)
- Replace @tailwind directives with @importconfig-import-directive
- Migrate tailwind.config.js to CSS @themeconfig-css-theme
- Replace theme() function with CSS variablesconfig-theme-function
- Use @theme inline for non-utility design tokensconfig-theme-inline
- Replace @layer utilities with @utilityconfig-utility-directive
- Update PostCSS plugin to @tailwindcss/postcssconfig-postcss-plugin
- Remove manual content configurationconfig-content-autodetect
- Migrate addVariant to @custom-variantconfig-custom-variant
- Account for Preflight default changes in v4config-preflight-defaults
2. Deprecated Utility Replacement (CRITICAL)
- Replace -opacity- with opacity modifiers (/50)dep-opacity-modifiers
- Replace flex-shrink/flex-grow with shrink/growdep-flex-shorthand
- Replace overflow-ellipsis with text-ellipsisdep-text-ellipsis
- Replace decoration-slice/clone with box-decoration-*dep-decoration-utilities
- Replace transform-none with individual resetsdep-transform-composites
- Update transition-[transform] to individual propertiesdep-transition-properties
3. Renamed Utility Updates (HIGH)
- Update shadow utilities to new scalerename-shadow-scale
- Update blur utilities to new scalerename-blur-scale
- Update border radius utilities to new scalerename-rounded-scale
- Replace ring with ring-3 for v3 defaultrename-ring-width
- Replace bg-gradient-* with bg-linear-*rename-gradient-utilities
- Replace outline-none with outline-hiddenrename-outline-hidden
4. Class Consolidation (HIGH)
- Replace matching w-* h-* with size-*class-size-utility
- Prefer gap-* over space-x/y-* in flex/gridclass-gap-over-space
- Replace top/right/bottom/left with inset-*class-inset-shorthand
- Add explicit border color for v4 default changeclass-border-color-explicit
- Add explicit ring color for v4 default changeclass-ring-color-explicit
- Remove redundant display classesclass-redundant-display
- Remove display overrides for hidden attributeclass-hidden-priority
- Replace container plugin config with @utilityclass-container-utility
5. Arbitrary Value Cleanup (MEDIUM-HIGH)
- Replace arbitrary hex colors with theme tokensarb-hex-to-theme
- Replace arbitrary spacing with theme scalearb-spacing-to-scale
- Avoid dynamic class name constructionarb-dynamic-classes
- Replace arbitrary breakpoints with @themearb-breakpoint-to-theme
- Replace arbitrary z-index with defined scalearb-zindex-to-scale
6. Syntax Modernization (MEDIUM)
- Update CSS variable syntax from brackets to parenthesessyntax-css-variable-parens
- Update variant stacking to left-to-right ordersyntax-variant-stacking
- Use trailing ! for important modifiersyntax-important-modifier
- Use underscores in grid arbitrary valuessyntax-grid-arbitrary
- Reset gradient stops explicitly in variantssyntax-gradient-preservation
- Account for hover variant media query wrappingsyntax-hover-media-query
7. @apply & Architecture Cleanup (MEDIUM)
- Extract @apply blocks into framework componentsarch-apply-to-component
- Replace @layer components with @utilityarch-layer-to-utility
- Use @reference for @apply in scoped stylesarch-scoped-reference
- Replace safelist with @source inline()arch-safelist-to-source
- Reserve Tailwind for primitives, compose for domainarch-domain-composition
8. Modern Feature Adoption (LOW-MEDIUM)
- Use container queries instead of viewport breakpointsadopt-container-queries
- Use not-* variant for negated conditionsadopt-not-variant
- Use in-* variant to simplify parent-state stylingadopt-in-variant
- Use field-sizing-content for auto-resizing textareasadopt-field-sizing
- Use starting variant for entry animations without JSadopt-starting-variant
How to Use
Read individual reference files for detailed explanations and code examples:
- Section definitions - Category structure and impact levels
- Rule template - Template for adding new rules
Reference Files
| File | Description |
|---|---|
| references/_sections.md | Category definitions and ordering |
| assets/templates/_template.md | Template for new rules |
| metadata.json | Version and reference information |