Design Token Audit
Scan SCSS files for hardcoded values that should use the design token system.
When to use
When the user asks to:
- "Find hardcoded colors" or "audit color usage"
- "Check spacing token usage" or "find raw px values"
- "Check typography consistency" or "find hardcoded font stacks"
- "Audit design tokens" or "enforce token usage"
- Validate that a component or package consistently uses the token system
Not for checking variable completeness across themes (use /cross-theme-audit instead).
Design Token System Reference
The repo provides these token accessor functions (defined in packages/core/scss/):
| Category |
Function / Pattern |
Source |
| Spacing |
k-spacing($step) |
spacing/index.scss — steps: 0, 1px, 0.5–30 |
| Color |
k-color($key) |
color-system/_functions.scss — keys: primary, base, surface, border, etc. |
| Border radius |
k-border-radius($key) |
border-radii/index.scss — keys: sm, md, lg, full, none |
| Elevation |
k-elevation($level) |
elevation/index.scss — levels: 1–9 |
| Motion |
k-easing($key), k-duration($key) |
motion/index.scss |
| Typography |
$kendo-font-size-*, $kendo-line-height-*, $kendo-font-weight-*, $kendo-font-family-* |
typography/index.scss |
Inputs
The user provides:
- target (optional): A component name (e.g.,
button), a package name (e.g., default), or all. Defaults to all.
- category (optional): One of
color, spacing, typography, elevation, border-radius, or all. Defaults to all.
Procedure
Step 1: Run the audit script
Execute the bundled script to scan for violations:
bash .github/skills/audit-design-tokens/scripts/audit.sh [target] [--category CATEGORY]
Examples:
bash .github/skills/audit-design-tokens/scripts/audit.sh button
bash .github/skills/audit-design-tokens/scripts/audit.sh default --category color
bash .github/skills/audit-design-tokens/scripts/audit.sh all --category spacing
Step 2: Interpret the output
The script produces structured output grouped by category and package:
=== Design Token Audit: button ===
--- COLOR violations ---
packages/default/scss/button/_variables.scss:160: ... rgba(0, 0, 0, .08) ...
→ Should use: k-color() or $kendo-*-color variable
--- SPACING violations ---
(none)
--- TYPOGRAPHY violations ---
(none)
--- ELEVATION violations ---
(none)
--- BORDER-RADIUS violations ---
(none)
Summary: 1 violation(s) found
Step 3: Classify violations
Not every match is a real violation. Apply these exceptions:
Legitimate exceptions (do NOT flag)
_variables.scss files in themes: Values like 1px for border-width, 0px for shadow-blur, and 2px for shadow-spread are acceptable since these ARE the token definitions.
_variables.scss using k-color(), k-spacing(), color-mix(), etc.: These are already using the token system correctly.
- Calc expressions:
calc() containing $kendo-* variable references is fine.
0 and 0px: Zero values don't need a token.
1px border-width: Standard practice, no token needed.
rgba(..., $kendo-*) or color-mix(in srgb, k-color(...), ...): Already using tokens as inputs.
inherit, initial, none, auto, transparent, currentColor: CSS keywords.
- Core
_layout.scss and _theme.scss: These use $kendo-* variables as CSS property values — that's correct. Only flag hardcoded literals (padding: 8px instead of padding: $kendo-button-padding-y).
Real violations (DO flag)
- Raw hex colors in
_variables.scss: $kendo-button-bg: #ff6358 → Should use k-color(primary).
- Raw px/rem in
_variables.scss for spacing properties: $kendo-button-padding-x: 8px → Should use k-spacing(2).
- Literal font-family strings:
font-family: Arial, sans-serif → Should use $kendo-font-family.
- Raw box-shadow in
_theme.scss: box-shadow: 0 2px 4px rgba(0,0,0,.2) → Should use k-elevation() or $kendo-*-shadow.
- Raw border-radius in
_layout.scss: border-radius: 4px → Should use k-border-radius(md) or $kendo-*-border-radius.
- Hardcoded font-size/line-height/font-weight in
_layout.scss: Direct numeric values instead of $kendo-font-* variables.
Step 4: Present findings
Report violations grouped by category and severity:
| Category |
Package |
File |
Line |
Value |
Suggested Fix |
| color |
default |
button/_variables.scss |
160 |
rgba(0, 0, 0, .08) |
Use color-mix(in srgb, k-color(on-app-surface) 8%, transparent) |
| spacing |
material |
chip/_variables.scss |
22 |
8px |
Use k-spacing(2) |
| ... |
... |
... |
... |
... |
... |
Step 5: Suggest fixes
For each real violation, propose the correct token usage:
- Color: Replace with
k-color(token-name) or color-mix() with token inputs
- Spacing: Replace with
k-spacing(step) — map px to step using the spacing scale (4px→1, 8px→2, 12px→3, 16px→4, etc.)
- Typography: Replace with
$kendo-font-size-*, $kendo-line-height-*, $kendo-font-weight-*, or $kendo-font-family
- Elevation: Replace with
k-elevation(level) or define a $kendo-*-shadow variable
- Border radius: Replace with
k-border-radius(key) or $kendo-*-border-radius variable
Offer to apply the fixes.
Gotchas
- Core
_variables.scss files use null !default — they define the token skeleton, not values. Scan theme overrides (default, classic, material, fluent, bootstrap) for actual hardcoded values.
- Theme
_variables.scss paths differ: packages/{theme}/scss/{component}/ (no components/ subdirectory), unlike core which uses packages/core/scss/components/{component}/.
- Fluent theme wraps everything in
var() — so var(--kendo-spacing-2, 0.5rem) is correct even though it contains a rem literal.
- The spacing scale is non-linear: 1→0.25rem(4px), 2→0.5rem(8px), 3→0.75rem(12px), 4→1rem(16px). Use
packages/core/scss/spacing/index.scss as the canonical reference.
color-mix() syntax: color-mix(in srgb, k-color(key) N%, transparent) is the modern approach — do NOT flag these as violations.
- Some components intentionally use hardcoded values for pixel-perfect rendering (e.g.,
1px borders, 2px focus ring offsets). These are design decisions, not violations.
1---2name: audit-design-tokens3description: Audit and report on design token usage (color, spacing, typography, elevation, border-radius) across SCSS packages. Scans for hardcoded values (hex colors, raw px/rem, font stacks, literal box-shadows) that should use design token functions like k-spacing(), k-color(), k-elevation(), k-border-radius(), or $kendo-* variables. Use this skill when the user wants to find hardcoded colors, audit spacing tokens, check typography consistency, or enforce token usage.4---56# Design Token Audit78Scan SCSS files for hardcoded values that should use the design token system.910## When to use1112When the user asks to:13- "Find hardcoded colors" or "audit color usage"14- "Check spacing token usage" or "find raw px values"15- "Check typography consistency" or "find hardcoded font stacks"16- "Audit design tokens" or "enforce token usage"17- Validate that a component or package consistently uses the token system1819Not for checking variable completeness across themes (use `/cross-theme-audit` instead).2021## Design Token System Reference2223The repo provides these token accessor functions (defined in `packages/core/scss/`):2425| Category | Function / Pattern | Source |26|----------|-------------------|--------|27| **Spacing** | `k-spacing($step)` | `spacing/index.scss` — steps: 0, 1px, 0.5–30 |28| **Color** | `k-color($key)` | `color-system/_functions.scss` — keys: primary, base, surface, border, etc. |29| **Border radius** | `k-border-radius($key)` | `border-radii/index.scss` — keys: sm, md, lg, full, none |30| **Elevation** | `k-elevation($level)` | `elevation/index.scss` — levels: 1–9 |31| **Motion** | `k-easing($key)`, `k-duration($key)` | `motion/index.scss` |32| **Typography** | `$kendo-font-size-*`, `$kendo-line-height-*`, `$kendo-font-weight-*`, `$kendo-font-family-*` | `typography/index.scss` |3334## Inputs3536The user provides:37- **target** (optional): A component name (e.g., `button`), a package name (e.g., `default`), or `all`. Defaults to `all`.38- **category** (optional): One of `color`, `spacing`, `typography`, `elevation`, `border-radius`, or `all`. Defaults to `all`.3940## Procedure4142### Step 1: Run the audit script4344Execute the bundled script to scan for violations:4546```bash47bash .github/skills/audit-design-tokens/scripts/audit.sh [target] [--category CATEGORY]48```4950Examples:51```bash52bash .github/skills/audit-design-tokens/scripts/audit.sh button53bash .github/skills/audit-design-tokens/scripts/audit.sh default --category color54bash .github/skills/audit-design-tokens/scripts/audit.sh all --category spacing55```5657### Step 2: Interpret the output5859The script produces structured output grouped by category and package:6061```62=== Design Token Audit: button ===6364--- COLOR violations ---65 packages/default/scss/button/_variables.scss:160: ... rgba(0, 0, 0, .08) ...66 → Should use: k-color() or $kendo-*-color variable6768--- SPACING violations ---69 (none)7071--- TYPOGRAPHY violations ---72 (none)7374--- ELEVATION violations ---75 (none)7677--- BORDER-RADIUS violations ---78 (none)7980Summary: 1 violation(s) found81```8283### Step 3: Classify violations8485Not every match is a real violation. Apply these exceptions:8687#### Legitimate exceptions (do NOT flag)8889- **`_variables.scss` files in themes**: Values like `1px` for border-width, `0px` for shadow-blur, and `2px` for shadow-spread are acceptable since these ARE the token definitions.90- **`_variables.scss` using `k-color()`, `k-spacing()`, `color-mix()`, etc.**: These are already using the token system correctly.91- **Calc expressions**: `calc()` containing `$kendo-*` variable references is fine.92- **`0` and `0px`**: Zero values don't need a token.93- **`1px` border-width**: Standard practice, no token needed.94- **`rgba(..., $kendo-*)` or `color-mix(in srgb, k-color(...), ...)`**: Already using tokens as inputs.95- **`inherit`, `initial`, `none`, `auto`, `transparent`, `currentColor`**: CSS keywords.96- **Core `_layout.scss` and `_theme.scss`**: These use `$kendo-*` variables as CSS property values — that's correct. Only flag hardcoded literals (`padding: 8px` instead of `padding: $kendo-button-padding-y`).9798#### Real violations (DO flag)99100- **Raw hex colors** in `_variables.scss`: `$kendo-button-bg: #ff6358` → Should use `k-color(primary)`.101- **Raw px/rem in `_variables.scss`** for spacing properties: `$kendo-button-padding-x: 8px` → Should use `k-spacing(2)`.102- **Literal font-family strings**: `font-family: Arial, sans-serif` → Should use `$kendo-font-family`.103- **Raw box-shadow in `_theme.scss`**: `box-shadow: 0 2px 4px rgba(0,0,0,.2)` → Should use `k-elevation()` or `$kendo-*-shadow`.104- **Raw border-radius in `_layout.scss`**: `border-radius: 4px` → Should use `k-border-radius(md)` or `$kendo-*-border-radius`.105- **Hardcoded font-size/line-height/font-weight in `_layout.scss`**: Direct numeric values instead of `$kendo-font-*` variables.106107### Step 4: Present findings108109Report violations grouped by category and severity:110111| Category | Package | File | Line | Value | Suggested Fix |112|----------|---------|------|------|-------|---------------|113| color | default | button/_variables.scss | 160 | `rgba(0, 0, 0, .08)` | Use `color-mix(in srgb, k-color(on-app-surface) 8%, transparent)` |114| spacing | material | chip/_variables.scss | 22 | `8px` | Use `k-spacing(2)` |115| ... | ... | ... | ... | ... | ... |116117### Step 5: Suggest fixes118119For each real violation, propose the correct token usage:120121- **Color**: Replace with `k-color(token-name)` or `color-mix()` with token inputs122- **Spacing**: Replace with `k-spacing(step)` — map px to step using the spacing scale (4px→1, 8px→2, 12px→3, 16px→4, etc.)123- **Typography**: Replace with `$kendo-font-size-*`, `$kendo-line-height-*`, `$kendo-font-weight-*`, or `$kendo-font-family`124- **Elevation**: Replace with `k-elevation(level)` or define a `$kendo-*-shadow` variable125- **Border radius**: Replace with `k-border-radius(key)` or `$kendo-*-border-radius` variable126127Offer to apply the fixes.128129## Gotchas130131- **Core `_variables.scss` files use `null !default`** — they define the token skeleton, not values. Scan theme overrides (default, classic, material, fluent, bootstrap) for actual hardcoded values.132- **Theme `_variables.scss` paths differ**: `packages/{theme}/scss/{component}/` (no `components/` subdirectory), unlike core which uses `packages/core/scss/components/{component}/`.133- **Fluent theme wraps everything in `var()`** — so `var(--kendo-spacing-2, 0.5rem)` is correct even though it contains a rem literal.134- **The spacing scale is non-linear**: 1→0.25rem(4px), 2→0.5rem(8px), 3→0.75rem(12px), 4→1rem(16px). Use `packages/core/scss/spacing/index.scss` as the canonical reference.135- **`color-mix()` syntax**: `color-mix(in srgb, k-color(key) N%, transparent)` is the modern approach — do NOT flag these as violations.136- **Some components intentionally use hardcoded values** for pixel-perfect rendering (e.g., `1px` borders, `2px` focus ring offsets). These are design decisions, not violations.