Skip to content
Back to search

refactoring-ui

Design and improve user interfaces using the concrete rules from Refactoring UI (Wathan & Schoger) — constrained spacing/type/color/shadow scales, visual hierarchy through weight and color rather than size, and depth through emulated light. Use when building or styling any UI (web, app, dashboard, landing page, component), when picking font sizes, spacing, colors, shadows or border radius, when designing a color palette or design tokens, and whenever someone says a UI "looks off", "looks amateur", "feels cluttered/plain/unfinished", or asks to "make this look better".

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/s0xdk-refactoring-ui-skill/badge.svg)](/listings/s0xdk-refactoring-ui-skill)

HTML

<a href="/listings/s0xdk-refactoring-ui-skill"><img src="/api/listings/s0xdk-refactoring-ui-skill/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Claude Code loads skills from a folder containing a `SKILL.md`. Clone this repo into one of the skill directories below — **use the folder name `refactoring-ui`** so it matches the skill's declared name.

Personal skill (available in every project)

git clone https://github.com/<you>/refactoring-ui-skill.git ~/.claude/skills/refactoring-ui

Project skill (checked into a specific repo, shared with your team)

git clone https://github.com/<you>/refactoring-ui-skill.git .claude/skills/refactoring-ui

(Or add it as a git submodule at that path if you want to track updates.)

Restart Claude Code (or start a new session) after installing so it picks up the new skill.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

SKILL.md · Manifest · 267 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. ---
  2. name: refactoring-ui
  3. description: Design and improve user interfaces using the concrete rules from Refactoring UI (Wathan & Schoger) — constrained spacing/type/color/shadow scales, visual hierarchy through weight and color rather than size, and depth through emulated light. Use when building or styling any UI (web, app, dashboard, landing page, component), when picking font sizes, spacing, colors, shadows or border radius, when designing a color palette or design tokens, and whenever someone says a UI "looks off", "looks amateur", "feels cluttered/plain/unfinished", or asks to "make this look better".
  4. ---
  5. # Refactoring UI
  6. Visual design is not talent. It is a small set of systems decisions made **once**, plus a
  7. handful of techniques for creating hierarchy. This skill is those systems and those
  8. techniques.
  9. The single biggest cause of amateur-looking UI is picking values ad hoc — 17px here,
  10. `#3B82F6` there, `lighten(5%)` for a hover state. Design *from a scale*, always.
  11. ---
  12. ## The systems — use these, do not re-derive them
  13. Pick from these lists. Never invent a value that isn't on one.
  14. ### Spacing and sizing
  15. Base 16px, built from factors and multiples of it:
  16. ```
  17. 4 8 12 16 24 32 48 64 96 128 192 256 384 512 640 768
  18. ```
  19. Tight at the small end, spreading out at the large end. **No two adjacent values may be
  20. closer than ~25%** — that is what makes the choice obvious. A linear "multiples of 4"
  21. scale fails: it does not help you decide between 120px and 124px.
  22. Use it for margin, padding, width, height, icon sizes, border width — everything spatial.
  23. Fix a small set of opacity values too (e.g. `.05 .1 .2 .4 .6 .8`) for disabled states,
  24. overlays and hover tints, rather than eyeballing a slider each time. Same logic as the other
  25. scales: decide once, reuse everywhere.
  26. ### Type scale
  27. ```
  28. 12 14 16 18 20 24 30 36 48 60 72
  29. ```
  30. Not a modular scale built from a ratio (4:5, 2:3, golden ratio). Those produce fractional
  31. pixel values that round inconsistently across browsers and are too sparse for interface
  32. density — hand-picked values, chosen for how they feel, win instead.
  33. **Units: `px` or `rem` only. Never `em`.** `em` is relative to the current font size, so a
  34. `.875em` inside a `1.25em` parent computes to 17.5px — a value not in your scale. The
  35. scale silently stops existing.
  36. ### Font weight
  37. Two weights is enough:
  38. - **400 or 500** — body and most UI text
  39. - **600 or 700** — anything emphasized
  40. Nothing below 400 in UI. To de-emphasize, use a lighter *color* or smaller *size* — never a
  41. lighter weight.
  42. ### Color
  43. You need far more colors than a five-swatch palette generator gives you.
  44. - **Greys: 8–10 shades.** Almost all of a UI is grey — text, backgrounds, panels, borders,
  45. form controls. Three or four shades always runs out. Start at a very dark grey, not true
  46. black (true black looks unnatural).
  47. - **Primary: 5–10 shades**, one or maybe two primaries.
  48. - **Accents: 5–10 shades each** — destructive red, warning yellow, positive green, plus
  49. whatever else the product needs to distinguish (chart series, calendar events, tags). Ten
  50. colors × 5–10 shades is normal for a complex UI.
  51. Name them `100` (lightest) → `900` (darkest), base `500`.
  52. **Build the scale in this order:** pick `500` first (for a primary/accent, it should be a
  53. shade that works as a button background). Then find the edges — `900` is usually your text
  54. color, `100` a background tint; an alert component uses both, so design one and read the
  55. two values off it. Then fill `700` and `300` as the perfect compromise between their
  56. neighbours, then `800 600 400 200` the same way.
  57. **Write colors as HSL, not hex.** `hsl(220, 95%, 34%)` and `hsl(220, 65%, 61%)` are
  58. visibly related; `#03369E` and `#507DD7` are not.
  59. **Never generate shades at runtime** with `lighten()` / `darken()`. That is how you end up
  60. with 35 slightly different blues.
  61. ### Shadows — five elevations
  62. ```css
  63. 0 1px 3px hsla(0,0%,0%,.2) /* barely raised — buttons */
  64. 0 4px 6px hsla(0,0%,0%,.2) /* dropdowns */
  65. 0 5px 15px hsla(0,0%,0%,.2)
  66. 0 10px 24px hsla(0,0%,0%,.2)
  67. 0 15px 35px hsla(0,0%,0%,.2) /* modals */
  68. ```
  69. Choose by asking *where on the z-axis does this sit?*, not *what shadow looks nice?*.
  70. Closer to the user = more attention. Shrinking a button's shadow on `:active` makes it feel
  71. pressed; growing a list item's shadow when it's picked up for drag-to-reorder does the
  72. reverse — it reads as "now above its siblings" and doubles as the drag affordance itself.
  73. These five are the default and are fine everywhere. `references/techniques.md` gives a
  74. refined **two-part** version of the same scale — parallel, but not identical values (its top
  75. step is heavier). Use it when shadows are prominent in the design; use these when they
  76. aren't. Don't mix the two in one project.
  77. ### Line-height and line length
  78. Line-height is **inversely** proportional to font size, and proportional to line width:
  79. - small text / wide columns → `1.5` to `2`
  80. - large headlines → `1` is fine
  81. Line length: **45–75 characters**, i.e. `max-width: 20em–35em`. This applies to the
  82. paragraph even when the container around it is wider — mixed widths in one content area
  83. look more polished, not less.
  84. (`em` is correct *here* — measure should scale with the text it wraps. The "never `em`" rule
  85. is scoped to the *type scale*, where `em` compounds through nesting. Don't "fix" this.)
  86. ### Border radius
  87. Pick one and stay consistent. Small radius = neutral. Large radius = playful. None =
  88. serious/formal. Mixing square and rounded corners in one interface always looks worse.
  89. ---
  90. ## The procedure
  91. **1. Start with a feature, not a layout.** Don't design "the app" — you cannot decide
  92. between top nav and sidebar before you know what's in the product. Design one real piece of
  93. functionality (the search form, the message composer), and let the shell emerge.
  94. **2. Detail comes later.** Ignore typefaces, shadows and icons early. Work in **grayscale
  95. first** — it forces hierarchy to come from spacing, contrast and size rather than color.
  96. Add color once the layout works.
  97. **3. Don't over-invest in low fidelity.** Sketches, wireframes and mockups are disposable —
  98. nobody can use a static picture of an app. They exist to explore ideas; abandon them once the
  99. decision is made and go build the real thing.
  100. **4. Design the smallest useful version, then build it.** Work in short design→code cycles.
  101. Don't imply functionality you aren't ready to build — a comment box with an attachments
  102. zone you can't ship yet blocks the whole feature. Nice-to-haves get designed later.
  103. **5. Choose by elimination.** When picking a value from a scale: guess the one you think is
  104. right, then compare it against the neighbour on each side. Two will be obviously wrong. If
  105. an outer option wins, re-run the comparison with that as the new middle.
  106. **6. Start with too much white space and remove it.** Adding space until something stops
  107. looking bad gives you the minimum. Starting generous and trimming gives you the right
  108. amount. Dense UIs (dashboards) are legitimate — but as a deliberate decision, not a default.
  109. **7. Shrink the canvas.** A small component designed on a 1400px artboard tends to sprawl,
  110. because the space is there to fill. Start at ~400px and design the mobile layout first, where
  111. the constraints are real — then bring it to a large screen and relax only what genuinely felt
  112. cramped. You will change less than you expect.
  113. ---
  114. ## Hierarchy — the technique that does the most work
  115. Everything on screen sits in a pyramid: primary, secondary, tertiary. When everything
  116. competes, the UI reads as noise. This is what makes a design look "designed" — not styling.
  117. **Size isn't everything.** Leaning on font size alone gives you primary content that's too
  118. big and secondary content that's too small. Use **weight** and **color** to carry emphasis
  119. instead, and keep sizes reasonable.
  120. **Three text colors, maximum:**
  121. - dark — primary content
  122. - grey — secondary content
  123. - lighter grey — tertiary (footnotes, copyright)
  124. All three carry real body-size text, so all three need 4.5:1. "Lighter grey" means the
  125. lightest shade that still clears it — roughly the middle of a 9-step ramp, not the pale end.
  126. The pale shades are for disabled states and large text only.
  127. **Emphasize by de-emphasizing.** When the important element won't stand out and there's
  128. nothing left to add to it, soften what competes with it instead. Fade the inactive nav
  129. items; drop the sidebar's background color so the main content sits forward.
  130. **Actions:** style by hierarchy, not by semantics.
  131. - Primary → solid, high contrast. Usually exactly one per page.
  132. - Secondary → outline, or a low-contrast background.
  133. - Tertiary → styled like a link.
  134. Destructive ≠ big red button. If "Delete" isn't the primary action on the page, give it
  135. tertiary treatment — then make it a big red primary button *inside the confirmation dialog*,
  136. where it genuinely is the primary action.
  137. **Labels are a last resort.** `label: value` gives every piece of data equal weight. Most
  138. data identifies itself by format (`$19.99`, an email address) or by context. Where a label
  139. is genuinely needed, fold it into the value ("12 left in stock", not "In stock: 12"), or
  140. add it as visibly *secondary* content. Exception: on spec-sheet-style pages where users scan
  141. *for the label*, emphasize the label instead.
  142. **Balance weight against contrast.** Solid icons are visually heavy and will out-shout the
  143. text beside them — soften their color to compensate. It works in reverse too: when a 1px
  144. border is too subtle in a soft color but too harsh once you darken it, keep the soft color
  145. and go to 2px. Add weight to fix low contrast; reduce contrast to fix excess weight.
  146. **Visual hierarchy ≠ document hierarchy.** Semantic markup and visual weight are separate
  147. decisions. Section titles are usually *labels*, not headlines — an `h1` at 16px is fine, and
  148. sometimes the title should be visually hidden entirely because the content speaks for itself.
  149. ---
  150. ## Hard rules
  151. Deviating from these produces a specific, recognizable failure.
  152. 1. **Never grey text on a colored background.** Grey-on-white works because it *reduces
  153. contrast*; grey on color just looks dirty. White-at-reduced-opacity looks washed out and
  154. disabled, and lets patterns show through the glyphs. Hand-pick a color with the
  155. background's hue, adjusting saturation and lightness.
  156. 2. **Never `em` for the type scale.** `px` or `rem`.
  157. 3. **Never generate shades at runtime.** Define them up front.
  158. 4. **Never use a percentage width for something that shouldn't scale.** Sidebars get fixed
  159. widths; the main area flexes. Elements get a `max-width` and only shrink when the screen
  160. is actually smaller — a login card shouldn't be *wider* at medium screens than at large.
  161. 5. **Never scale things proportionally across breakpoints.** Large elements must shrink
  162. *faster* than small ones. A 2.5em headline sitting on 14px mobile body copy computes to
  163. 35px — far too big; it wants to be 20–24px there. Likewise a button's padding should get
  164. proportionally tighter as the button shrinks, not scale with its font size.
  165. 6. **Always more space around a group than within it.** This is the fix for "which label
  166. belongs to which field", cramped bullet lists, and headings that look attached to the
  167. wrong paragraph. Ambiguous spacing is a functional bug, not just an ugly one.
  168. 7. **Never use color as the only signal.** Add an icon, a shape, or a text cue. For charts,
  169. distinguish series by *contrast* (light→dark shades of one color) rather than by hue —
  170. colorblind users read lightness reliably, hue not so much.
  171. 8. **Contrast minimums:** 4.5:1 for normal text. The 3:1 allowance applies only to *large*
  172. text, which WCAG defines as **24px regular or 18.66px bold** — not 18px. Assume 4.5:1
  173. unless the text is genuinely that large. When white-on-color fails, flip it: dark colored
  174. text on a light colored tint (see `references/systems.md`). Separately, **3:1 applies to
  175. non-text too** (WCAG 1.4.11): if a border is the only thing identifying a control — an
  176. input outline, a checkbox edge — it needs 3:1 against its background. A hairline that
  177. merely divides content does not. Those are two different tokens, not one.
  178. 9. **Never scale an icon far from its intended size.** A 16–24px icon at 48px looks chunky
  179. and detail-starved. Put it inside a colored circle instead.
  180. ---
  181. ## References
  182. **`assets/tokens.css`** — a complete, contrast-verified starting set of all the above as CSS
  183. custom properties: spacing, type, weights, border width, a fixed opacity scale, a 9-shade
  184. cool grey ramp, a 9-shade primary, three accent trios, five elevations, a **semantic role
  185. layer** (`--surface`, `--text-primary`, `--action`…) and a **dark-mode block** that overrides
  186. only those roles. Copy it in and retune
  187. the hues rather than re-deriving the scales from this prose. Reference the roles in
  188. components, not the raw ramps — that is what makes the dark mode work. Every text/surface
  189. pair is verified ≥4.5:1 in both modes and every functional border ≥3:1; the deliberate
  190. sub-threshold shades (disabled, decorative dividers, the large-text-only step) are exempt by
  191. criterion and commented inline.
  192. Load these when the work calls for them:
  193. - **`references/systems.md`** — building a palette from scratch: choosing the base color,
  194. keeping saturation alive at the light and dark ends, hue rotation, warm/cool greys, and
  195. the two escape hatches for hitting contrast ratios without ugly color.
  196. - **`references/diagnose.md`** — symptom → fix table. Load first whenever the task is
  197. *improving existing UI* rather than building new.
  198. - **`references/techniques.md`** — depth and light simulation, two-part shadows, baseline
  199. alignment, letter-spacing, breaking out of default component shapes, and handling
  200. user-uploaded images.
README.md · README · 80 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Refactoring UI (Claude Code skill)
  2. A [Claude Code](https://claude.com/claude-code) skill that teaches Claude the concrete,
  3. mechanical rules from the book *[Refactoring UI](https://www.refactoringui.com/)* by Adam
  4. Wathan and Steve Schoger — constrained spacing/type/color/shadow scales, visual hierarchy
  5. through weight and color rather than size, and depth through emulated light.
  6. Every rule and CSS value in this skill was cross-checked page-by-page against the book.
  7. It's not a summary — it's the book's decisions, made once, ready to apply.
  8. ## What it does
  9. Load this skill and Claude will, when styling or reviewing UI:
  10. - Pick spacing, type sizes, weights, colors, shadows and radii **from fixed scales**
  11. instead of ad hoc values
  12. - Build hierarchy through weight/color rather than piling on font-size
  13. - Diagnose vague complaints ("looks off", "feels cheap") into specific, mechanical fixes
  14. - Apply concrete techniques for depth, contrast, images, and breaking generic component
  15. shapes
  16. It does **not** include the book itself — see [Credits](#credits).
  17. ## Repo structure
  18. ```
  19. SKILL.md the skill: systems, procedure, hierarchy, hard rules
  20. references/
  21. systems.md building a color palette from scratch (HSL, saturation, hue rotation)
  22. diagnose.md symptom -> fix table, for improving existing UI
  23. techniques.md depth/light simulation, typefaces, grids, images
  24. assets/
  25. tokens.css a complete, contrast-verified starter token set
  26. ```
  27. ## Installation
  28. Claude Code loads skills from a folder containing a `SKILL.md`. Clone this repo into one
  29. of the skill directories below — **use the folder name `refactoring-ui`** so it matches
  30. the skill's declared name.
  31. ### Personal skill (available in every project)
  32. ```sh
  33. git clone https://github.com/<you>/refactoring-ui-skill.git ~/.claude/skills/refactoring-ui
  34. ```
  35. ### Project skill (checked into a specific repo, shared with your team)
  36. ```sh
  37. git clone https://github.com/<you>/refactoring-ui-skill.git .claude/skills/refactoring-ui
  38. ```
  39. (Or add it as a git submodule at that path if you want to track updates.)
  40. Restart Claude Code (or start a new session) after installing so it picks up the new
  41. skill.
  42. ## Usage
  43. The skill activates automatically whenever Claude is building or styling UI, picking
  44. font sizes/spacing/colors/shadows, designing a palette or design tokens, or when you say
  45. a UI "looks off", "looks amateur", or "feels cluttered/plain/unfinished." You can also
  46. invoke it explicitly:
  47. ```
  48. /refactoring-ui make this dashboard look less amateur
  49. ```
  50. ## Credits
  51. All design rules and reasoning are drawn from *Refactoring UI* by Adam Wathan and Steve
  52. Schoger. This repo does not include the book's text or images — only original notes and
  53. CSS derived from its concepts. If you find this useful, buy the book:
  54. **https://www.refactoringui.com/**
  55. ## License
  56. MIT for the contents of this repo (see [LICENSE](LICENSE)). Does not extend to the book
  57. itself.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.