tailwind-ui-refactor
Original:🇺🇸 English
Translated
Refactoring UI design patterns for Tailwind CSS applications. This skill should be used when writing, reviewing, or refactoring HTML with Tailwind utility classes to improve visual hierarchy, spacing, typography, color, depth, and polish. Triggers on tasks involving UI cleanup, design review, Tailwind refactoring, component styling, or visual improvements.
3installs
Sourcepproenca/dot-skills
Added on
NPX Install
npx skill4agent add pproenca/dot-skills tailwind-ui-refactorTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Refactoring UI Tailwind CSS Best Practices
Comprehensive UI refactoring guide based on Refactoring UI by Adam Wathan & Steve Schoger, implemented with Tailwind CSS utility classes. Contains 52 rules across 9 categories, prioritized by design impact to guide automated refactoring and code generation. Uses Tailwind CSS v4 syntax (v3 notes provided where syntax differs).
Important: Think first, style second. Before applying any visual rule, understand the UI's purpose, identify what matters to the user, and remove unnecessary elements. The Design Intent category (priority 1) must be considered before any styling changes. A simpler component with fewer elements always beats a decorated component with unnecessary markup.
When to Apply
Reference these guidelines when:
- Refactoring existing Tailwind CSS components
- Writing new UI with Tailwind utility classes
- Reviewing code for visual hierarchy and spacing issues
- Improving design quality without a designer
- Fixing accessibility contrast problems
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Design Intent | CRITICAL | |
| 2 | Visual Hierarchy | CRITICAL | |
| 3 | Layout & Spacing | CRITICAL | |
| 4 | Typography | HIGH | |
| 5 | Color Systems | HIGH | |
| 6 | Depth & Shadows | MEDIUM | |
| 7 | Borders & Separation | MEDIUM | |
| 8 | Images & Content | LOW-MEDIUM | |
| 9 | Polish & Details | LOW | |
Quick Reference
1. Design Intent (CRITICAL)
- - Audit what each element communicates before changing any CSS
intent-audit-before-styling - - Remove unnecessary elements before styling what remains
intent-remove-before-decorating - - Reduce choices per screen — fewer options beat prettier options
intent-reduce-cognitive-load - - Hide secondary information behind interactions
intent-progressive-disclosure - - Let real content determine layout — not the other way around
intent-content-drives-layout - - Prefer removing a wrapper over adding 5 utility classes to it
intent-simplify-over-decorate - - Match design polish to context — admin vs consumer vs product
intent-match-context-fidelity - - Audit sibling component patterns before restyling
intent-match-existing-patterns
2. Visual Hierarchy (CRITICAL)
- - Use size, weight, and color for hierarchy — not just size
hier-size-weight-color - - De-emphasize secondary content instead of emphasizing primary
hier-deemphasize-secondary - - Style buttons by visual hierarchy, not semantic importance
hier-button-hierarchy - - Combine labels and values into natural language
hier-label-value-pairs - - Separate visual hierarchy from document hierarchy
hier-semantic-vs-visual - - Size icons relative to adjacent text, not to fill space
hier-icon-sizing - - Use opacity or muted colors for hierarchy on colored backgrounds
hier-color-hierarchy-on-dark
3. Layout & Spacing (CRITICAL)
- - Start with too much whitespace, then remove
space-start-generous - - Use a constrained spacing scale, not arbitrary values
space-systematic-scale - - Use spacing to show relationships between elements
space-relationship-proximity - - Constrain content width — avoid filling the whole screen
space-dont-fill-screen - - Use fixed widths when grids are not needed
space-grids-not-required - - Avoid raw viewport units without clamping
space-relative-sizing-fails - - Design mobile-first at ~400px, then expand
space-mobile-first
4. Typography (HIGH)
- - Keep line length between 45-75 characters
type-line-length - - Line height and font size are inversely proportional
type-line-height-inverse - - Choose fonts with at least 5 weight variations
type-font-weight-variety - - Left-align body content — avoid centering long-form text
type-no-center-long-text - - Tighten letter spacing for headlines, loosen for uppercase
type-letter-spacing - - Align numbers right in tables for easy comparison
type-align-numbers-right
5. Color Systems (HIGH)
- - Define a complete color palette upfront — don't pick colors ad-hoc
color-define-palette-upfront - - Design in grayscale first, add color last
color-grayscale-first - - Ensure 4.5:1 contrast ratio for body text
color-accessible-contrast - - Use dark gray instead of pure black for text
color-dark-gray-not-black - - Add subtle saturation to grays for warmth or coolness
color-saturated-grays - - Use light-colored backgrounds with dark text for badges
color-light-backgrounds-dark-text
6. Depth & Shadows (MEDIUM)
- - Define a fixed shadow scale — small to extra large
depth-shadow-scale - - Use vertical offset for natural-looking shadows
depth-shadow-vertical-offset - - Use shadow changes to communicate interactivity
depth-interactive-elevation - - Lighter colors feel closer, darker colors recede
depth-light-closer-dark-recedes - - Overlap elements to create visual layers
depth-overlap-layers
7. Borders & Separation (MEDIUM)
- - Use fewer borders — replace with spacing, shadows, or background color
sep-fewer-borders - - Use background color differences to separate sections
sep-background-color-separation - - Use spacing instead of lines in simple tables
sep-table-spacing-not-lines - - Upgrade radio buttons to selectable cards for key choices
sep-card-radio-buttons
8. Images & Content (LOW-MEDIUM)
- - Control user-uploaded image size and aspect ratio
img-control-user-content - - Add overlays or reduce contrast for text over images
img-text-overlay - - Avoid scaling up icons designed for small sizes
img-dont-scale-up-icons - - Design meaningful empty states with clear CTAs
img-empty-states
9. Polish & Details (LOW)
- - Add accent borders to highlight important elements
polish-accent-borders - - Replace default bullets with icons or checkmarks
polish-custom-bullets - - Match border radius to brand personality
polish-border-radius-personality - - Use gradients with hues within 30 degrees of each other
polish-gradient-close-hues - - Add inner shadow to prevent image background bleed
polish-inner-shadow-images
Scope & Limitations
This skill covers layout, hierarchy, spacing, color, and polish based on Refactoring UI principles. It does NOT cover:
- Font selection & pairing — choosing distinctive typefaces, avoiding generic AI defaults (Inter, Arial, system-ui), or pairing display + body fonts
- Animation & motion — meaningful transitions, micro-interactions, page load sequences, or scroll-triggered reveals
- Creative direction — establishing an aesthetic vision, choosing a tone (minimal, maximalist, brutalist, etc.), or differentiating from generic "AI slop" aesthetics
- Spatial composition — asymmetric layouts, grid-breaking elements, or unconventional visual flow
For these concerns, pair this skill with a design-thinking or frontend-design skill that covers creative direction and aesthetic execution.
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 |