Skip to the content.

Agent Skills for Frontend: Accessibility, Core Web Vitals, Responsive Layout and Design Tokens

Agent skills for frontend development that make AI coding agents (Claude Code, Codex and other skills-compatible agents) build interfaces that are accessible, fast and responsive by default. Seven SKILL.md skills cover WCAG 2.2 accessibility audits, color contrast, Core Web Vitals (LCP, INP, CLS), responsive CSS layout, design tokens and theming, image optimization, and accessible forms. Three tested, dependency-free Python scripts do the mechanical checks: a static HTML accessibility linter, a WCAG contrast checker that suggests passing colors, and a design tokens to CSS variables converter.

It is for frontend developers, design system teams and anyone who wants an agent’s UI code to pass an accessibility review and a Lighthouse run the first time.

Last reviewed: December 2026. Thresholds and criteria were checked against the W3C WCAG 2.2 Recommendation, web.dev Core Web Vitals documentation and the W3C Design Tokens Community Group 2025.10 format. Links in this README were checked when it was written.

Contents

Quick reference card

The numbers frontend work is judged by, in one place:

Topic Target Source
Text contrast (AA) 4.5:1, large text 3:1 WCAG 2.2 SC 1.4.3
Text contrast (AAA) 7:1, large text 4.5:1 WCAG 2.2 SC 1.4.6
Large text at least 24 CSS px, or 18.66 CSS px (14pt) bold WCAG 2.2 definition
UI components and focus indicators 3:1 against adjacent colors WCAG 2.2 SC 1.4.11
Pointer target size (AA) at least 24 x 24 CSS px (or enough spacing) WCAG 2.2 SC 2.5.8
Reflow No horizontal scrolling at 320 CSS px wide WCAG 2.2 SC 1.4.10
Text resize Usable at 200% zoom WCAG 2.2 SC 1.4.4
Flashing No more than 3 flashes per second WCAG 2.2 SC 2.3.1
LCP good at or under 2.5 s, poor over 4.0 s web.dev Core Web Vitals
INP good at or under 200 ms, poor over 500 ms web.dev Core Web Vitals
CLS good at or under 0.1, poor over 0.25 web.dev Core Web Vitals
Vitals percentile 75th percentile of page loads, mobile and desktop separately web.dev Core Web Vitals
Long task over 50 ms on the main thread Chrome DevTools / web.dev

The skills

Skill Use it for Script
accessibility-audit WCAG 2.2 AA audit of pages, components and templates; automated pass plus manual checks; fixes as diffs a11y_lint.py
color-contrast Check palettes, themes and dark mode; find the nearest passing shade contrast.py
core-web-vitals Diagnose LCP, INP and CLS from field data, fix by phase  
responsive-layout Mobile-first CSS, fluid type, Grid/Flexbox patterns, container queries, overflow debugging  
design-tokens Token tiers, DTCG JSON, CSS variables with light/dark themes tokens_to_css.py
image-optimization Formats, srcset/sizes, lazy loading, LCP image priority, build/CDN pipelines  
accessible-forms Labels, autocomplete, validation and error summaries, accessible authentication  

The skills reference each other where topics overlap (for example accessibility-audit sends contrast questions to color-contrast and form questions to accessible-forms).

Install

Claude Code plugin

claude plugin marketplace add Ralpberry-Labs/agent-skills-frontend
claude plugin install agent-skills-frontend@ralpberry-frontend-skills

Skills appear as /agent-skills-frontend:accessibility-audit and so on; Claude also loads them automatically when your request matches (“audit this page for accessibility”, “why is LCP slow”).

Copy into a project or your home folder

git clone https://github.com/Ralpberry-Labs/agent-skills-frontend
cp -r agent-skills-frontend/skills/* .claude/skills/       # Claude Code, this project
cp -r agent-skills-frontend/skills/* ~/.claude/skills/     # Claude Code, all projects
cp -r agent-skills-frontend/skills/* .agents/skills/       # OpenAI Codex, this repo

Use the scripts without an agent

They are plain Python 3.9+ with no dependencies:

python3 skills/accessibility-audit/scripts/a11y_lint.py dist/
python3 skills/color-contrast/scripts/contrast.py "#6b7280" "#ffffff" --fix
python3 skills/design-tokens/scripts/tokens_to_css.py tokens.json --theme dark=tokens.dark.json > tokens.css

All three exit non-zero on failure, so they drop into CI or a pre-commit hook.

How agents use these skills

Only each skill’s description is loaded at the start of a session. When your request matches, the agent loads the full SKILL.md and follows it: runs the script where there is one, then performs the judgment-heavy steps that scripts cannot (keyboard testing, reading a performance trace, choosing token names).

Good habits the skills enforce:

Accessibility audit

The audit has two halves. The automated half finds a minority of issues quickly; the manual half finds the rest.

Static linter rules (a11y_lint.py):

Rule Severity Checks
html-lang error <html lang> present (full documents only)
page-title error Non-empty <title>
viewport-zoom error No user-scalable=no or maximum-scale=1
img-alt error Every <img> has alt (empty for decorative)
form-label error Inputs, selects, textareas labelled (placeholder is not a label)
control-name error Buttons and links have an accessible name (text, aria-label, aria-labelledby, or an image’s alt)
click-non-interactive error onclick on a div/span without a role
duplicate-id error IDs unique
aria-ref error aria-labelledby/describedby/controls point to existing IDs
empty-heading error Headings have text
heading-order warning No skipped levels (h1 to h3)
multiple-h1 warning Usually one <h1>
positive-tabindex warning No tabindex above 0
link-as-button warning <a> without href used as a button
autoplay-audio warning Autoplaying media that is not muted

Example output:

page.html:5: error: [img-alt] <img> needs an alt attribute (alt="" if decorative).
page.html:6: error: [form-label] Form control has no label (use <label for>, a wrapping <label>, or aria-label). A placeholder is not a label.
page.html:8: error: [control-name] <button> has no accessible name (text, aria-label or labelled image).
page.html:10: error: [click-non-interactive] onclick on <div> without a role; keyboard users cannot use it. Use <button>.

It parses HTML files (static sites, built output, email templates, server templates rendered to HTML). For JSX/Vue/Svelte source, the skill has the agent read components directly and suggests eslint-plugin-jsx-a11y for React; for rendered pages, axe-core and Lighthouse.

Manual checks the skill walks through: full keyboard pass (order, visibility, traps, focus not hidden behind sticky headers), widget keyboard patterns from the ARIA Authoring Practices, names/roles/states, landmarks and skip links, contrast, reflow at 320 px and 200% zoom, reduced motion, captions, target size.

WCAG 2.2 additions worth knowing (new since 2.1): Focus Not Obscured (Minimum) 2.4.11, Focus Appearance 2.4.13 (AAA), Dragging Movements 2.5.7, Target Size (Minimum) 2.5.8, Consistent Help 3.2.6, Redundant Entry 3.3.7, Accessible Authentication (Minimum) 3.3.8, and Accessible Authentication (Enhanced) 3.3.9 (AAA). SC 4.1.1 Parsing was removed in 2.2.

Report format: findings grouped by severity (blocks a task / makes it hard / minor), each with location, success criterion, who is affected, and a code fix, plus an explicit list of what was not tested.

Color contrast

python3 skills/color-contrast/scripts/contrast.py "#767676" white
contrast 4.54:1  (#767676 on white)
  AA normal text         needs 4.5:1  PASS
  AA large text          needs 3.0:1  PASS
  AAA normal text        needs 7.0:1  FAIL
  AAA large text         needs 4.5:1  PASS
  UI components (1.4.11) needs 3.0:1  PASS

With --fix, it searches lightness in the same hue and saturation for the nearest passing color:

python3 skills/color-contrast/scripts/contrast.py "#9ca3af" "#ffffff" --fix
# ... suggested foreground for AA: #6e7788

Supported inputs: #rgb, #rgba, #rrggbb, #rrggbbaa, rgb()/rgba() in comma or space syntax with optional / alpha, and basic named colors. Semi-transparent foregrounds are composited over the background before measuring, which is how they render.

Pairs people forget to check: placeholder text, disabled-looking but enabled buttons, focus rings against both the control and the page, links inside body text (they need 3:1 against the surrounding text if color is the only cue, or an underline), text over images and gradients (test the worst spot), error and success colors, and every pair again in dark mode.

Core Web Vitals

Metric Measures Good Poor
LCP When the largest content element renders at or under 2.5 s over 4.0 s
INP Responsiveness of interactions across the visit at or under 200 ms over 500 ms
CLS Unexpected layout shifts at or under 0.1 over 0.25

INP replaced First Input Delay as a Core Web Vital in March 2024.

The skill’s method:

  1. Field data first (PageSpeed Insights CrUX data, Search Console, or your own web-vitals RUM). Find the failing metric, template and device class.
  2. LCP by phase: time to first byte, resource load delay, resource load time, element render delay. Each phase has its own fixes; the most common win is making the LCP image discoverable in the HTML with fetchpriority="high" and never lazy-loading it.
  3. INP by phase: input delay (busy main thread: break up long tasks, defer third parties), processing time (do the UI update first, then yield, move work to a worker), presentation delay (smaller DOM, avoid layout thrashing, virtualize long lists).
  4. CLS: dimensions on all media and embeds, reserved space for late content, font fallback metrics, transform-based animation.
  5. Verify in the lab with consistent throttling, then in field data (CrUX is a rolling 28-day window).

Yielding to the main thread (from the skill’s INP section):

function yieldToMain() {
  if (globalThis.scheduler?.yield) return scheduler.yield();
  return new Promise((resolve) => setTimeout(resolve, 0));
}

button.addEventListener("click", async () => {
  showSpinner();          // visible feedback in the next frame
  await yieldToMain();    // let the browser paint
  await doExpensiveWork();
  hideSpinner();
});

Measuring in the field with attribution:

import { onLCP, onINP, onCLS } from "web-vitals/attribution";

function send(metric) {
  navigator.sendBeacon("/analytics", JSON.stringify({
    name: metric.name, value: metric.value, rating: metric.rating,
    attribution: metric.attribution,   // e.g. LCP element, slow INP phase, shifting element
  }));
}
onLCP(send); onINP(send); onCLS(send);

Responsive layout

The skill’s principles: mobile first, content-driven breakpoints, fluid sizing, container queries for components that live in slots of different widths, and no horizontal scrolling at 320 CSS px.

Patterns included in the skill:

Need Pattern
Card grid that fits any width without media queries repeat(auto-fit, minmax(min(16rem, 100%), 1fr))
Sidebar that stacks when space runs out Flex wrap with flex: 1 1 15rem sidebar and flex: 999 1 30rem content
Fluid type and spacing clamp() with a rem component so zoom still works
Component layouts that depend on their slot container-type: inline-size + @container
Readable text max-width: 65ch
Full-height mobile sections min-height: 100dvh instead of 100vh
Wide tables Scroll container with visible affordance, or stacked rows

Overflow hunting one-liner for the browser console:

[...document.querySelectorAll("*")].filter((e) => e.scrollWidth > document.documentElement.clientWidth)

Usual causes: fixed widths, long unbroken strings, images without max-width, flex items with the default min-width: auto, and 100vw (which includes the scrollbar).

Breakpoint testing set: 320, 375, 768, 1024, 1440 px, plus 200% zoom, landscape, long translated strings and large OS text settings.

Design tokens

Three tiers: primitives (raw palette and scales), semantic tokens (meaning: color.text.default, color.action.primary), and optional component tokens. Components use semantic tokens; themes remap semantic tokens only.

Input (DTCG format):

{
  "color": {
    "$type": "color",
    "gray": { "50": { "$value": "#f9fafb" }, "900": { "$value": "#111827" } },
    "text": { "default": { "$value": "{color.gray.900}" } },
    "bg":   { "$value": "{color.gray.50}" }
  },
  "space": { "$type": "dimension", "4": { "$value": { "value": 1, "unit": "rem" } } }
}

Output:

:root {
  --color-gray-50: #f9fafb;
  --color-gray-900: #111827;
  --color-text-default: var(--color-gray-900);
  --color-bg: var(--color-gray-50);
  --space-4: 1rem;
}

[data-theme="dark"] {
  --color-text-default: var(--color-gray-50);
  --color-bg: var(--color-gray-900);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-text-default: var(--color-gray-50);
    --color-bg: var(--color-gray-900);
  }
}

References become var() so themes cascade correctly; $type is inherited from groups; dimension objects, numeric dimensions, fontFamily arrays and cubicBezier arrays are formatted; unknown references and reference cycles are errors. Composite tokens (typography, shadow, border, transition) are out of scope for the small converter; the skill points to Style Dictionary or Terrazzo for full coverage.

Naming rules from the skill: name by role, not value; keep scales small; check contrast of every semantic text/background pair in every theme; deprecate before removing.

Image optimization

Image type Format Loading
Logos, icons, flat illustrations SVG (optimized) inline or <img>
Photos AVIF or WebP with JPEG fallback srcset + sizes
Screenshots, UI WebP or PNG; AVIF if text stays crisp srcset
Animated GIF muted looping <video> or animated WebP/AVIF autoplay muted loop playsinline
LCP hero best of the above, in the HTML fetchpriority="high", never lazy

The three mistakes the skill checks first: a lazy-loaded LCP image, a sizes attribute that does not match the rendered width (so the browser downloads a file several times too big), and images without width/height (layout shift).

Automate it: framework image components (Next.js <Image>, Astro <Image /> and <Picture />, Nuxt Image, Angular NgOptimizedImage), an image CDN, or a build step with sharp and svgo.

Accessible forms

The skill covers: visible labels tied with for/id; correct type, inputmode and autocomplete tokens; fieldsets for groups; required/optional marking in text; validation timing (on submit and on blur, not while typing); specific error messages linked with aria-describedby and aria-invalid; an error summary that receives focus on failed submit and updates the page title; never clearing user input; polite live regions for status messages; and WCAG 2.2 Accessible Authentication (allow paste and password managers, no memory puzzles).

Error message quality:

Weak Strong
“Invalid input” “Enter an email address in the format name@example.com”
“Required” “Enter your postcode”
“Error in date” “Date of birth must be in the past”
Red border only Red border, icon and text next to the field

Prompts that work well

Goal Prompt
Audit “Audit src/components/Checkout for WCAG 2.2 AA. Run the static checker on the built HTML, then do the manual keyboard checks and give fixes as diffs.”
Contrast “Check every text and border color pair in our theme file in light and dark mode and fix failing tokens.”
LCP “PageSpeed says LCP is 4.1 s on mobile for product pages. Find the LCP element and the slow phase, then fix it.”
INP “Typing in the search box feels laggy. Find the slow interaction and fix it without removing features.”
Layout “The pricing table overflows on phones. Find what causes horizontal scroll at 320 px and fix it.”
Tokens “Replace hard-coded colors in src/styles with semantic tokens and generate CSS variables with a dark theme.”
Images “Our blog pages ship 6 MB of images. Set up responsive images with AVIF/WebP and fix sizes attributes.”
Forms “Rebuild the sign-up form so errors are announced, summarized on submit and work with password managers.”

Comparison tables

Accessibility testing approaches

Approach Finds Misses Cost
Static HTML linting (a11y_lint.py) Missing alt, labels, names, lang, broken ARIA references Anything that depends on CSS, JS or rendering Seconds, no browser
Rendered-page engines (axe-core, Lighthouse, Pa11y) Contrast, computed names, ARIA misuse in the live DOM Keyboard logic, meaningfulness of text, focus management Seconds to minutes
Lint rules in code (eslint-plugin-jsx-a11y) Patterns in JSX as you type Runtime state Free in the editor
Manual keyboard and zoom testing Focus order, traps, visibility, reflow Screen reader announcements Minutes per page
Screen reader testing (NVDA, VoiceOver, TalkBack) What users actually hear Visual issues Most time, most value
Testing with disabled users Real barriers and priorities - Highest value; plan for it

Field vs lab performance data

  Field (RUM, CrUX) Lab (Lighthouse, DevTools)
Source Real users, real devices and networks One simulated device and network
Used for Google’s assessment Yes (CrUX) No
INP Measured from real interactions Not measured in a page-load test; use Total Blocking Time as a proxy or record interactions in DevTools
Good for Knowing whether there is a problem and where Finding why and verifying fixes quickly

Layout tools

Tool Best for
Flexbox One-dimensional rows or columns, content-sized items, wrapping
Grid Two-dimensional layouts, aligned rows and columns, page scaffolds
Container queries Components that change layout based on their own width
Media queries Page-level changes and user preferences (prefers-reduced-motion, prefers-color-scheme)
clamp() Fluid sizes with sensible minimums and maximums

Image formats

Format Strength Watch out for
AVIF Smallest files for photos at similar quality Slower to encode; check text and fine detail
WebP Broad support, good compression, alpha and animation Usually larger than AVIF for photos
JPEG Universal fallback No alpha
PNG Lossless, sharp UI and text Large for photos
SVG Resolution-independent icons and illustrations Optimize, and sanitize user-uploaded SVG

Design token tools

Tool What it does
tokens_to_css.py (this repo) Small, dependency-free DTCG to CSS variables with light/dark themes
Style Dictionary Mature build system for tokens to many platforms (CSS, iOS, Android, JS)
Terrazzo DTCG-focused token tooling with plugins
Figma variables Design-side source of truth; export to DTCG JSON with a plugin or the Figma API

Best picks: tools to pair with the skills

Need Pick Why
Rendered accessibility checks axe-core The engine behind many tools; run via CLI, Playwright or browser extension
Accessibility CI on many URLs Pa11y Simple command-line runner and CI tool
React lint rules eslint-plugin-jsx-a11y Catches issues while you type
Widget keyboard patterns ARIA Authoring Practices Guide Reference keyboard and ARIA behavior for menus, tabs, dialogs, comboboxes
Free screen reader (Windows) NVDA Widely used; test what users hear
Quick contrast check in the browser WebAIM Contrast Checker Fast manual checks
Field vitals in your analytics web-vitals Official library with attribution build
One-off page diagnosis PageSpeed Insights Field (CrUX) and lab data together
Performance budgets in CI Lighthouse CI Assert scores and budgets on every PR
Fluid type and space scales Utopia Generates clamp() scales
Robust layout primitives Every Layout Intrinsic layout patterns that avoid breakpoints
Image processing in Node sharp Fast resizing and AVIF/WebP encoding
SVG optimization SVGO Removes editor cruft from SVGs
Compare compression visually Squoosh Side-by-side codec and quality comparison
Browser support lookups Can I use Support tables for every web feature

Common myths

Myth Reality
“A Lighthouse accessibility score of 100 means the site is accessible.” Automated tools test a subset of criteria; keyboard, focus, meaning and screen reader behavior need manual testing.
“aria-label on everything makes it accessible.” ARIA changes what assistive technology announces, not behavior. Native elements are usually better, and wrong ARIA is worse than none.
“A high Lighthouse performance score means good Core Web Vitals.” Google’s assessment uses field data at the 75th percentile; a lab score on a fast connection can hide real-user problems, and the lab test does not measure INP.
“Lazy-loading every image is always faster.” Lazy-loading the LCP image delays it. Only lazy-load below the fold.
“Responsive means adding breakpoints for iPhone and iPad.” Breakpoints should follow content; fluid layouts and container queries need fewer of them.
“Placeholders can replace labels to save space.” They vanish on input, often fail contrast and are not reliably announced.
“Disabling zoom keeps the layout tidy on phones.” It fails WCAG and blocks low-vision users.

FAQ

What changed in WCAG 2.2 compared to 2.1? Nine new success criteria (including Focus Not Obscured, Target Size (Minimum), Dragging Movements, Consistent Help, Redundant Entry and Accessible Authentication) and the removal of 4.1.1 Parsing. The W3C’s “What’s new in WCAG 2.2” page lists them all.

Is 24x24 px the target size I should design for? 24x24 CSS px is the AA minimum in WCAG 2.2 (with spacing exceptions). Many design systems use 44x44 or 48x48 for primary touch targets because it is more comfortable; the AAA criterion (2.5.5) uses 44x44.

What is a good INP and how do I measure it locally? At or under 200 ms at the 75th percentile is good. Locally, record interactions in the Chrome DevTools Performance panel or use the Web Vitals extension; in production, use the web-vitals library with the attribution build to learn which phase is slow.

Why does my page pass Lighthouse but fail Core Web Vitals in Search Console? Search Console uses real-user data from slower devices and networks, and includes INP from real interactions. Lab tests run once on one simulated device.

Does the contrast checker support APCA? No. It implements the WCAG 2.x formula, which is what conformance is measured against. APCA is a newer perceptual model discussed for future guidelines; you can use it as an extra visual sanity check.

Should tokens be stored in Figma or in code? Pick one source of truth and generate the other. Many teams author in Figma variables and export DTCG JSON into the repo, then build CSS and native platform outputs from it.

Can these skills work with Tailwind CSS? Yes. The layout and image guidance is framework-agnostic, and tokens can feed Tailwind’s theme (Tailwind v4 reads CSS variables from @theme). Contrast and accessibility checks apply to the generated HTML regardless of the CSS approach.

Do the scripts send any data anywhere? No. They read local files and print results. No network access.

Can the static accessibility linter check React components? Not directly; it reads HTML. Run it on rendered output (a static export, dist/, or server-rendered HTML saved to a file), and use eslint-plugin-jsx-a11y on the source.

Where to go next

Repository layout and tests

.claude-plugin/                 plugin.json, marketplace.json
skills/
  accessibility-audit/          SKILL.md, scripts/a11y_lint.py
  color-contrast/               SKILL.md, scripts/contrast.py
  core-web-vitals/              SKILL.md
  responsive-layout/            SKILL.md
  design-tokens/                SKILL.md, scripts/tokens_to_css.py
  image-optimization/           SKILL.md
  accessible-forms/             SKILL.md
tests/test_scripts.py           unit tests, standard library only
python3 -m unittest discover -s tests -v
claude plugin validate .        # optional

Contributing

PRs are welcome: new linter rules (with tests and a WCAG reference), more layout patterns, framework-specific notes, and corrections. Cite the specification or official documentation for any threshold you add, keep skills concise, and run the tests before opening a PR.

If this helped you, a star helps others find it.

More free resources

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