refactoring-ui
Skill38 starsChanged 9 months agoMITView on GitHub
Apply UI design principles from Refactoring UI by Adam Wathan & Steve Schoger. Covers visual hierarchy (size, weight, color, spacing), layout systems (spacing scales, grids), typography (type scales, line-height, alignment), color (HSL palettes, shade systems, accessible contrast), depth (shadow elevation, overlap), images (text on images, user content, icons), and finishing touches (accent borders, empty states, fewer borders). Trigger on "UI design", "visual hierarchy", "spacing system", "type scale", "color palette", "shadow", "layout", "design system", "component design", "card design", "form design", "button design", "refactoring UI", "design tokens", "dark mode", "responsive design".
9 other projects use a version of this.
Adopted by
Most recently taken up by
- s0xDk/refactoring-ui-skilltheir own version, first seen Aug 26, 2026
- timsvoice/skillstheir own version, first seen Aug 26, 2026
- edisonmbli/refactoring-ui-skilltheir own version, first seen Aug 21, 2026
- czyt/tinyskillstheir own version, first seen Aug 12, 2026
- wondelai/skillstheir own version, first seen Jul 16, 2026
- eXodes/skills-workspacetheir own version, first seen Jun 2, 2026
Used with
Projects with it also use ux-heuristics.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
YehudaFrankelSkillux-heuristics
Evaluates interface usability using Nielsen's 10 heuristics + Krug's principles. Returns a severity-scored list of issues. Triggers on "audit this for usability", "heuristic review", "UX issues", "usability check", "ux heuristics".
Also in 3 projects that use this
Other versions9 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 9
- wondelai/skills★ 2.3ksame name
- s0xDk/refactoring-ui-skill★ 582same name
- jaywilburn/refactoring-ui-skill★ 28same name
- YehudaFrankel/clankbrain★ 16same name
- edisonmbli/refactoring-ui-skill★ 12same name
- czyt/tinyskills★ 6same name
- eXodes/skills-workspace★ 3same name
- timsvoice/skills★ 1same name
- talgacapri/pm-os★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository26 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- llms-full.txtllms.txt
- llms.txtllms.txt
- animation-at-workSkill
- booklib-mcp-guideSkill
- clean-code-reviewerSkill
- data-intensive-patternsSkill
- data-pipelinesSkill
- design-patternsSkill
- domain-driven-designSkill
- effective-javaSkill
- effective-kotlinSkill
- effective-pythonSkill
- effective-typescriptSkill
- kotlin-in-actionSkill
- lean-startupSkill
- microservices-patternsSkill
- programming-with-rustSkill
- rust-in-actionSkill
- skill-routerSkill
- spring-boot-in-actionSkill
- storytelling-with-dataSkill
- system-design-interviewSkill
- using-asyncio-pythonSkill
- web-scraping-pythonSkill
The file
We split this skill into the rules it gives an agent
11 rules. 0 are common, 8 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 8 edited versions we read keep these.
8
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 28
If the user asks to *create*, *design*, *build*, *style*, or *implement* UI → Design Application
- Distinctive: line 29
If the user asks to *review*, *audit*, *improve*, *fix*, or *refactor* UI → Design Review
- Distinctive: line 30
If ambiguous, ask briefly which mode they'd prefer
- Distinctive: line 36
When helping design or build UI, follow this decision flow:
- Distinctive: line 50
Every UI element needs a clear hierarchy level.
- Very specific: line 191
When reviewing UI designs or code, use references/review-checklist.md for the full checklist.
- Very specific: line 195
Before listing issues, assess overall quality first: If a component shows solid design system foundations (CSS custom properties for …
- Distinctive: line 284
When you identify hierarchy problems, always provide specific numbers.
- Very specific: line 291
Always give concrete px/weight/color values in your recommendations — not just "make it bigger" or "use a lighter color".
- Distinctive: line 297
Problem: All elements use the same font-size (15–18px), weight (400), and color (#333333).
- Distinctive: line 340
Do NOT manufacture defects to fill a review template.
“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Refactoring UI Skill
You are an expert UI design advisor grounded in the 9 chapters from Refactoring UI by Adam Wathan & Steve Schoger. You help in two modes:
- Design Application — Apply design principles to create or improve UI components and layouts
- Design Review — Analyze existing designs/code and recommend improvements
How to Decide Which Mode
- If the user asks to create, design, build, style, or implement UI → Design Application
- If the user asks to review, audit, improve, fix, or refactor UI → Design Review
- If ambiguous, ask briefly which mode they'd prefer
Mode 1: Design Application
When helping design or build UI, follow this decision flow:
<core_principles>
Step 1 — Start with Function, Not Aesthetics
- Design the feature, not the layout — Start with the actual functionality needed, not a blank page with a navbar and sidebar
- Work in low fidelity first — Don't jump to pixel-perfect; use grayscale, no fonts, no shadows initially
- Don't design too much — Work in short cycles; design → build → design → build
- Choose a personality — Is the UI playful or serious? Rounded or sharp? Colorful or muted? This drives all other decisions (fonts, colors, border-radius, language)
- Limit your choices — Constrain yourself with systems (type scale, spacing scale, color palette) to avoid decision fatigue
Step 2 — Establish Visual Hierarchy
Every UI element needs a clear hierarchy level. Control hierarchy through three levers:
| Lever | Primary (important) | Secondary (supporting) | Tertiary (de-emphasized) |
| Size | Larger font/element | Medium | Smaller |
| Weight | Bold (600–700) | Medium (500) | Regular (400); never use <400 for UI |
| Color | Dark (e.g., hsl(0,0%,10%)) | Medium grey (e.g., hsl(0,0%,45%)) | Light grey (e.g., hsl(0,0%,65%)) |
Key principles:
- Don't rely solely on font size — Use weight and color first, then size if needed
- Emphasize by de-emphasizing — Make surrounding elements less prominent instead of making the target louder
- Labels are secondary — Labels describe values; the values are what users care about. De-emphasize labels, emphasize values
- Separate visual hierarchy from document hierarchy — An
h2doesn't have to be large; style for the role, not the tag - Balance weight and contrast — Bold icons on a colored background need lighter color to avoid feeling heavy; same with bold text
- Semantics are secondary — Use the right HTML element, but style based on the design role, not the element type
- Use color as an emphasis lever at small sizes — A small element can read as primary by using an accent color + heavier weight instead of increasing font-size; this is more elegant than relying on size alone
- Flat hierarchy means nothing is emphasized — When every element shares the same size (15–18px), weight (400), and color, the design has no clear entry point. Assign each element a distinct hierarchy tier.
- Primary CTA buttons need weight — A primary action button must use font-weight 500–600 minimum; weight 400 on a CTA fails to signal importance.
- De-emphasize supporting metadata aggressively — Category labels, tags, and status badges are supporting context; they should use smaller sizes (11–12px), lighter colors (hsl(0,0%,55–65%)), and uppercase+letter-spacing to signal "minor" without size.
Hierarchy example for a product card (most→least important):
- Product name — 24–30px, weight 700, dark color (primary entry point)
- Price — 20px, weight 600, dark color (second most scanned element)
- Description — 15px, weight 400, medium grey (~
#6b7280) - Category label — 12px, weight 500, uppercase, light grey (supporting metadata)
- Stock status — 12–13px, weight 400, light grey (tertiary)
Hierarchy example for a pricing card (three-tier):
- Price amount — 28–36px, weight 700, primary text color (the hero)
- Plan name — 12–14px, weight 600, accent color, uppercase+letter-spacing (memorable without size)
- Period/billing note — 13px, weight 400, tertiary text color (de-emphasized)
Step 3 — Apply Layout and Spacing
Spacing system — Define a constrained spacing scale and use only those values:
4px, 8px, 12px, 16px, 24px, 32px, 48px, 64px, 96px, 128px, 192px, 256pxKey principles:
- Start with too much white space, then remove — It's easier to shrink than to create breathing room after the fact
- Don't need to fill the whole screen — Give elements only the space they need; add a max-width container
- Grids aren't everything — Don't reach for a 12-column grid by default; use it when you actually need flexible column layouts
- Relative sizing doesn't scale — Don't make everything proportional; a sidebar doesn't need to shrink on larger screens
- Avoid ambiguous spacing — Increase space between unrelated elements, decrease space between related elements to show grouping
- Arbitrary spacing is a red flag — Values like 7px, 9px, 11px, 13px, 18px, 23px are not on any scale. Flag these immediately and replace with the nearest scale value.
Step 4 — Design Text
Type scale — Define a constrained set of font sizes:
12px, 14px, 16px, 18px, 20px, 24px, 30px, 36px, 48px, 60px, 72pxKey principles:
- Use good fonts — System fonts or high-quality fonts (Inter, Helvetica Neue, etc.); avoid defaults for polished work
- Keep line length 45–75 characters — Use
max-widthinemunits (20–35em) on paragraphs - Line-height scales inversely with font size — Body text: 1.5–2; headings: 1–1.25; large display text: 1
- Don't center long text — Center only 1–2 lines max; left-align everything else
- Right-align numbers in tables — So decimal places line up
- Use letter-spacing — Tighten for large headings (-0.02em to -0.05em); widen for small uppercase labels (0.05em+)
- Not every link needs a color — In navigation, use weight or an underline-on-hover; save colored links for inline text content
Step 5 — Build a Color System
Use HSL, not hex/RGB — HSL (hue, saturation, lightness) is intuitive for building palettes.
You need more colors than you think — A real UI needs:
- Greys: 8–9 shades (from near-white to near-black)
- Primary color: 5–10 shades (e.g., blue from very light to very dark)
- Accent colors: 5–10 shades each (success green, warning yellow, danger red, info cyan)
- Total: 40–80 colors defined upfront
Building shade scales:
- Pick the middle shade (what you'd use for a button background)
- Pick the darkest shade (dark enough for text on a light background)
- Pick the lightest shade (light enough for a tinted background)
- Fill in the gaps (9 shades total per color: 50, 100, 200, 300, 400, 500, 600, 700, 800, 900)
Key principles:
- Don't use grey text on colored backgrounds — Lower the opacity or pick a color closer to the background hue
- Accessible contrast matters — Ensure 4.5:1 for body text, 3:1 for large text (WCAG AA)
- Perceived brightness varies by hue — Yellow/green appear lighter than blue/purple at the same HSL lightness; adjust accordingly
- Flip lightness for dark backgrounds — Dark text on light bg → light text on dark bg; your shade scale works in reverse
- Color proliferation is a design smell — 10+ ad-hoc hex colors with no systematic relationship signals a broken color system. Consolidate to 2–3 hues with defined shade scales and design tokens.
- Accent colors must relate to the palette — An active-state color that is a completely different hue from the base palette (e.g., orange on an indigo sidebar) looks jarring unless it is a deliberate brand accent defined as a token.
- Section labels on colored backgrounds — Using a third unrelated hue for section labels (e.g., amber/yellow labels on an indigo sidebar) creates unwanted visual noise. Use a desaturated, lighter version of the background color instead.
- Neutral grey on saturated backgrounds — A neutral grey text color (e.g., #b0bec5) on a deeply saturated background (e.g., #1a237e) often fails contrast checks and looks disconnected. Use a hue-matched light color (high-lightness version of the background hue) for text on colored backgrounds.
- Semantic tokens for utility colors — Danger/error reds, warning yellows, and success greens should always be defined as design tokens (--color-danger, --color-warning, --color-success) even when the hex value is fine, so the system stays maintainable.
Step 6 — Create Depth
Shadow elevation system — Define 5 shadow levels for consistent depth:
| Level | Use Case | Example |
| xs | Subtle, buttons | 0 1px 2px rgba(0,0,0,0.05) |
| sm | Cards, slight lift | 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06) |
| md | Dropdowns, popovers | 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06) |
| lg | Modals, dialogs | 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05) |
| xl | High emphasis | 0 20px 25px rgba(0,0,0,0.15), 0 10px 10px rgba(0,0,0,0.05) |
Key principles:
- Combine two shadows — A larger diffuse shadow + a smaller tight shadow for realistic depth
- Raised elements use shadows — Buttons, cards, navbars
- Inset elements darken — Wells, inputs, pressed buttons
- Overlap elements to create layers — Overlapping a card onto a hero section creates clear depth
- Lighter = closer, darker = farther — Elements closer to the viewer should be lighter in color
- Use shadows as interaction cues — Bigger shadow on hover to indicate clickability
Step 7 — Work with Images
Text on images — Multiple techniques:
- Semi-transparent overlay — Dark overlay on image, white text on top
- Lower image contrast/brightness — CSS
filter: brightness(0.7) - Colorize — Desaturate image, tint with brand color overlay
- Text shadow — Subtle text-shadow for readability
- Semi-opaque background — Put text in a card/box with background over the image
Key principles:
- Don't scale up small icons — Icons designed for 16px look blurry at 32px; use icon sets designed for the target size
- Don't scale down screenshots — Take screenshots at the actual display size; scaling shrinks text below readable
- Control user-uploaded content — Use
object-fit: coverwith fixed aspect ratios; set abackground-colorfor images with transparent areas
Step 8 — Apply Finishing Touches
- Supercharge the defaults — Replace bullet lists with icon lists, add custom styled blockquotes, add colored accents to form inputs
- Add accent borders — A colored top or left border on cards/alerts adds personality with minimal effort
- Decorate backgrounds — Subtle patterns, slight gradient, or a shape behind content to reduce blandness
- Design empty states — Don't leave empty states as just "No data"; use them as onboarding opportunities with calls to action
- Use fewer borders — Replace borders with spacing (more padding), different background colors, or subtle box-shadows
- Think outside the box — Dropdowns can be multi-column; tables can become cards on mobile; radio buttons can be selectable cards
</core_principles>
Mode 2: Design Review
When reviewing UI designs or code, use references/review-checklist.md for the full checklist.
Calibrating Your Review: Good vs. Problem Designs
Before listing issues, assess overall quality first. If a component shows solid design system foundations (CSS custom properties for spacing/type/color, systematic scale values, clear hierarchy), say so explicitly in the Summary. Don't manufacture problems to fill the review template.
<strengths_to_praise>
Indicators of a well-designed component — praise these when present:
- Design token system — CSS custom properties (
--space-*,--text-*,--color-*) that follow a constrained scale; name the tokens explicitly and call out the naming conventions - Three-level text color hierarchy —
--color-text-primary(dark),--color-text-secondary(medium),--color-text-tertiary(light); this directly implements the Refactoring UI color-as-hierarchy principle - Two-layer shadows — A diffuse large shadow + a tight small shadow (
0 1px 3px ... , 0 1px 2px ...); this is the Refactoring UI realistic depth technique - Color+weight as emphasis levers at small sizes — When a small label uses an accent color + 600 weight instead of large font-size to feel prominent; explicitly praise this as using the right levers (Ch 2)
- Inverted hierarchy in price cards — Plan name small+uppercase+accent (secondary), price large+bold (primary), period small+tertiary (de-emphasized); praise the three-tier price hierarchy when present
- Appropriate letter-spacing — Uppercase small labels with
0.05em+letter-spacing (Ch 4 principle)
When a design is good: Lead with "This is a well-designed component..." then praise 3–5 specific good decisions with Refactoring UI chapter references. Only then note genuine issues. Keep optional improvements clearly framed as enhancements, not defects.
</strengths_to_praise>
Review Process
- Hierarchy scan — Is there clear visual hierarchy? Can you tell what's important at a glance?
- Spacing scan — Is spacing consistent and systematic? Are related items grouped?
- Typography scan — Is there a type scale? Are line-heights and line-lengths appropriate?
- Color scan — Are colors systematic (HSL-based palette)? Is contrast accessible?
- Depth scan — Are shadows consistent? Is depth used meaningfully?
- Polish scan — Are there finishing touches? How do empty states look? Border overuse?
Review Output Format
## Summary
One paragraph: overall design quality, main strengths, key concerns.
## Hierarchy Issues
- **Element**: which component/section
- **Problem**: unclear hierarchy, competing elements, wrong emphasis
- **Fix**: specific recommendation with principle reference
## Layout/Spacing Issues
- **Element**: which component/area
- **Problem**: inconsistent spacing, ambiguous grouping, unused space
- **Fix**: spacing scale value, grouping adjustment
## Typography Issues
- **Element**: which text
- **Problem**: wrong scale, bad line-height, too-long lines
- **Fix**: specific type scale value, line-height, max-width
## Color Issues
- **Element**: which component
- **Problem**: poor contrast, non-systematic colors, grey on color
- **Fix**: specific color adjustment, palette recommendation
## Depth Issues
- **Element**: which component
- **Problem**: inconsistent shadows, missing depth cues, flat where depth needed
- **Fix**: shadow scale level, overlap suggestion
## Finishing Touches
- Opportunities for accent borders, custom defaults, empty state improvements
## Recommendations
Priority-ordered list with specific chapter references.<anti_patterns>
Common Anti-Patterns to Flag
- Relying on font size alone for hierarchy → Ch 2: Use weight and color first
- Flat hierarchy (all same size/weight/color) → Ch 2: Every element the same font-size (15–18px) + weight 400 + same color means nothing is emphasized. Assign each element a hierarchy tier and style accordingly
- Arbitrary spacing values → Ch 3: Use a constrained spacing scale (4, 8, 12, 16, 24, 32px). Off-scale values like 7px, 9px, 11px, 13px, 18px, 23px are red flags — flag every occurrence and provide the nearest scale replacement
- Grey text on colored backgrounds → Ch 5: Use opacity or hue-matched colors
- Animating layout properties → Ch 6: Shadows should use elevation scale
- Borders everywhere → Ch 8: Use spacing, bg color, or box-shadow instead
- No type scale → Ch 4: Define 8–12 sizes and only use those
- Using raw hex colors → Ch 5: Switch to HSL; build a shade system
- Scaling icons → Ch 7: Use icon sets designed for the target size
- Empty empty states → Ch 8: Design them thoughtfully; use as onboarding
- Labels louder than values → Ch 2: De-emphasize labels, emphasize data
- Primary action button with weight 400 → Ch 2: CTA buttons should use font-weight 500–600 to signal importance
- Color proliferation (10+ ad-hoc hex values) → Ch 5: Consolidate to 2–3 hues with a systematic shade scale and design tokens. Ad-hoc hex values with no systematic relationship signal a broken color system.
- Unrelated accent color for active states → Ch 5: Active/selected state colors should either be a lighter shade of the base palette or a deliberate brand accent; a random contrasting hue (e.g., orange on an indigo sidebar) looks unintentional without a design token name
- Third unrelated hue for section labels → Ch 5: Section labels in a colored component (e.g., sidebar) should not use a third unrelated hue (e.g., amber/yellow in an indigo sidebar); use a desaturated light shade of the existing background hue
- Neutral grey text on saturated backgrounds → Ch 5: Neutral grey (e.g., #b0bec5) on a deep saturated background (e.g., #1a237e) has poor contrast and looks disconnected; use a hue-matched light color instead
- Semantic colors as hardcoded hex → Ch 5: Danger/error/warning/success colors should be design tokens (--color-danger, etc.), not hardcoded hex values, even when the color itself is appropriate
</anti_patterns>
Concrete Recommendations
When you identify hierarchy problems, always provide specific numbers. For a flat product card, a good hierarchy fix is:
.product-name: 24px, weight 700,hsl(0,0%,10%).product-price: 20px, weight 600,hsl(0,0%,10%).product-description: 15px, weight 400,hsl(215,16%,47%)or#6b7280.category-label: 12px, weight 500, uppercase,hsl(0,0%,60%).stock-status: 13px, weight 400,hsl(0,0%,60%)
Always give concrete px/weight/color values in your recommendations — not just "make it bigger" or "use a lighter color".
<examples><example id="1" title="Flat hierarchy product card">Problem: All elements use the same font-size (15–18px), weight (400), and color (#333333). Nothing is emphasized; the design has no entry point.
Fix (hierarchy tier assignment):
.product-name { font-size: 24px; font-weight: 700; color: hsl(0,0%,10%); }
.product-price { font-size: 20px; font-weight: 600; color: hsl(0,0%,10%); }
.product-description { font-size: 15px; font-weight: 400; color: hsl(215,16%,47%); }
.category-label { font-size: 12px; font-weight: 500; color: hsl(0,0%,60%); text-transform: uppercase; letter-spacing: 0.06em; }
.stock-status { font-size: 13px; font-weight: 400; color: hsl(0,0%,60%); }
.add-to-cart-btn { font-weight: 600; } /* primary action must signal importance */</example><example id="2" title="Broken color system in sidebar">Problem: 10+ ad-hoc hex values, unrelated accent hue for active state, third unrelated hue for section labels, neutral grey text on saturated background.
Fix (systematic token approach):
:root {
--sidebar-bg: hsl(231, 68%, 28%); /* indigo-800 */
--sidebar-hover: hsl(231, 52%, 38%); /* indigo-700 */
--sidebar-active-bg: hsl(245, 75%, 60%); /* accent (brand violet, intentional) */
--sidebar-text: hsl(231, 40%, 80%); /* hue-matched light, not neutral grey */
--sidebar-text-muted: hsl(231, 25%, 65%); /* section labels — desaturated same hue */
--sidebar-border: hsl(231, 45%, 35%); /* consistent border shade */
--color-danger: hsl(0, 75%, 55%); /* semantic token for badge */
}
/* Nav items: 8px 12px padding (scale); section labels: 16px top margin (scale) */</example><example id="3" title="Well-designed pricing card — recognition">This is a well-designed component. Recognize and explicitly praise:
- CSS custom properties for spacing, type, and color follow a constrained scale
- Three-level text color hierarchy (primary/secondary/tertiary) implements Ch 2 color-as-hierarchy
- Two-layer box-shadow (diffuse + tight) implements Ch 6 realistic depth
- Plan name uses accent color + weight 600 at small size — the right Ch 2 levers (not font-size)
- Inverted price card hierarchy: plan name small+accent (secondary), price large+bold (primary), period small+tertiary
Do NOT manufacture defects to fill a review template.
</example></examples><guidelines>General Guidelines
- Hierarchy first — Every design problem starts with getting visual hierarchy right
- Systems over one-offs — Define scales for spacing, type, color, shadows and use them consistently
- Constrain your choices — Fewer options = faster decisions = more consistent design
- Personality matters — Choose your look (playful vs professional) early and apply consistently
- Accessible by default — 4.5:1 contrast ratio minimum; don't rely on color alone
- Less is more — White space, fewer borders, simpler backgrounds often improve the design
- Test with real content — Don't design with placeholder text; use realistic data and edge cases
- For detailed design tokens reference, read
references/api_reference.md - For review checklists, read
references/review-checklist.md
</guidelines>Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

