Skip to content

Polish pass

What your coding agent runs when it calls polish over MCP, published here in full for humans and agents without MCP.

Run this ordered polish pass over the user's frontend, fix real issues directly in the codebase, and finish with a short report.

Target & ground rules

  • Scope: whole app
  • Stay in the user's stack: Make changes using the project's own framework, styling system, tokens, and conventions. Do not force-install UI Polish components or rewrite existing architecture.
  • Optional React components: Only use UI Polish components (list_components, get_component) when the project uses React and the user wants ready-made building blocks.
  • Load rules as you go: Before editing a category, call the get_rules(topic) doc listed in that step for concrete values.
  • Fix, don't just audit: Apply clean, surgical fixes directly in the codebase, then verify they compile and don't break light/dark themes or mobile layouts.

Stack note: Detect the project's framework and styling system in step 1 and work natively in it. Use UI Polish components only when the project is React and the user wants them.

Ordered polish steps

1. Inventory (inventory)

Load rules: get_rules("foundations")

Check:

  • List the routes, pages, layouts, shared components and global stylesheets in scope.
  • Detect the framework (React, Next.js, Vue, Svelte, plain HTML/CSS), styling approach (CSS modules, Tailwind, CSS variables, styled system) and existing design tokens.
  • Check whether the project ships light mode only or both light and dark themes, and how themes switch.

Fix:

  • Record existing token names and conventions so every subsequent fix extends the project's system instead of introducing parallel tokens or a new styling layer.
  • Identify global CSS hygiene gaps (scrollbar-gutter: stable, -webkit-font-smoothing: antialiased, -webkit-tap-highlight-color: transparent, color-scheme).

2. Layout, spacing and alignment (layout)

Load rules: get_rules("spacing")

Check:

  • Find arbitrary spacing literals (13px, 17px, 22px) that fall off the 4px/8px spacing scale.
  • Check grouping hierarchy: space inside a group should be at most half the space between groups (label→field < field→field < section→section).
  • Check left-edge alignment across headings, prose, cards and form fields, and verify controls sharing a row share one height (32 / 40 / 48px).
  • Check for per-child margin leaks where parent flex/grid gap should own the rhythm.

Fix:

  • Snap off-scale margins, paddings and gaps to the project's spacing scale (or clean 4px/8px steps).
  • Replace sibling margins with parent gap, equalize control heights in toolbars and form rows, and give cards consistent internal padding.
  • Set prose heading spacing so space before a heading is ~2–3× space after it.

3. Typography (typography)

Load rules: get_rules("typography")

Check:

  • Check for inconsistent ad-hoc font sizes/weights or headings inheriting loose 1.5 body line-height.
  • Check text-wrap: balance on headings/short titles, text-wrap: pretty on body copy, and prose measure (max-width: 65ch).
  • Check body text under 22px for unnecessary letter-spacing (which disables contextual forms and ligatures).
  • Check counters, timers, prices, file sizes and table numbers for missing font-variant-numeric: tabular-nums.
  • Check where readable text (names, titles, filenames, chips) is prematurely cut with ... instead of wrapping.

Fix:

  • Tighten heading line-heights, consolidate type sizes/weights into clear Title / Body / Small roles, and cap prose line length at ~65ch.
  • Add text-wrap: balance on headings, text-wrap: pretty on body text, and tabular-nums on dynamic or aligned numeric figures.
  • Let essential labels wrap; reserve single-line truncation for fixed-height cells and read-only values, with full text accessible.

4. Color, contrast and theming (color)

Load rules: get_rules("surfaces")

Check:

  • Verify body text meets WCAG AA contrast (>= 4.5:1) and large text, icons and UI borders meet >= 3:1 in every theme the project ships.
  • Check page-vs-surface separation (soft page background vs elevated cards in light mode; lighter elevated surfaces with no drop shadows in dark mode).
  • Hunt for hardcoded #fff, #000, light-only shadows, or semi-transparent borders that shift weight over different backgrounds.
  • Check accent and status color restraint: one accent for primary emphasis/selected states, status tones reserved strictly for success/warning/danger, no heavy glass blur on large surfaces.

Fix:

  • Replace hardcoded colors with semantic theme tokens and remove drop shadows in dark mode in favor of surface lightness steps and crisp hairlines.
  • Raise contrast on muted text, placeholders, status text and borders that fall below AA in either theme.
  • Ensure ::selection is clearly visible and readable, and color-scheme matches the active theme so native controls and scrollbars align.

5. States (loading, empty, error, disabled) (states)

Load rules: get_rules("states")

Check:

  • Audit every async fetch and mutation for all four states: idle, pending/loading, done, and failed with retry.
  • Check for loading flashes under ~300ms, buttons that shrink/reflow when swapping text for a spinner, and layout shifts when async content or images load.
  • Check every list, table, search and filter result for bare 'No data' / '0 results' strings or empty table headers.
  • Check forms for premature error validation while typing, unhelpful messages ('Invalid input'), or layout jumps when errors appear.
  • Check disabled controls that hide why they cannot be used.

Fix:

  • Delay loading indicators ~300ms (keep visible >= 400ms once shown), reserve container space (min-height / aspect-ratio), and keep button width stable while busy.
  • Replace bare empties with a clear title, one sentence of guidance, and a primary next action (or 'Clear filters' for search/filter empties).
  • Validate fields on blur/submit, clear errors immediately on fix, link errors via aria-describedby + aria-invalid, and surface mutation errors with retry without discarding user input.
  • Prefer enabled controls with clear validation over unexplained disabled buttons; when truly disabled, show the reason visibly without requiring hover.

6. Focus, keyboard and accessibility (accessibility)

Load rules: get_rules("foundations"), get_rules("antipatterns")

Check:

  • Find clickable <div> or <span> elements acting as buttons or links, and nested interactive elements (button inside clickable card, link inside link).
  • Verify every interactive control has a clear :focus-visible indicator on every surface it sits on (never outline: none without replacement, never animated).
  • Check keyboard flows: logical tab order (no positive tabindex), dialogs/drawers trapping focus and returning it on close, Escape dismissing overlays, keyboard scrolling on overflow regions.
  • Check icon-only buttons for aria-label, images for alt (or alt="" when decorative), heading hierarchy (one <h1>, no skipped levels), and visual-only status updates (Copied, Saved) for live regions.

Fix:

  • Convert clickable <div>/<span> elements to native <button type="button"> or <a> and untangle nested interactives.
  • Add a crisp, un-animated :focus-visible outline visible in both themes, plus aria-label on icon-only controls and role="status" live regions for silent state updates.
  • Fix dialog/modal scroll lock (overscroll-behavior: contain), focus return, and Escape handling.

7. Motion (motion)

Load rules: get_rules("motion")

Check:

  • Check for transitions declared only on :hover (snappy exit), transition: all, or layout-thrashing animations (width, height, top, left, margin).
  • Check hover effects on buttons/cards for twitchy lifts, bounces, or scale > 3%; check whether exits run faster than entrances.
  • Check for scroll reveals that re-animate on scroll-back, decorative ambient loops near reading content, or entrance choreography taxing returning app users.
  • Verify every animation and smooth-scroll rule honors @media (prefers-reduced-motion: reduce) by jumping to the end state rather than hiding elements.

Fix:

  • Move transitions to the base selector, animate only transform, opacity, filter and color (or grid-template-rows for auto-height disclosures), and make :active press instant with eased release.
  • Keep hover to color/border steps; remove gratuitous hover lift/scale and re-triggering scroll animations.
  • Add @media (prefers-reduced-motion: reduce) overrides (and JS matchMedia guards where applicable) so every animated element resolves cleanly to its end state.

8. Responsive and touch (responsive)

Load rules: get_rules("spacing"), get_rules("antipatterns")

Check:

  • Test narrow mobile widths (~375px) and desktop widths for unintended horizontal page scroll, fixed widths wider than 320px, or missing min-width: 0 on flex/grid children.
  • Check for 100vh (clips behind mobile browser chrome), missing env(safe-area-inset-*) on fixed bottom bars/chrome, and sticky headers/sidebars crowding short viewports.
  • Check touch targets (< 40×40px), form input font sizes (< 16px triggers iOS zoom on focus), and maximum-scale=1 / user-scalable=no viewport locks.
  • Check whether hover styles stick on tap (missing @media (hover: hover)) or whether any action is hidden behind hover alone.

Fix:

  • Contain wide tables and code blocks inside their own overflow-x: auto wrappers and replace rigid widths with fluid grids (minmax(0, 1fr)).
  • Replace 100vh with 100dvh (or 100svh), pad fixed chrome with env(safe-area-inset-*), raise touch inputs to >= 16px, and expand small touch hit areas to >= 40×40px.
  • Gate hover styles with @media (hover: hover) and make hover-only actions reachable on touch and keyboard.

9. Copy and microcopy (copy)

Load rules: get_rules("states")

Check:

  • Check dialog and form buttons for vague labels ('OK', 'Submit', 'Yes', 'Cancel' on destructive confirmations).
  • Check error messages, empty states, and tooltips for developer jargon, raw status codes, or blameful wording without a fix.
  • Check loading copy ('Loading...' without naming the work) and typography details in UI strings (straight quotes/apostrophes, ... instead of …).

Fix:

  • Use specific action verbs ('Delete project', 'Save changes', 'Send invite') with safe default focus on destructive dialogs.
  • Rewrite errors to state what went wrong and how to fix it; name the work in pending labels ('Saving…', 'Searching…').
  • Use real apostrophes/quotes (’ “ ”) and ellipsis (…) in user-facing copy while keeping straight quotes in code.

10. Consistency and cleanup (consistency)

Load rules: get_rules("antipatterns"), get_rules("checklist")

Check:

  • Check nested border-radii for concentric alignment (inner = outer - gap) and inconsistent corner radii across controls and cards.
  • Check icon stroke weights and sizes beside text (consistent scale, shrink-0, currentColor).
  • Hunt for affordance lies: hover states on non-interactive cards, cursor: pointer on disabled/static elements, title attributes used as required tooltips, or links styled like plain text.
  • Check z-index sprawl (9999), unnecessary overflow: hidden clipping focus rings/shadows, and duplicate CSS tokens or dead styles.

Fix:

  • Align radii to one consistent scale with concentric nested corners, unify icon sizing/stroke weight, and consolidate duplicate border/surface styles.
  • Remove hover/pointer affordances from non-interactive elements, replace z-index: 9999 with a clean layer ladder, and run the final yes/no check in get_rules("checklist").

11. Report (report)

Load rules: get_rules("checklist")

Check:

  • Re-verify affected views after edits (typecheck, lint, build or visual check if available).
  • Confirm no regressions were introduced in dark mode, mobile layout, or keyboard flows.

Fix:

  • Return a concise final report with three short sections: Issues found, Fixed (grouped by step with file paths), and Left for you (anything requiring product, copy, backend or brand decisions).

Final report format

End with a concise report covering:

  1. Issues found — brief grouped list of what needed polish.
  2. Fixed — what you changed and which files were updated.
  3. Left for you — anything intentionally untouched (brand/product decisions, copy approvals, backend constraints) with concrete next steps.