Skip to the content.

UI/UX Design Skill for AI Coding Agents: Type Scales, Color, Spacing and a Design Review Checklist

An open-source UI/UX design skill (in the Agent Skills SKILL.md format) that gives AI coding agents real design sense. With it installed, agents such as Claude Code build interfaces from design tokens instead of random values, pick type scales and color ramps that work, keep spacing on a grid, design every state (loading, empty, error, focus), meet WCAG contrast, and review their own UI against a checklist before calling it done.

It ships with four small Python scripts the agent (or you) can run: a WCAG contrast checker that suggests a passing color, a modular and fluid type scale generator, an OKLCH palette generator, and a CSS audit that finds off-system colors, font sizes, spacing and z-index values. It is for developers who build front ends with AI assistance and are tired of UI that “works but looks off”.

Last reviewed: December 2026. Accessibility figures follow WCAG 2.2; skill and plugin formats were checked against the Agent Skills specification and Claude Code docs at that date.

Contents

What the skill changes

Without guidance, coding agents tend to produce UI with familiar problems:

Typical agent output With the skill
A dozen font sizes (13px, 15px, 17px, 22px…) Four to six sizes from one modular scale
Hex colors sprinkled through components Semantic tokens (--color-text, --color-primary) backed by ramps
Light grey text that fails contrast Every text pair checked against 4.5:1
Padding of 10px here, 18px there A 4px grid: 4, 8, 12, 16, 24, 32, 48…
Only the happy path designed Loading, empty, error, disabled and focus states
outline: none on focus A visible :focus-visible ring
Three equally loud buttons One primary action per section
Dark mode by inverting colors Swapped semantic tokens with re-checked contrast

The skill is deliberately opinionated but small: the main SKILL.md is under 100 lines, and detailed guidance lives in reference files the agent reads only when needed, so it costs little context.

Install

Claude Code (plugin)

/plugin marketplace add Ralpberry-Labs/ui-ux-design-skill
/plugin install ui-ux-design-skill@ralpberry-design

Claude Code (copy the skill folder)

git clone https://github.com/Ralpberry-Labs/ui-ux-design-skill.git

# For one project (commit it so your team gets it too)
mkdir -p .claude/skills && cp -r ui-ux-design-skill/skills/design-system .claude/skills/

# Or for all your projects
mkdir -p ~/.claude/skills && cp -r ui-ux-design-skill/skills/design-system ~/.claude/skills/

Other agents

The skill follows the open Agent Skills format: a folder with a SKILL.md (YAML frontmatter with name and description) plus scripts/, references/ and assets/. Copy skills/design-system/ into whatever skills folder your agent reads. If your tool does not support skills, paste the body of SKILL.md into its instruction file (AGENTS.md, rules file, custom instructions) and keep the references/ folder in the repository.

Requirements for the scripts: Python 3.10 or newer, standard library only.

How agents use it

The description tells the agent to load the skill whenever it builds or restyles UI, chooses colors or fonts, creates tokens, or reviews a page. Once loaded, the skill gives the agent a five-step workflow:

  1. Find the existing system first: tokens, theme files, Tailwind config, component library, existing components. Reuse beats invention.
  2. If there is none, start from the starter tokens in assets/tokens.css, generating a brand ramp and type scale with the scripts.
  3. Build with the rules: every color, size, space, radius, shadow and z-index from a token.
  4. Design every state, not just the happy path.
  5. Review: run the checklist, audit_css.py on changed files and contrast.py on new color pairs, and report what was checked.

You can also invoke it directly: “Use the design-system skill to review the settings page.”

The design rules

These are the rules in the skill, with the reasoning behind them.

Typography

Common ratios:

Name Ratio Feel
Major second 1.125 Very compact, data-heavy UI
Minor third 1.2 Balanced apps and docs
Major third 1.25 Clear hierarchy, general purpose
Perfect fourth 1.333 Editorial, landing pages
Perfect fifth 1.5 Dramatic display headings

Color and contrast

Spacing

Layout

Components and states

Depth, radius and motion

Design tokens: the three layers

The starter file assets/tokens.css uses a structure that scales from a side project to a large design system:

/* 1. Ramps: raw values, never used directly by components */
--color-brand-600: #2361e9;
--color-neutral-900: #0f172a;

/* 2. Semantic tokens: what components use */
--color-primary: var(--color-brand-600);
--color-text: var(--color-neutral-900);

/* 3. Component tokens (optional, for large systems) */
--button-primary-bg: var(--color-primary);

Why it matters: rebranding means regenerating one ramp, and dark mode means remapping the semantic layer. No component changes.

The starter tokens include neutral, brand and status colors; a type scale; a 4px spacing scale; radii; shadows; a z-index scale; durations and easing; light and dark semantic mappings; a reduced-motion rule; and a default focus ring. The test suite checks that every main text pair in both themes meets WCAG AA.

Dark mode done properly

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --color-bg: var(--color-neutral-950); /* ... */ }
}
:root[data-theme="dark"] { --color-bg: var(--color-neutral-950); /* ... */ }

The scripts

All four live in skills/design-system/scripts/ and use only the Python standard library.

contrast.py: WCAG contrast with a fix

python3 contrast.py "#9ca3af" "#ffffff"
#9ca3af on #ffffff: 2.54:1
  FAIL  AA normal text (4.5)
  FAIL  AA large text (3.0)
  FAIL  AA UI components (3.0)
  FAIL  AAA normal text (7.0)
  FAIL  AAA large text (4.5)
Suggestion: #6f7681 gives 4.58:1 (same hue, adjusted lightness)

The suggestion keeps the hue and adjusts OKLCH lightness to the nearest value that passes. Use --target 3 for large text or UI components. Exit code is 1 when the pair fails, so it works in scripts.

type_scale.py: modular or fluid type scale

python3 type_scale.py --ratio major-third --down 1 --up 4
:root {
  --font-size-sm: 0.8rem; /* 12.8px */
  --line-height-sm: 1.5;
  --font-size-base: 1rem; /* 16px */
  --line-height-base: 1.5;
  --font-size-lg: 1.25rem; /* 20px */
  --line-height-lg: 1.4;
  --font-size-xl: 1.562rem; /* 25px */
  ...
}

With --fluid, it emits clamp() values that grow smoothly between two viewport widths (defaults 360px and 1280px), with separate minimum and maximum ratios so headings get more dramatic on large screens while body text barely moves.

palette.py: an even 50 to 950 ramp from one color

python3 palette.py "#2563eb"
 step  hex       on white   on dark
   50  #f0f5ff       1.09     17.97
  100  #dce8ff       1.23     15.93
  ...
  600  #2361e9       5.31      3.70
  700  #134ac4       7.49      2.62
  ...

Steps are spaced evenly in OKLCH lightness, with chroma tapered toward the light and dark ends so tints are not neon and shades are not muddy. Colors outside the sRGB gamut are brought in by reducing chroma, not by clipping. The contrast columns show at a glance which steps can carry text on light and dark backgrounds. Add --css --name brand to print custom properties.

audit_css.py: find design-system drift

python3 audit_css.py src/ --grid 4 --font-sizes 12,14,16,18,20,24,30,36,48
card.css:1: [font-size] 15px is not on the type scale
card.css:1: [spacing] 18px is not a multiple of 4px
card.css:2: [raw-color] use a color token instead of a literal
card.css:4: [z-index] z-index 99999 is not in the layering scale
card.css:3: [focus] focus outline removed without a visible replacement
Summary: focus=1, font-size=1, raw-color=1, spacing=1, z-index=1

It scans .css, .scss, .less, .jsx, .tsx, .vue, .svelte and .html files, skipping node_modules. Color literals inside custom property definitions (--x: #fff) are allowed, since that is where tokens live. Exit code 1 when anything is found, so you can gate CI on it. It is a heuristic line-based scanner, not a CSS parser: treat its output as a review list.

Before and after

A card an agent might write without guidance:

.card { background: #fff; padding: 18px; border-radius: 7px; box-shadow: 0 2px 9px rgba(0,0,0,.3); }
.card h3 { font-size: 22px; color: #333; margin-bottom: 6px; }
.card p { font-size: 15px; color: #999; }
.card button { background: #3b82f6; color: #fff; padding: 10px 14px; }
.card button:focus { outline: none; }

Problems: five one-off values, #999 body text at about 2.8:1 on white, a heavy shadow, white on a mid-tone blue that falls short of 4.5:1, and no focus indicator.

The same card with the skill:

.card {
  background: var(--color-surface-raised);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: var(--space-2);
}
.card h3 { font-size: var(--font-size-xl); line-height: var(--line-height-snug); color: var(--color-text); }
.card p  { font-size: var(--font-size-base); color: var(--color-text-muted); max-width: 65ch; }
.card button {
  justify-self: start;
  background: var(--color-primary);
  color: var(--color-on-primary);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
}
.card button:hover { background: var(--color-primary-hover); }
.card button:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }

Every value is a token, contrast is verified by the token tests, spacing comes from gap, and the button has hover and focus states. Dark mode works with no extra code.

The review checklist

The full checklist is in references/review-checklist.md. The agent runs it at the end of UI work. Highlights:

Adapting it to your brand or design system

Learn from established design systems

Public design systems are free, well-documented references for decisions this skill makes. What each is especially useful for (our summary):

System Worth studying for
Material Design 3 Color roles and tonal palettes, dynamic color, component states
Apple Human Interface Guidelines Platform conventions, typography, touch targets, accessibility
Carbon Dense enterprise UI, data tables, a rigorous spacing and type system
Polaris Content and copy guidelines, admin layouts
Primer Developer-tool UI, color modes and accessibility
Fluent 2 Cross-platform tokens and theming
Atlassian Design System Tokens naming, collaboration product patterns
GOV.UK Design System Accessible forms, error messages, plain-language patterns

Picks: GOV.UK for forms and errors, Carbon for dense data UI, Material 3 for color roles, and the platform guidelines (Apple HIG) whenever you build native-feeling mobile UI.

FAQ

Does this replace a designer? No. It raises the floor: consistent, accessible, unsurprising UI. A designer still decides what the product should feel like, and the skill is a good way to encode those decisions for agents.

Will it fight my existing styles? Step 1 of the workflow tells the agent to find and use your existing system first. It only introduces the starter tokens when nothing exists.

Why OKLCH for palettes? Equal steps in OKLCH lightness look equally spaced to people, unlike HSL, where “50 percent lightness” yellow and blue look very different. That makes ramps predictable and contrast easier to reason about.

Is passing contrast.py enough for accessibility? No. Contrast is one criterion. See references/accessibility.md for the other checks, and test with a keyboard and a screen reader.

What contrast ratio do I need? WCAG 2.2 AA: 4.5:1 for normal text, 3:1 for large text and for UI components and focus indicators.

What is a good base font size for web apps? 16px for body text, with a modular scale for headings and a 1.4 to 1.6 line height.

4px or 8px grid? Both work; a 4px base with mostly 8px multiples gives enough fine control for dense UI. Pick one and enforce it with audit_css.py --grid.

Why Python scripts? Python 3 is available on most developer machines and in most agent sandboxes, and the standard library is enough for color math. No install step means agents can run them immediately.

Where to go next

Repository layout

ui-ux-design-skill/
├── .claude-plugin/
│   ├── plugin.json            # plugin: ui-ux-design-skill
│   └── marketplace.json       # marketplace: ralpberry-design
├── skills/design-system/
│   ├── SKILL.md               # the skill (workflow + core rules)
│   ├── references/            # typography, color, spacing-layout, components,
│   │                          # accessibility, review-checklist
│   ├── scripts/               # contrast, type_scale, palette, audit_css (+ colorlib)
│   └── assets/tokens.css      # starter tokens, light and dark
├── tests/test_design_scripts.py
├── LICENSE
└── README.md

Run the tests:

python3 -m unittest discover -s tests -v

Contributing

Pull requests are welcome: sharper rules, more component guidance, better scripts, and examples from real projects. Please keep SKILL.md short (detail goes in references/), keep scripts dependency-free with tests, and back any numeric rule with a source or a clear rationale. Accessibility figures must match the current WCAG version.

License

MIT.

If this skill made your agent’s UI look better, a star helps others find it.

More free resources

Part of the Ralpberry Labs open-source collection. See also Top 100 Open Source.