tailwind-ui-refactor
43
总安装量
3
周安装量
#8987
全站排名
安装命令
npx skills add https://github.com/pproenca/dot-skills --skill tailwind-ui-refactor
Agent 安装分布
amp
3
gemini-cli
3
claude-code
3
github-copilot
3
codex
3
kimi-cli
3
Skill 文档
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 44 rules across 8 categories, prioritized by visual impact to guide automated refactoring and code generation.
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 | Visual Hierarchy | CRITICAL | hier- |
| 2 | Layout & Spacing | CRITICAL | space- |
| 3 | Typography | HIGH | type- |
| 4 | Color Systems | HIGH | color- |
| 5 | Depth & Shadows | MEDIUM | depth- |
| 6 | Borders & Separation | MEDIUM | sep- |
| 7 | Images & Content | LOW-MEDIUM | img- |
| 8 | Polish & Details | LOW | polish- |
Quick Reference
1. Visual Hierarchy (CRITICAL)
hier-size-weight-color– Use size, weight, and color for hierarchy â not just sizehier-deemphasize-secondary– De-emphasize secondary content instead of emphasizing primaryhier-button-hierarchy– Style buttons by visual hierarchy, not semantic importancehier-label-value-pairs– Combine labels and values into natural languagehier-semantic-vs-visual– Separate visual hierarchy from document hierarchyhier-icon-sizing– Size icons relative to adjacent text, not to fill spacehier-color-hierarchy-on-dark– Use opacity or muted colors for hierarchy on colored backgrounds
2. Layout & Spacing (CRITICAL)
space-start-generous– Start with too much whitespace, then removespace-systematic-scale– Use a constrained spacing scale, not arbitrary valuesspace-relationship-proximity– Use spacing to show relationships between elementsspace-dont-fill-screen– Don’t fill the whole screen â constrain content widthspace-grids-not-required– Don’t force everything into a grid â use fixed widthsspace-relative-sizing-fails– Avoid viewport-relative units for element sizingspace-mobile-first– Design mobile-first at ~400px, then expand
3. Typography (HIGH)
type-line-length– Keep line length between 45-75 characterstype-line-height-inverse– Line height and font size are inversely proportionaltype-font-weight-variety– Choose fonts with at least 5 weight variationstype-no-center-long-text– Don’t center long-form text â left-align body contenttype-letter-spacing– Tighten letter spacing for headlines, loosen for uppercasetype-align-numbers-right– Right-align numbers in tables for easy comparison
4. Color Systems (HIGH)
color-define-palette-upfront– Define a complete color palette upfront â don’t pick colors ad-hoccolor-grayscale-first– Design in grayscale first, add color lastcolor-accessible-contrast– Ensure 4.5:1 contrast ratio for body textcolor-dark-gray-not-black– Use dark gray instead of pure black for textcolor-saturated-grays– Add subtle saturation to grays for warmth or coolnesscolor-light-backgrounds-dark-text– Use light-colored backgrounds with dark text for badges
5. Depth & Shadows (MEDIUM)
depth-shadow-scale– Define a fixed shadow scale â small to extra largedepth-shadow-vertical-offset– Use vertical offset for natural-looking shadowsdepth-interactive-elevation– Use shadow changes to communicate interactivitydepth-light-closer-dark-recedes– Lighter colors feel closer, darker colors recededepth-overlap-layers– Overlap elements to create visual layers
6. Borders & Separation (MEDIUM)
sep-fewer-borders– Use fewer borders â replace with spacing, shadows, or background colorsep-background-color-separation– Use background color differences to separate sectionssep-table-spacing-not-lines– Use spacing instead of lines in simple tablessep-card-radio-buttons– Convert radio buttons and checkboxes to selectable cards
7. Images & Content (LOW-MEDIUM)
img-control-user-content– Control user-uploaded image size and aspect ratioimg-text-overlay– Add overlays or reduce contrast for text over imagesimg-dont-scale-up-icons– Don’t scale up icons designed for small sizesimg-empty-states– Design meaningful empty states with clear CTAs
8. Polish & Details (LOW)
polish-accent-borders– Add accent borders to highlight important elementspolish-custom-bullets– Replace default bullets with icons or checkmarkspolish-border-radius-personality– Match border radius to brand personalitypolish-gradient-close-hues– Use gradients with hues within 30 degrees of each otherpolish-inner-shadow-images– Add inner shadow to prevent image background bleed
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 |