booklib-ai/skills/refactoring-ui

Claude Code and agent skill by booklib-ai/skills

Trust tier 2
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

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".

Install

npx vskill@latest install booklib-ai/skills/refactoring-ui

SKILL.md

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:

  1. Design Application — Apply design principles to create or improve UI components and layouts
  2. 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:

LeverPrimary (important)Secondary (supporting)Tertiary (de-emphasized)
SizeLarger font/elementMediumSmaller
WeightBold (600–700)Medium (500)Regular (400); never use <400 for UI
ColorDark (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 h2 doesn'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):

  1. Product name — 24–30px, weight 700, dark color (primary entry point)
  2. Price — 20px, weight 600, dark color (second most scanned element)
  3. Description — 15px, weight 400, medium grey (~#6b7280)
  4. Category label — 12px, weight 500, uppercase, light grey (supporting metadata)
  5. Stock status — 12–13px, weight 400, light grey (tertiary)

Hierarchy example for a pricing card (three-tier):

  1. Price amount — 28–36px, weight 700, primary text color (the hero)
  2. Plan name — 12–14px, weight 600, accent color, uppercase+letter-spacing (memorable without size)
  3. 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, 256px

Key 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, 72px

Key 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-width in em units (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:

  1. Pick the middle shade (what you'd use for a button background)
  2. Pick the darkest shade (dark enough for text on a light background)
  3. Pick the lightest shade (light enough for a tinted background)
  4. 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:

LevelUse CaseExample
xsSubtle, buttons0 1px 2px rgba(0,0,0,0.05)
smCards, slight lift0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06)
mdDropdowns, popovers0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06)
lgModals, dialogs0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05)
xlHigh emphasis0 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:

  1. Semi-transparent overlay — Dark overlay on image, white text on top
  2. Lower image contrast/brightness — CSS filter: brightness(0.7)
  3. Colorize — Desaturate image, tint with brand color overlay
  4. Text shadow — Subtle text-shadow for readability
  5. 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: cover with fixed aspect ratios; set a background-color for 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>

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
25
Repository forks
6
7-day trend score
16

Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 3 May 2026, 6 months ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/booklib-ai/skills/refactoring-ui/badge)](https://verified-skill.com/skills/booklib-ai/skills/refactoring-ui)

Something wrong with this skill or its page? Tell us.