Design System Drift & Variant-Budget Guard
Prevent multi-route component proliferation, unpoliced variant explosions, and keyboard focus ring suppression across shipping applications.
Why This Skill Is Needed & Target State
Single-file linters and isolated component tests miss the primary failure mode of evolving applications: cross-route design drift.
- Screen 1 declares 3 button variants (
primary, secondary, outline). Screen 7 invents a 4th variant (ghost with slightly different padding or opacity) because the author lacked global visibility.
- Interactive controls (
button, a, input, select) suppress outline focus rings via outline: none or Tailwind focus:outline-none without providing an explicit :focus-visible replacement, breaking WCAG 2.4.7 keyboard accessibility.
- Ad-hoc design tokens are created and used on exactly one route, inflating theme entropy.
The target state is a governed, bounded design system with explicit variant budgets per control kind, 100% visible keyboard focus indicators, and minimal token entropy.
Invariant Rules
- Variant Budget Enforcement: Each control kind (
button, input, select, card, badge) must strictly adhere to its declared variant budget (default: 4 for button/card, 2 for select/input).
- Keyboard Focus Ring Protection: Interactive elements must never suppress outline (
outline: none, focus:outline-none) without an accompanying visible replacement (:focus-visible:ring-2, box-shadow).
- Zero Orphaned Tokens: Design tokens used on exactly one route in multi-route products must be promoted to the canonical global theme or consolidated.
Mathematical Formulation: Design System Entropy Index ($DSEI$)
$$DSEI = \sum_{k \in \text{Kinds}} \max\left(0, \frac{V_k - B_k}{B_k}\right) + \omega_{\text{focus}} \cdot F_{\text{missing}} + \omega_{\text{orphan}} \cdot T_{\text{orphan}}$$
Where:
- $V_k$ is the observed variant count for control family $k$.
- $B_k$ is the declared budget limit.
- $F_{\text{missing}}$ is the count of interactive elements missing keyboard focus rings.
- $T_{\text{orphan}}$ is the count of single-route design tokens.
CLI Usage
# Scan source tree for variant budgets and focus ring suppression
bunx anti-slop-engineering system-drift --scan src/
# Specify per-kind variant budgets
bunx anti-slop-engineering system-drift --scan src/ --max-variants button=4,select=1,card=3 --json
# Validate pre-existing system drift record
bunx anti-slop-engineering system-drift --file .anti-slop/system-drift.json --strict
1---2name: design-system-drift-guard3description: Audit multi-surface applications for cross-route design system drift, unpoliced component variant explosions, orphaned single-route tokens, and keyboard focus-ring accessibility suppression.4license: MIT5metadata:6 source: https://skillmd.com/skills/immamdouhaboammar/design-system-drift-guard7 version: "1.7.0"8 parent: anti-slop-engineering9---1011# Design System Drift & Variant-Budget Guard1213> Prevent multi-route component proliferation, unpoliced variant explosions, and keyboard focus ring suppression across shipping applications.1415## Why This Skill Is Needed & Target State1617Single-file linters and isolated component tests miss the primary failure mode of evolving applications: **cross-route design drift**.18- Screen 1 declares 3 button variants (`primary`, `secondary`, `outline`). Screen 7 invents a 4th variant (`ghost` with slightly different padding or opacity) because the author lacked global visibility.19- Interactive controls (`button`, `a`, `input`, `select`) suppress outline focus rings via `outline: none` or Tailwind `focus:outline-none` without providing an explicit `:focus-visible` replacement, breaking WCAG 2.4.7 keyboard accessibility.20- Ad-hoc design tokens are created and used on exactly one route, inflating theme entropy.2122The target state is a governed, bounded design system with explicit variant budgets per control kind, 100% visible keyboard focus indicators, and minimal token entropy.2324## Invariant Rules25261. **Variant Budget Enforcement:** Each control kind (`button`, `input`, `select`, `card`, `badge`) must strictly adhere to its declared variant budget (default: 4 for button/card, 2 for select/input).272. **Keyboard Focus Ring Protection:** Interactive elements must never suppress outline (`outline: none`, `focus:outline-none`) without an accompanying visible replacement (`:focus-visible:ring-2`, `box-shadow`).283. **Zero Orphaned Tokens:** Design tokens used on exactly one route in multi-route products must be promoted to the canonical global theme or consolidated.2930## Mathematical Formulation: Design System Entropy Index ($DSEI$)3132$$DSEI = \sum_{k \in \text{Kinds}} \max\left(0, \frac{V_k - B_k}{B_k}\right) + \omega_{\text{focus}} \cdot F_{\text{missing}} + \omega_{\text{orphan}} \cdot T_{\text{orphan}}$$3334Where:35- $V_k$ is the observed variant count for control family $k$.36- $B_k$ is the declared budget limit.37- $F_{\text{missing}}$ is the count of interactive elements missing keyboard focus rings.38- $T_{\text{orphan}}$ is the count of single-route design tokens.3940## CLI Usage4142```bash43# Scan source tree for variant budgets and focus ring suppression44bunx anti-slop-engineering system-drift --scan src/4546# Specify per-kind variant budgets47bunx anti-slop-engineering system-drift --scan src/ --max-variants button=4,select=1,card=3 --json4849# Validate pre-existing system drift record50bunx anti-slop-engineering system-drift --file .anti-slop/system-drift.json --strict51```