- Home
- Skills
- Wesleysmits
- Agent Skills
- Design Token Validator
design-token-validator_skill
2
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill wesleysmits/agent-skills --skill design-token-validator- SKILL.md8.0 KB
Overview
This skill validates that CSS and component code use approved design tokens instead of hardcoded values. It scans token source files and project files, reports violations by severity, and suggests token replacements or automated fixes. Use it to enforce a consistent design system and reduce visual drift and design debt.
How this skill works
The validator first locates token definitions (CSS variables, tokens.json, or JS/TS token objects) and extracts available token names. It then scans target files (CSS/SCSS, JSX/TSX, Vue) for hardcoded colors, spacing, inline styles, Tailwind arbitrary values, and other magic numbers. Each finding is categorized by severity and matched to the closest token using a mapping; the tool can generate suggested fixes or patch examples.
When to use it
- Enforcing design token usage across a codebase
- Auditing for hardcoded colors, spacing, or typography values
- Preparing a codebase for a design-system migration
- Blocking new design-debt in CI or pre-commit checks
- Finding inline styles or Tailwind arbitrary values that bypass tokens
Best practices
- Identify and point the tool at the canonical token file before scanning
- Maintain a token-to-value mapping to enable deterministic suggestions
- Run scans in CI and fail builds on 'Error' severity violations
- Use Stylelint/ESLint rules to prevent regressions after fixes
- Treat gradients, calc() and complex values as manual-review items
Example use cases
- Scan src/ for hardcoded hex or rgb colors and replace with var(--color-*) tokens
- Detect px spacing in components and suggest corresponding --spacing-* tokens
- Find inline React styles and recommend moving values to CSS modules with tokens
- Report Tailwind arbitrary values and map them to theme classes or CSS variables
- Create a summary report for a pull request listing violations and auto-fixable items
FAQ
I'll ask you to specify the token source location. Scans require a token list to match suggestions.
Can this auto-fix every violation?
Many simple replacements (colors, spacing, radii) are auto-fixable. Complex values, gradients, and contextual styles typically need manual review.
How are severity levels determined?
Errors are hardcoded colors and layout spacing; warnings are inline styles and magic numbers; info is for one-off values that may be intentional.