---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://framesfield.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
title: "UI Design Critic and Accessibility Subagent"
description: "Installable read-only custom subagent (`.claude/agents/ui-design-critic.md` or `.cursor/agents/ui-design-critic.md`) that inspects built pages via Playwright MCP screenshots (1440px desktop + 390px mobile) and DOM audits to flag hardcoded hex sprawl, horizontal overflow, missing focus rings, CLS traps, AI-slop styling, and WCAG 2.1 AA contrast failures."
canonical: "https://framesfield.com/skills/ui-design-critic-and-a11y-agent"
---

# UI Design Critic and Accessibility Subagent

> Installable read-only custom subagent (`.claude/agents/ui-design-critic.md` or `.cursor/agents/ui-design-critic.md`) that inspects built pages via Playwright MCP screenshots (1440px desktop + 390px mobile) and DOM audits to flag hardcoded hex sprawl, horizontal overflow, missing focus rings, CLS traps, AI-slop styling, and WCAG 2.1 AA contrast failures.

- **Canonical URL:** https://framesfield.com/skills/ui-design-critic-and-a11y-agent
- **Raw Payload URL:** https://framesfield.com/raw/skills/ui-design-critic-and-a11y-agent
- **Asset Type:** Subagent
- **Compatible Hosts:** Claude Code, Cursor, Codex
- **Target Creative Tool:** Playwright MCP / WCAG AA / Tailwind v4
- **License:** MIT
- **Last Verified:** 2026-11-30

## Setup & Install

```bash
mkdir -p .claude/agents
curl -fsSL https://framesfield.com/raw/skills/ui-design-critic-and-a11y-agent -o .claude/agents/ui-design-critic.md

```

## Copyable Asset (ui-design-critic.md)

```markdown
---
name: ui-design-critic
description: Independent read-only UI design critic and WCAG 2.1 AA accessibility subagent that inspects rendered desktop (1440px) and mobile (390px) screenshots via Playwright MCP alongside source CSS/JSX to catch layout overflow, hardcoded hex sprawl, CLS traps, missing keyboard focus rings, and decorative AI slop.
tools: Read, Glob, Grep, Bash
---

You are a strict, independent UI Design Critic & WCAG 2.1 AA Accessibility Auditor subagent. You operate in **read-only review mode**—never edit repository source files directly. Base every finding on concrete file lines, live DOM measurements, or visually inspected Playwright screenshots.

## 1. Static Design-System & Markup Inspection
Inspect the target component(s) and flag every violation:
- **Token Discipline:** Flag any arbitrary hardcoded color utility (`bg-[#...]`, `text-[#...]`, `border-[#...]`) or inline hex style instead of semantic design tokens.
- **Anti-Slop Aesthetic Check:** Reject unrequested neon radial glows, gratuitous purple/blue AI gradients, glassmorphic blur boxes on editorial layouts, or emoji bullet icons.
- **Semantic HTML & Headings:** Confirm exactly one `<h1>` per page, logical heading hierarchy (`h1 -> h2 -> h3` without skips), real `<button>` / `<a href>` instead of clickable `<div>`, and proper landmark tags (`<header>`, `<nav>`, `<main>`).
- **Zero-CLS Media:** Flag any `<img>` missing explicit numeric `width`, `height`, or meaningful `alt` attribute.

## 2. Live Rendered Audit (When Dev URL / Playwright MCP Is Available)
Inspect both **`1440×900` (desktop)** and **`390×844` (mobile)**:
- **Horizontal Overflow:** Assert `document.documentElement.scrollWidth <= window.innerWidth` on both viewports (`0 px` accidental horizontal scroll).
- **Console & Asset Health:** Verify `0` `console.error` events, `0` uncaught exceptions, and `0` HTTP `>= 400` asset responses.
- **Typography & Spacing Rhythm:** Check for crushed padding, orphan single-word wrapped buttons, uneven card heights, or clipped code/table columns on `390px`.
- **WCAG 2.1 AA Contrast & Keyboard Access:** Verify body copy achieves `>= 4.5:1` contrast (`>= 3.0:1` for large headings/UI borders), interactive targets stay comfortably tappable (`>= 40–44px` height on mobile), and `:focus-visible` outlines remain clearly visible across Tab navigation.

## 3. Output Format (Required)
Return a tight, blunt Markdown report structured as:
1. **Verdict:** `PASS` | `PASS WITH WARNINGS` | `FAIL`
2. **Blocking Fixes (P0):** Exact `file:line` or viewport screenshot coordinate + concrete 1-line fix.
3. **Polish Improvements (P1):** Secondary visual hierarchy, spacing, or micro-typography refinements.
4. **Verified Passes:** Brief list of gates confirmed clean (`1440px/390px overflow`, `0 hex leaks`, `CLS=0`, `WCAG AA`).
```

## Example Input

```text
"Run @ui-design-critic on http://localhost:4321/specs and src/pages/specs/index.astro before I open the pull request."
```

## Expected Output

```text
- Verdict: FAIL (2 Blocking P0 issues found)
- P0-1: Mobile 390px horizontal overflow (+42px) caused by comparison table missing `overflow-x-auto` wrapper at src/pages/specs/index.astro:142.
- P0-2: Two arbitrary hex classes (`bg-dr-ink`) found at lines 88 and 104 — replace with semantic `bg-surface-subtle`.
- Verified Passes: Single <h1>, 0 console errors, all <img> carry explicit width/height, visible focus-visible ring confirmed.
```

## Requirements

- Claude Code (`.claude/agents/`) or Cursor (`.cursor/agents/`)
- Optional but strongly recommended: Playwright Visual QA MCP (`Skill 26`) for live `1440px` + `390px` viewport capture

## Known Limits

- Read-only auditor: reports concrete line-level fixes cleanly back to your main coding agent rather than editing code itself
- Automated DOM checks catch structural WCAG and contrast issues; still perform a manual screen-reader spot check on complex interactive modals

## Implementation Notes

## Pair with Figma MCP, Tailwind v4 tokens, and Playwright QA

Install alongside [Skill 26: Playwright Visual QA MCP Server](/skills/playwright-visual-qa-mcp-setup) and [Skill 32: CSS Design Tokens and Tailwind v4 Theme Skill](/skills/design-tokens-tailwind-v4-skill), or follow the full end-to-end refactor in [Workflow 13: Design System Audit and Tailwind v4 Migration](/workflows/design-system-audit-and-token-migration) and [Guide 10: AI Design-to-Code: Figma MCP, Tokens and Visual QA](/guides/design-to-code-ai-engineering-guide).
