К основному содержанию
скилл CX Codex

tailwind-ui-refactor — скилл для Claude Code: рефакторинг UI

Скилл для рефакторинга HTML с классами Tailwind: подсказывает, как выстроить иерархию, отступы, типографику и цвет. Пригодится, когда верстаешь без дизайнера.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add pproenca/dot-skills --skill tailwind-ui-refactor -a claude-code
Открыть на GitHub

Что делает tailwind-ui-refactor

Скилл собран по книге Refactoring UI Адама Уотерса и Стива Шогера и переложен на утилитарные классы Tailwind. Внутри 52 правила по 9 категориям, отсортированные по силе влияния на дизайн: сначала замысел интерфейса, иерархия и раскладка, потом типографика с цветом, а тени, границы и мелкая полировка идут в конце. Синтаксис — Tailwind CSS v4, для v3 в правилах есть пометки, где он отличается.

Главная мысль скилла: сначала думать, потом стилизовать. Прежде чем менять классы, агент разбирает, что сообщает каждый элемент и что важно пользователю, и убирает лишнее. Простой компонент с меньшим числом узлов он ставит выше украшенного. Это стоит держать в голове: если ждёшь от скилла только косметики, он начнёт с пересборки разметки.

Правила лежат отдельными файлами в references/ и вызываются по префиксам — intent-, hier-, space-, type-, color-, depth-, sep-, img-, polish-. Скилл подхватывает задачи по чистке интерфейса, ревью дизайна, стилизации компонентов и правкам контраста.

Какие задачи решает

  • разгрести визуальную иерархию в готовом компоненте
  • выбрать отступы по шкале, а не наугад
  • поправить длину строки и межстрочный интервал в тексте
  • собрать палитру заранее вместо подбора цветов по ходу
  • починить контраст текста под 4.5:1

Примеры запросов агенту

  • отрефактори этот компонент по правилам tailwind-ui-refactor
  • проверь иерархию и отступы в src/components/Card.tsx
  • пройдись по правилам категории space- в этой разметке

Как установить tailwind-ui-refactor

1Через Skills CLI (Vercel)

npx skills add pproenca/dot-skills --skill tailwind-ui-refactor -a claude-code

2Вручную: положить файлы

~/.claude/skills/tailwind-ui-refactor/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/tailwind-ui-refactor/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о tailwind-ui-refactor

Как установить tailwind-ui-refactor в Claude?

Выполни npx skills add pproenca/dot-skills --skill tailwind-ui-refactor -a claude-code. Скилл окажется в ~/.claude/skills/tailwind-ui-refactor/SKILL.md.

Что делает tailwind-ui-refactor?

Даёт агенту 52 правила по дизайну интерфейсов на Tailwind CSS: иерархия, отступы, типографика, цвет, тени, границы. Правила применяются при написании и ревью HTML с утилитарными классами.

С какими версиями Tailwind работает скилл?

Правила написаны под Tailwind CSS v4, для v3 в них есть отдельные пометки о различиях в синтаксисе.

Исходный текст

SKILL.md · MIT
---
name: tailwind-ui-refactor
description: 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.
---

# 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 | `intent-` |
| 2 | Visual Hierarchy | CRITICAL | `hier-` |
| 3 | Layout & Spacing | CRITICAL | `space-` |
| 4 | Typography | HIGH | `type-` |
| 5 | Color Systems | HIGH | `color-` |
| 6 | Depth & Shadows | MEDIUM | `depth-` |
| 7 | Borders & Separation | MEDIUM | `sep-` |
| 8 | Images & Content | LOW-MEDIUM | `img-` |
| 9 | Polish & Details | LOW | `polish-` |

## Quick Reference

### 1. Design Intent (CRITICAL)

- [`intent-audit-before-styling`](references/intent-audit-before-styling.md) - Audit what each element communicates before changing any CSS
- [`intent-remove-before-decorating`](references/intent-remove-before-decorating.md) - Remove unnecessary elements before styling what remains
- [`intent-reduce-cognitive-load`](references/intent-reduce-cognitive-load.md) - Reduce choices per screen — fewer options beat prettier options
- [`intent-progressive-disclosure`](references/intent-progressive-disclosure.md) - Hide secondary information behind interactions
- [`intent-content-drives-layout`](references/intent-content-drives-layout.md) - Let real content determine layout — not the other way around
- [`intent-simplify-over-decorate`](references/intent-simplify-over-decorate.md) - Prefer removing a wrapper over adding 5 utility classes to it
- [`intent-match-context-fidelity`](references/intent-match-context-fidelity.md) - Match design polish to context — admin vs consumer vs product
- [`intent-match-existing-patterns`](references/intent-match-existing-patterns.md) - Audit sibling component patterns before restyling

### 2. Visual Hierarchy (CRITICAL)

- [`hier-size-weight-color`](references/hier-size-weight-color.md) - Use size, weight, and color for hierarchy — not just size
- [`hier-deemphasize-secondary`](references/hier-deemphasize-secondary.md) - De-emphasize secondary content instead of emphasizing primary
- [`hier-button-hierarchy`](references/hier-button-hierarchy.md) - Style buttons by visual hierarchy, not semantic importance
- [`hier-label-value-pairs`](references/hier-label-value-pairs.md) - Combine labels and values into natural language
- [`hier-semantic-vs-visual`](references/hier-semantic-vs-visual.md) - Separate visual hierarchy from document hierarchy
- [`hier-icon-sizing`](references/hier-icon-sizing.md) - Size icons relative to adjacent text, not to fill space
- [`hier-color-hierarchy-on-dark`](references/hier-color-hierarchy-on-dark.md) - Use opacity or muted colors for hierarchy on colored backgrounds

### 3. Layout & Spacing (CRITICAL)

- [`space-start-generous`](references/space-start-generous.md) - Start with too much whitespace, then remove
- [`space-systematic-scale`](references/space-systematic-scale.md) - Use a constrained spacing scale, not arbitrary values
- [`space-relationship-proximity`](references/space-relationship-proximity.md) - Use spacing to show relationships between elements
- [`space-dont-fill-screen`](references/space-dont-fill-screen.md) - Constrain content width — avoid filling the whole screen
- [`space-grids-not-required`](references/space-grids-not-required.md) - Use fixed widths when grids are not needed
- [`space-relative-sizing-fails`](references/space-relative-sizing-fails.md) - Avoid raw viewport units without clamping
- [`space-mobile-first`](references/space-mobile-first.md) - Design mobile-first at ~400px, then expand

### 4. Typography (HIGH)

- [`type-line-length`](references/type-line-length.md) - Keep line length between 45-75 characters
- [`type-line-height-inverse`](references/type-line-height-inverse.md) - Line height and font size are inversely proportional
- [`type-font-weight-variety`](references/type-font-weight-variety.md) - Choose fonts with at least 5 weight variations
- [`type-no-center-long-text`](references/type-no-center-long-text.md) - Left-align body content — avoid centering long-form text
- [`type-letter-spacing`](references/type-letter-spacing.md) - Tighten letter spacing for headlines, loosen for uppercase
- [`type-align-numbers-right`](references/type-align-numbers-right.md) - Align numbers right in tables for easy comparison

### 5. Color Systems (HIGH)

- [`color-define-palette-upfront`](references/color-define-palette-upfront.md) - Define a complete color palette upfront — don't pick colors ad-hoc
- [`color-grayscale-first`](references/color-grayscale-first.md) - Design in grayscale first, add color last
- [`color-accessible-contrast`](references/color-accessible-contrast.md) - Ensure 4.5:1 contrast ratio for body text
- [`color-dark-gray-not-black`](references/color-dark-gray-not-black.md) - Use dark gray instead of pure black for text
- [`color-saturated-grays`](references/color-saturated-grays.md) - Add subtle saturation to grays for warmth or coolness
- [`color-light-backgrounds-dark-text`](references/color-light-backgrounds-dark-text.md) - Use light-colored backgrounds with dark text for badges

### 6. Depth & Shadows (MEDIUM)

- [`depth-shadow-scale`](references/depth-shadow-scale.md) - Define a fixed shadow scale — small to extra large
- [`depth-shadow-vertical-offset`](references/depth-shadow-vertical-offset.md) - Use vertical offset for natural-looking shadows
- [`depth-interactive-elevation`](references/depth-interactive-elevation.md) - Use shadow changes to communicate interactivity
- [`depth-light-closer-dark-recedes`](references/depth-light-closer-dark-recedes.md) - Lighter colors feel closer, darker colors recede
- [`depth-overlap-layers`](references/depth-overlap-layers.md) - Overlap elements to create visual layers

### 7. Borders & Separation (MEDIUM)

- [`sep-fewer-borders`](references/sep-fewer-borders.md) - Use fewer borders — replace with spacing, shadows, or background color
- [`sep-background-color-separation`](references/sep-background-color-separation.md) - Use background color differences to separate sections
- [`sep-table-spacing-not-lines`](references/sep-table-spacing-not-lines.md) - Use spacing instead of lines in simple tables
- [`sep-card-radio-buttons`](references/sep-card-radio-buttons.md) - Upgrade radio buttons to selectable cards for key choices

### 8. Images & Content (LOW-MEDIUM)

- [`img-control-user-content`](references/img-control-user-content.md) - Control user-uploaded image size and aspect ratio
- [`img-text-overlay`](references/img-text-overlay.md) - Add overlays or reduce contrast for text over images
- [`img-dont-scale-up-icons`](references/img-dont-scale-up-icons.md) - Avoid scaling up icons designed for small sizes
- [`img-empty-states`](references/img-empty-states.md) - Design meaningful empty states with clear CTAs

### 9. Polish & Details (LOW)

- [`polish-accent-borders`](references/polish-accent-borders.md) - Add accent borders to highlight important elements
- [`polish-custom-bullets`](references/polish-custom-bullets.md) - Replace default bullets with icons or checkmarks
- [`polish-border-radius-personality`](references/polish-border-radius-personality.md) - Match border radius to brand personality
- [`polish-gradient-close-hues`](references/polish-gradient-close-hues.md) - Use gradients with hues within 30 degrees of each other
- [`polish-inner-shadow-images`](references/polish-inner-shadow-images.md) - Add inner shadow to prevent image background bleed

## 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](references/_sections.md) - Category structure and impact levels
- [Rule template](assets/templates/_template.md) - Template for adding new rules

## Reference Files

| File | Description |
|------|-------------|
| [references/_sections.md](references/_sections.md) | Category definitions and ordering |
| [assets/templates/_template.md](assets/templates/_template.md) | Template for new rules |
| [metadata.json](metadata.json) | Version and reference information |

© pproenca · MIT · pproenca/dot-skills

Похожие скиллы

Всё по теме «Фронтенд и UI» →
converting-css-to-tailwind spencerpauly Скилл проходит по CSS-файлу и переносит правила в Tailwind-классы прямо в разметке. Полезен при переезде проекта со старого CSS на утилиты. CX Codex +1 423установок converting-css-modules-to-tailwind spencerpauly Переводит компонент с CSS Modules на утилитарные классы Tailwind: разбирает styles.xxx, чистит импорты и удаляет файл модуля. CX Codex +1 392установок frontend-tailwind-best-practices sergiodxa Набор правил Tailwind CSS для фронтенда: стеки, отступы через gap, тёмная тема и слияние классов. Пригодится, когда агент пишет стили компонентов и ломает вёрстку. CX Codex +1 464установок tailwind-css manutej Скилл по Tailwind CSS: утилитарные классы, адаптивность, тёмная тема и оптимизация сборки. Пригодится, когда верстаешь интерфейс и не хочешь прыгать в CSS-файлы. CX Codex +1 461установок tailwind PyModel Скилл с 42 правилами по Tailwind CSS v4: сборка, генерация CSS, размер бандла, темизация. Пригодится при миграции и настройке. CX Codex +1 512установок tailwind-patterns davila7 Скилл для Claude, который задаёт агенту правила Tailwind CSS v4: конфигурация в CSS, контейнерные запросы, архитектура токенов. Пригодится тем, кто пишет интерфейс на утилитах. 2 720установок

Из того же набора45

shell Скилл с 49 правилами для bash и POSIX sh: цитирование переменных, строгий режим, обработка ошибок. Пригодится, когда агент пишет или правит скрипты. CX Codex +1 692установок refactor Набор из 43 правил рефакторинга по каталогу Мартина Фаулера и принципам Clean Code. Пригодится, когда агент правит чужой код и нужно, чтобы он делал это по понятным правилам. CX Codex +1 641установок react Скилл с 49 правилами React 19 и алгоритмом ревью кодовой базы. Пригодится при написании компонентов, миграции с React 18 и аудите репозитория. CX Codex +1 489установок tailwind-responsive-ui Скилл для Claude и других ИИ-редакторов: помогает переделывать интерфейсы на Tailwind CSS под мобильные и десктопные экраны. CX Codex +1 461установок zustand Скилл с 43 правилами для Zustand в React: архитектура сторов, селекторы, лишние ре-рендеры. Пригодится, когда пишете или рефакторите стор. CX Codex +1 446установок debug Скилл задаёт агенту порядок разбора багов: воспроизведение, гипотезы, поиск корневой причины. Пригодится, когда падает стек, тест или прод. CX Codex +1 436установок ios-design Скилл с 62 правилами вёрстки интерфейсов на SwiftUI: семантические цвета, типографика, состояния, навигация и доступность. CX Codex +1 418установок feature-arch Разбирает React-проект по фичам и выдаёт blueprint целевой архитектуры с деревом каталогов, публичными API и планом миграции. CX Codex +1 412установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой