Design Quality Engine
Three composable layers that produce better UI code — automatically (invisible quality floor), interactively (design conversation partner), and educationally (teaching tool).
Layer Architecture
┌─────────────────────────────────────────────┐
│ Project CLAUDE.md │
│ layers: [craft, a11y] │
│ aesthetic: shadcn | preset:clean-functional│
│ overrides: { ... } │
└──────────────────┬──────────────────────────┘
│
┌─────────┴─────────┐
│ Design Engine │ ← this file (orchestrator)
│ (always loaded) │
└─────────┬─────────┘
│
┌──────────────┼──────────────┐
▼ ▼ ▼
┌────────┐ ┌───────────┐ ┌─────────┐
│ Craft │ │ Aesthetic │ │ A11y │
│craft.md│ │preset/DS │ │ a11y.md │
└────────┘ └───────────┘ └─────────┘
| Layer |
File |
Purpose |
Default |
| Craft |
craft.md |
Typographic & spatial fundamentals |
On |
| Aesthetic (preset/design-system) |
presets/ |
Project look & feel |
clean-functional fallback |
| Accessibility (a11y) |
a11y.md |
WCAG 2.1 + 2.2 compliance, modern HTML, visual quality |
On |
Related Skills
| Skill |
When |
Invoke With |
design-direction |
Before planning |
/design:direction or "explore the visual direction" |
design-brief |
Before coding |
/design:brief or "generate a style brief" |
design-review |
After coding |
/design:review or "review the design quality" |
design-fix |
After review |
/design:fix or "fix the design issues" |
/design:review produces a composite score with layer sub-scores.
/design:a11y works as a standalone a11y-only shortcut.
Step 1: Load Project Config
Read the project's CLAUDE.md for a ## Design Quality section. Parse these fields:
| Field |
Default |
Options |
| Layers |
craft, a11y |
Any combination of craft, a11y. Omit one to disable it. |
| Aesthetic |
clean-functional |
A preset name (clean-functional, premium-depth, refined-simple), design-system (auto-detect), or none |
| Strictness |
standard |
relaxed (suggestions only), standard (warnings), strict (errors that affect score) |
| Teaching |
normal |
verbose (explain everything), normal (explain novel violations — first per concept per session), quiet (just flag) |
| Auto-fix |
none |
none (manual), errors (auto-fix errors), errors-warnings, silent (CI/pre-commit) |
| Overrides |
none |
Key-value overrides for any layer (e.g., measure: 60-80ch) |
Config Example
## Design Quality
**Layers:** craft, a11y
**Aesthetic:** clean-functional
**Strictness:** standard
**Teaching:** normal
**Auto-fix:** none
**Overrides:**
- measure: 60-80ch (wider for code documentation)
Smart Defaults (when no config exists)
If no ## Design Quality section is found:
- Layers:
craft + a11y (both on)
- Aesthetic:
clean-functional (fallback preset)
- Strictness:
standard
- Teaching:
normal
- Auto-fix:
none
- Overrides: none
Design System Detection
When Aesthetic: design-system is set, look for:
- Shadcn/ui components (
components/ui/ directory)
- Design tokens file (
tokens.json, theme.ts, tailwind.config custom theme)
- Figma-exported tokens
When a design system is detected, it replaces the aesthetic preset — the craft and a11y layers still apply on top.
Loading Sequence
- Parse
## Design Quality from project CLAUDE.md (or apply smart defaults)
- Load active layers:
- If
craft in layers → load craft.md
- If
a11y in layers → load a11y.md
- Load aesthetic:
- If preset name → load the matching file from presets/
- If
design-system → detect and load project's design system
- If
none → skip aesthetic layer
- Load guard checks from guard-checks.md
- Apply any overrides from config
Step 2: Skill Precedence
When this skill is active with a project preset, its rules take precedence over the generic frontend-design skill. The frontend-design skill's generic aesthetic guidance ("avoid Inter," "make unexpected choices") does NOT apply when a preset is configured. The preset defines the project's aesthetic — follow it.
Other design skills (interface-design, accessibility-a11y, ui-design-system) remain complementary.
Step 3: Inline Guard During Coding
When writing UI code, silently apply checks from all active layers:
- Before writing a component, check the code against:
- Craft checks — measure, rhythm, scale, weight, typeface constraints
- Aesthetic checks (preset) — colors, fonts, spacing grid, elevation, motion
- A11y checks — touch targets, ARIA labels, contrast, keyboard nav, WCAG 2.2
- If violations found, flag them in your response BEFORE writing the code
- Write the corrected code (not the violating version)
- Apply teaching moments per the Teaching setting:
verbose: Explain every violation with context from the layer reference
normal: Explain the first occurrence of each concept per session
quiet: Just flag the violation, no explanation
Refer to guard-checks.md for the full checklist. Checks are tagged by layer — only run checks for active layers.
This is automatic — no user action needed. Use /design:review for the explicit version.
Platform Detection
| Platform |
File Types |
Token System |
| Web (React, Next.js) |
.tsx, .css, .module.css |
Tailwind/CSS variables |
| iOS/macOS (SwiftUI) |
.swift |
Asset catalogs, Color() |
| iOS/macOS (UIKit/AppKit) |
.swift, .xib, .storyboard |
Asset catalogs, UIColor/NSColor |
| Android (Compose) |
.kt |
Material Theme tokens |
| Flutter |
.dart |
ThemeData tokens |
Proactive Recommendations
Proactively suggest the right command at the right time. Don't wait for the user to remember — guide them through the workflow.
| You Detect |
Active Layers |
Recommend |
How to Say It |
| User is starting a new project or hasn't chosen aesthetics |
— |
/design:direction |
"Run /design:direction to explore the visual direction for this project." |
| User is brainstorming a UI feature |
Craft |
Surface design principles |
"This is data-dense — consider a modular scale for the type hierarchy. A minor third (1.2) keeps sizes close for dense UI." |
| User is planning/starting a UI feature |
All active layers |
/design:brief |
"Before we start coding, run /design:brief to lock in constraints from all active layers — craft, [preset] aesthetic, and a11y requirements." |
| User is writing UI code |
All active layers |
Apply guard silently |
Don't interrupt — guard silently and flag violations naturally. Teach on novel violations. |
| User finishes UI changes or is about to commit |
All active layers |
/design:review |
"Run /design:review [path] to get a composite quality score with craft, aesthetic, and a11y sub-scores." |
| User asks for code review with UI in diff |
All active layers |
Include design scoring |
Run design-review scoring as part of the code review — don't make them ask separately. |
| User's composite score < 70 |
All active layers |
/design:fix |
"Composite score is XX/100 — run /design:fix to apply corrections grouped by severity." |
Session starts with ## Design Quality in CLAUDE.md |
— |
Acknowledge |
Brief one-liner: "Design quality active — [layers], [preset] aesthetic." |
| User asks for a11y-only audit |
A11y |
/design:a11y |
"Running a11y layer only — use /design:review for the full composite audit." |
Recommendation Rules
- Suggest once, don't nag. If the user skips a suggestion, don't repeat it.
- Be brief. One sentence max.
- Context-sensitive. Only suggest during UI work, not backend work.
- Natural flow. Feel like a teammate's suggestion, not a popup.
- Never block. Recommendations are always optional.
Preset System
Built-in Presets
| Preset |
Aesthetic |
Best For |
clean-functional |
Clean, functional, minimal |
SaaS dashboards, dev tools, productivity apps |
premium-depth |
Premium, polished, depth |
Marketing sites, developer platforms, fintech |
refined-simple |
Refined simplicity |
Consumer apps, content tools, note-taking |
Presets are in the presets/ directory.
Custom Presets
Create a new .md file in presets/ following the same structure. Reference it in CLAUDE.md:
## Design Quality
**Aesthetic:** my-custom-preset
Use /design:direction to generate a custom preset interactively.
Per-Session Override
"Use the premium-depth preset for this session"
Overrides the project default until the session ends.
Workflow Integration
| Workflow Stage |
Active Layers |
What It Does |
| direction |
— |
Explores visual identity through structured dialogue. Generates a custom preset file. |
| brainstorm |
Craft |
Surfaces relevant design principles for the feature. "This is data-dense — consider a modular scale for the type hierarchy." |
| plan / brief |
All active layers |
Generates unified constraints document: typography (craft), color/elevation (aesthetic), a11y requirements. User can adjust before coding. |
| work |
All active layers (inline) |
Silent guard checks from all layers. Teaching moments on violations per Teaching setting. |
| review |
All active layers (explicit) |
Unified audit → composite score with layer sub-scores. Single /design:review runs everything. |
| fix |
All active layers |
Applies corrections grouped by severity with user approval. |
| a11y (standalone) |
A11y layer only |
Still works independently for quick a11y-only audits via /design:a11y. |
1---2name: design-quality3description: Unified design quality engine with three composable layers (craft, aesthetic, a11y). Auto-activates during UI coding to enforce typography, spacing, color tokens, and accessibility standards. Use when working on UI files, components, or when the user mentions design, aesthetics, taste, or polish.4---56# Design Quality Engine78<!-- Inspired by Robert Bringhurst's "The Elements of Typographic Style" (craft layer) -->910Three composable layers that produce better UI code — automatically (invisible quality floor), interactively (design conversation partner), and educationally (teaching tool).1112## Layer Architecture1314```15┌─────────────────────────────────────────────┐16│ Project CLAUDE.md │17│ layers: [craft, a11y] │18│ aesthetic: shadcn | preset:clean-functional│19│ overrides: { ... } │20└──────────────────┬──────────────────────────┘21 │22 ┌─────────┴─────────┐23 │ Design Engine │ ← this file (orchestrator)24 │ (always loaded) │25 └─────────┬─────────┘26 │27 ┌──────────────┼──────────────┐28 ▼ ▼ ▼29┌────────┐ ┌───────────┐ ┌─────────┐30│ Craft │ │ Aesthetic │ │ A11y │31│craft.md│ │preset/DS │ │ a11y.md │32└────────┘ └───────────┘ └─────────┘33```3435| Layer | File | Purpose | Default |36|-------|------|---------|---------|37| **Craft** | [craft.md](layers/craft.md) | Typographic & spatial fundamentals | On |38| **Aesthetic** (preset/design-system) | [presets/](presets/) | Project look & feel | `clean-functional` fallback |39| **Accessibility** (a11y) | [a11y.md](layers/a11y.md) | WCAG 2.1 + 2.2 compliance, modern HTML, visual quality | On |4041## Related Skills4243| Skill | When | Invoke With |44|-------|------|-------------|45| `design-direction` | Before planning | `/design:direction` or "explore the visual direction" |46| `design-brief` | Before coding | `/design:brief` or "generate a style brief" |47| `design-review` | After coding | `/design:review` or "review the design quality" |48| `design-fix` | After review | `/design:fix` or "fix the design issues" |4950`/design:review` produces a composite score with layer sub-scores.51`/design:a11y` works as a standalone a11y-only shortcut.5253---5455## Step 1: Load Project Config5657Read the project's `CLAUDE.md` for a `## Design Quality` section. Parse these fields:5859| Field | Default | Options |60|-------|---------|---------|61| **Layers** | `craft, a11y` | Any combination of `craft`, `a11y`. Omit one to disable it. |62| **Aesthetic** | `clean-functional` | A preset name (`clean-functional`, `premium-depth`, `refined-simple`), `design-system` (auto-detect), or `none` |63| **Strictness** | `standard` | `relaxed` (suggestions only), `standard` (warnings), `strict` (errors that affect score) |64| **Teaching** | `normal` | `verbose` (explain everything), `normal` (explain novel violations — first per concept per session), `quiet` (just flag) |65| **Auto-fix** | `none` | `none` (manual), `errors` (auto-fix errors), `errors-warnings`, `silent` (CI/pre-commit) |66| **Overrides** | none | Key-value overrides for any layer (e.g., `measure: 60-80ch`) |6768### Config Example6970```markdown71## Design Quality7273**Layers:** craft, a11y74**Aesthetic:** clean-functional75**Strictness:** standard76**Teaching:** normal77**Auto-fix:** none78**Overrides:**79- measure: 60-80ch (wider for code documentation)80```8182### Smart Defaults (when no config exists)8384If no `## Design Quality` section is found:85- Layers: `craft` + `a11y` (both on)86- Aesthetic: `clean-functional` (fallback preset)87- Strictness: `standard`88- Teaching: `normal`89- Auto-fix: `none`90- Overrides: none9192### Design System Detection9394When `Aesthetic: design-system` is set, look for:951. Shadcn/ui components (`components/ui/` directory)962. Design tokens file (`tokens.json`, `theme.ts`, `tailwind.config` custom theme)973. Figma-exported tokens9899When a design system is detected, it **replaces** the aesthetic preset — the craft and a11y layers still apply on top.100101### Loading Sequence1021031. Parse `## Design Quality` from project `CLAUDE.md` (or apply smart defaults)1042. Load active layers:105 - If `craft` in layers → load [craft.md](layers/craft.md)106 - If `a11y` in layers → load [a11y.md](layers/a11y.md)1073. Load aesthetic:108 - If preset name → load the matching file from [presets/](presets/)109 - If `design-system` → detect and load project's design system110 - If `none` → skip aesthetic layer1114. Load guard checks from [guard-checks.md](references/guard-checks.md)1125. Apply any overrides from config113114## Step 2: Skill Precedence115116**When this skill is active with a project preset, its rules take precedence over the generic `frontend-design` skill.** The `frontend-design` skill's generic aesthetic guidance ("avoid Inter," "make unexpected choices") does NOT apply when a preset is configured. The preset defines the project's aesthetic — follow it.117118Other design skills (`interface-design`, `accessibility-a11y`, `ui-design-system`) remain complementary.119120## Step 3: Inline Guard During Coding121122When writing UI code, silently apply checks from **all active layers**:1231241. Before writing a component, check the code against:125 - **Craft checks** — measure, rhythm, scale, weight, typeface constraints126 - **Aesthetic checks** (preset) — colors, fonts, spacing grid, elevation, motion127 - **A11y checks** — touch targets, ARIA labels, contrast, keyboard nav, WCAG 2.21282. If violations found, flag them in your response BEFORE writing the code1293. Write the corrected code (not the violating version)1304. Apply teaching moments per the **Teaching** setting:131 - `verbose`: Explain every violation with context from the layer reference132 - `normal`: Explain the first occurrence of each concept per session133 - `quiet`: Just flag the violation, no explanation134135Refer to [guard-checks.md](references/guard-checks.md) for the full checklist. Checks are tagged by layer — only run checks for active layers.136137This is automatic — no user action needed. Use `/design:review` for the explicit version.138139### Platform Detection140141| Platform | File Types | Token System |142|----------|-----------|--------------|143| **Web** (React, Next.js) | `.tsx`, `.css`, `.module.css` | Tailwind/CSS variables |144| **iOS/macOS** (SwiftUI) | `.swift` | Asset catalogs, `Color()` |145| **iOS/macOS** (UIKit/AppKit) | `.swift`, `.xib`, `.storyboard` | Asset catalogs, `UIColor`/`NSColor` |146| **Android** (Compose) | `.kt` | Material Theme tokens |147| **Flutter** | `.dart` | ThemeData tokens |148149## Proactive Recommendations150151**Proactively suggest the right command at the right time.** Don't wait for the user to remember — guide them through the workflow.152153| You Detect | Active Layers | Recommend | How to Say It |154|------------|---------------|-----------|---------------|155| User is starting a new project or hasn't chosen aesthetics | — | `/design:direction` | "Run `/design:direction` to explore the visual direction for this project." |156| User is brainstorming a UI feature | Craft | Surface design principles | "This is data-dense — consider a modular scale for the type hierarchy. A minor third (1.2) keeps sizes close for dense UI." |157| User is planning/starting a UI feature | All active layers | `/design:brief` | "Before we start coding, run `/design:brief` to lock in constraints from all active layers — craft, [preset] aesthetic, and a11y requirements." |158| User is writing UI code | All active layers | Apply guard silently | Don't interrupt — guard silently and flag violations naturally. Teach on novel violations. |159| User finishes UI changes or is about to commit | All active layers | `/design:review` | "Run `/design:review [path]` to get a composite quality score with craft, aesthetic, and a11y sub-scores." |160| User asks for code review with UI in diff | All active layers | Include design scoring | Run design-review scoring as part of the code review — don't make them ask separately. |161| User's composite score < 70 | All active layers | `/design:fix` | "Composite score is XX/100 — run `/design:fix` to apply corrections grouped by severity." |162| Session starts with `## Design Quality` in CLAUDE.md | — | Acknowledge | Brief one-liner: "Design quality active — [layers], [preset] aesthetic." |163| User asks for a11y-only audit | A11y | `/design:a11y` | "Running a11y layer only — use `/design:review` for the full composite audit." |164165### Recommendation Rules1661671. **Suggest once, don't nag.** If the user skips a suggestion, don't repeat it.1682. **Be brief.** One sentence max.1693. **Context-sensitive.** Only suggest during UI work, not backend work.1704. **Natural flow.** Feel like a teammate's suggestion, not a popup.1715. **Never block.** Recommendations are always optional.172173## Preset System174175### Built-in Presets176177| Preset | Aesthetic | Best For |178|--------|-----------|----------|179| `clean-functional` | Clean, functional, minimal | SaaS dashboards, dev tools, productivity apps |180| `premium-depth` | Premium, polished, depth | Marketing sites, developer platforms, fintech |181| `refined-simple` | Refined simplicity | Consumer apps, content tools, note-taking |182183<!-- Inspiration: clean-functional (Linear/Mercury), premium-depth (Stripe/Vercel), refined-simple (Apple/Notion) -->184185Presets are in the [presets/](presets/) directory.186187### Custom Presets188189Create a new `.md` file in `presets/` following the same structure. Reference it in CLAUDE.md:190191```markdown192## Design Quality193**Aesthetic:** my-custom-preset194```195196Use `/design:direction` to generate a custom preset interactively.197198### Per-Session Override199200> "Use the premium-depth preset for this session"201202Overrides the project default until the session ends.203204## Workflow Integration205206| Workflow Stage | Active Layers | What It Does |207|----------------|---------------|--------------|208| **direction** | — | Explores visual identity through structured dialogue. Generates a custom preset file. |209| **brainstorm** | Craft | Surfaces relevant design principles for the feature. "This is data-dense — consider a modular scale for the type hierarchy." |210| **plan / brief** | All active layers | Generates unified constraints document: typography (craft), color/elevation (aesthetic), a11y requirements. User can adjust before coding. |211| **work** | All active layers (inline) | Silent guard checks from all layers. Teaching moments on violations per Teaching setting. |212| **review** | All active layers (explicit) | Unified audit → composite score with layer sub-scores. Single `/design:review` runs everything. |213| **fix** | All active layers | Applies corrections grouped by severity with user approval. |214| **a11y** (standalone) | A11y layer only | Still works independently for quick a11y-only audits via `/design:a11y`. |