Design System Subagents
Automated quality checks and Figma sync for your design system.
Automated Design System Health
What are Subagents?
Subagents are specialized AI assistants that automate specific tasks in your design system workflow. Each subagent has a focused purpose and can be invoked via Claude Code CLI.
All subagent specifications are stored in .claude/subagents/ as markdown files. They use Claude Code's built-in tools and require no special Skills or plugins.
Available Subagents
Usage:
claude --subagent component-screenshot-generator --allWhat it does:
- Scans all components in
components/ui/ - Extracts all variants (primary, secondary, disabled, etc.)
- Generates standalone HTML for each variant
- Captures screenshots at 1200x800px
- Saves to
public/screenshots/code/ - Creates manifest file with metadata
Requirements:
npm install -D playwrightUsage:
claude --subagent figma-drift-check --allWhat it does:
- Exports component images from Figma at same size
- Exports Figma component JSON with variables
- Runs pixel-by-pixel visual comparison
- Compares structural properties (spacing, colors, etc.)
- Validates token usage consistency
- Generates diff images and comprehensive report
Requirements:
- Figma API token
- Figma MCP configured
npm install -D pixelmatch pngjs
Usage:
claude --subagent token-sync --compareWhat it does:
- Extracts all Figma variables/collections
- Parses code tokens (Tailwind config, CSS variables)
- Compares with smart unit matching (px vs rem)
- Checks for
@code-valueannotations in Figma - Generates detailed diff report
- Optional auto-sync to update code
Token Categories:
Usage:
claude --subagent dashboard-generatorWhat it does:
- Reads all report JSON files
- Calculates overall health score (0-100%)
- Generates single-file HTML dashboard
- Shows token sync, component drift, doc status
- Provides prioritized recommendations
- Includes trend analysis if historical data exists
Output:
public/design-system-dashboard.htmlUsage:
claude --subagent doc-validator --allWhat it does:
- Scans existing component documentation
- Extracts props, variants from TypeScript
- Compares docs against actual code
- Detects missing props, variants, examples
- Generates update suggestions
- Optional auto-update mode (preserves human content)
Great for CI:
claude --subagent doc-validator --strictFails if docs are out of date
Recommended Workflows
Daily Development
Run before committing changes to maintain visual history and doc quality:
claude --subagent component-screenshot-generator --allclaude --subagent doc-validator --all --auto-updateWeekly Figma Sync
Full health check to catch any drift from designs:
claude --subagent token-sync --compareclaude --subagent figma-drift-check --all --update-figmaclaude --subagent dashboard-generator# Then open: public/design-system-dashboard.htmlCI/CD Pipeline
Prevent regressions by validating on every pull request:
claude --subagent doc-validator --strictclaude --subagent token-sync --compareThree Levels of Verification
Are base design tokens aligned between Figma and code? Colors, spacing, typography, radius.
Are properties and tokens used correctly? Proper spacing, correct color variables, matching layouts.
Does it actually look right? Pixel-perfect comparison between Figma exports and rendered components.
Getting Started
1. Install Dependencies
npm install -D playwright pixelmatch pngjsnpx playwright install2. Configure Figma Access (Optional)
Only needed if you want Figma integration:
export FIGMA_ACCESS_TOKEN="your-token-here"export FIGMA_FILE_ID="your-file-id"3. Try Your First Subagent
Start with doc-validator (easiest, no external dependencies):
claude --subagent doc-validator --component ButtonResources
.claude/subagents/.claude/SETUP_COMPLETE.md