design-engineer:extract
Extract design patterns from existing code to create a system.md file.
design-engineer extract
Extract design patterns from existing code to create a system.
Usage
/extract # Extract from common UI paths
/extract <path> # Extract from specific directory
What to Extract
Scan UI files (tsx, jsx, vue, svelte) for:
-
Repeated spacing values
Found: 4px (12x), 8px (23x), 12px (18x), 16px (31x), 24px (8x) → Suggests: Base 4px, Scale: 4, 8, 12, 16, 24 -
Repeated radius values
Found: 6px (28x), 8px (5x) → Suggests: Radius scale: 6px, 8px -
Button patterns
Found 8 buttons: - Height: 36px (7/8), 40px (1/8) - Padding: 12px 16px (6/8), 16px (2/8) → Suggests: Button pattern: 36px h, 12px 16px padding -
Card patterns
Found 12 cards: - Border: 1px solid (10/12), none (2/12) - Padding: 16px (9/12), 20px (3/12) → Suggests: Card pattern: 1px border, 16px padding -
Depth strategy
box-shadow found: 2x border found: 34x → Suggests: Borders-only depth
Then prompt:
Extracted patterns:
Spacing:
Base: 4px
Scale: 4, 8, 12, 16, 24, 32
Depth: Borders-only (34 borders, 2 shadows)
Patterns:
Button: 36px h, 12px 16px pad, 6px radius
Card: 1px border, 16px pad
Create .design-engineer/system.md with these? (y/n/customize)
Implementation
- Glob for UI files
- Parse for repeated values
- Identify common patterns
- Suggest system based on frequency
- Offer to create system.md
- Let user customize before saving