Design System Schema
When to use this skill
Use this skill when you need to:
- Define design token dimension schemas and taxonomies
- Organize token categories (primitives, semantic, component-specific)
- Create value scales for colors, spacing, typography, and other properties
- Map dimensions to specific components
- Establish relationships between token dimensions
- Structure token metadata including types and scopes
Schema structure
Dimension categories
Design tokens are organized into three main categories:
1. Primitives
Raw, foundational values that form the basis of the design system:
- Colors: Base color palettes with numeric scales
- Spacing: Numerical spacing values in consistent increments
- Typography: Font sizes, weights, families
- Radius: Border radius values
- Opacity: Transparency levels
- Motion: Animation duration and easing
2. Semantic
Purpose-driven tokens that reference primitives:
- Intent/Variant: primary, secondary, success, warning, danger
- State: default, hover, active, disabled, focus
- Theme: light, dark, high-contrast
- Role: surface, text, border, background
- Emphasis: subtle, default, strong, inverse
3. Component-specific
Tokens tailored for specific UI components:
- Size: xs, sm, md, lg, xl (contextual sizing)
- Content: text, icon, text-icon combinations
- Hierarchy: primary, secondary, tertiary priorities
- Density: compact, comfortable, spacious layouts
Dimension structure
Each dimension follows this structure:
{
id: 'dimension-name', // Unique identifier
label: 'Display Name', // Human-readable label
column: 1, // UI organization column (1-3)
enabled: true, // Whether dimension is active
categories: ['semantic'], // Which categories include this dimension
values: ['value1', 'value2'] // Available values for this dimension
}
Property values with metadata
Property dimensions include Figma variable metadata:
{
name: 'background-color',
type: 'COLOR', // Figma variable type
scopes: ['FRAME_FILL', 'SHAPE_FILL'] // Figma scopes
}
Common dimension patterns
Color scales (primitives)
{
id: 'colors',
label: 'Colors',
categories: ['primitives'],
values: ['red', 'green', 'blue', 'neutral', 'purple']
}
Combined with scale values:
{
id: 'scale',
label: 'Scale',
categories: ['primitives'],
values: ['50', '100', '200', '300', '400', '500', '600', '700', '800', '900']
}
Generates: red/500, neutral/100, blue/800
Spacing scales (primitives)
{
id: 'spacing',
label: 'Spacing',
categories: ['primitives'],
values: ['0', '4', '8', '12', '16', '24', '32', '48', '64', '80', '96']
}
Generates: spacing/8, spacing/16, spacing/32
Semantic tokens
{
id: 'variant',
label: 'Intent',
categories: ['semantic'],
values: ['primary', 'secondary', 'success', 'warning', 'danger']
},
{
id: 'state',
label: 'State',
categories: ['semantic'],
values: ['default', 'hover', 'active', 'disabled', 'focus']
}
Generates: primary/default, success/hover, warning/disabled
Component-specific dimensions
{
id: 'size',
label: 'Size',
categories: ['component-specific'],
values: ['xs', 'sm', 'md', 'lg', 'xl']
},
{
id: 'content',
label: 'Content',
categories: ['component-specific'],
values: ['text', 'icon', 'icon-text']
}
Property definitions
Properties define the CSS attributes and their Figma mappings:
Color properties
{ name: 'background-color', type: 'COLOR', scopes: ['FRAME_FILL', 'SHAPE_FILL'] },
{ name: 'text-color', type: 'COLOR', scopes: ['TEXT_FILL'] },
{ name: 'border-color', type: 'COLOR', scopes: ['STROKE_COLOR'] }
Sizing properties
{ name: 'width', type: 'FLOAT', scopes: ['WIDTH_HEIGHT'] },
{ name: 'height', type: 'FLOAT', scopes: ['WIDTH_HEIGHT'] },
{ name: 'border-radius', type: 'FLOAT', scopes: ['CORNER_RADIUS'] }
Typography properties
{ name: 'font-family', type: 'STRING', scopes: ['FONT_FAMILY'] },
{ name: 'font-size', type: 'FLOAT', scopes: ['FONT_SIZE'] },
{ name: 'font-weight', type: 'FLOAT', scopes: ['FONT_WEIGHT'] }
Component mappings
Define which dimensions apply to specific components:
components: {
button: {
label: 'Button',
dimensions: ['variant', 'state', 'size', 'content', 'property']
},
card: {
label: 'Card',
dimensions: ['elevation', 'theme', 'size', 'property']
},
input: {
label: 'Input',
dimensions: ['state', 'size', 'validation', 'property']
}
}
Value organization patterns
Numerical progressions
- Linear: 4, 8, 12, 16, 20, 24 (consistent increments)
- Exponential: 2, 4, 8, 16, 32, 64 (powers of 2)
- Tailwind-style: 0, 1, 2, 4, 6, 8, 12, 16, 20, 24
Scale-based systems
- T-shirt sizes: xs, sm, md, lg, xl, xxl
- Numeric scales: 100, 200, 300, 400, 500, 600, 700, 800, 900
- Named scales: none, subtle, default, strong, max
State progressions
- Interaction: default, hover, active, disabled
- Validation: default, success, warning, error
- Emphasis: muted, default, strong, inverse
Schema validation
Ensure your schema follows these patterns:
Required fields
id: Unique, kebab-case identifier
label: Human-readable display name
categories: Array of category membership
values: Array of possible values
Naming conventions
- Dimension IDs: kebab-case (variant, state, background-color)
- Value names: lowercase with hyphens (primary, light-blue, extra-large)
- Categories: hyphenated (component-specific, design-system)
Relationships
- Property dimensions should include type/scope metadata
- Component mappings should reference existing dimension IDs
- Categories should align with design system taxonomy
Examples
See references/buttonSchema.js for a comprehensive schema example covering:
- 30+ predefined dimensions
- All three category types
- Complete property definitions with Figma metadata
- Component dimension mappings
1---2name: design-system-schema3description: Defines comprehensive schemas for design token dimensions, value scales, and component mappings. Use when building design system taxonomies, organizing token categories, or establishing token dimension relationships and hierarchies.4---5
6# Design System Schema
7
8## When to use this skill
9
10Use this skill when you need to:
11- Define design token dimension schemas and taxonomies
12- Organize token categories (primitives, semantic, component-specific)
13- Create value scales for colors, spacing, typography, and other properties
14- Map dimensions to specific components
15- Establish relationships between token dimensions
16- Structure token metadata including types and scopes
17
18## Schema structure
19
20### Dimension categories
21
22Design tokens are organized into three main categories:
23
24#### 1. Primitives
25Raw, foundational values that form the basis of the design system:
26- **Colors**: Base color palettes with numeric scales
27- **Spacing**: Numerical spacing values in consistent increments
28- **Typography**: Font sizes, weights, families
29- **Radius**: Border radius values
30- **Opacity**: Transparency levels
31- **Motion**: Animation duration and easing
32
33#### 2. Semantic
34Purpose-driven tokens that reference primitives:
35- **Intent/Variant**: primary, secondary, success, warning, danger
36- **State**: default, hover, active, disabled, focus
37- **Theme**: light, dark, high-contrast
38- **Role**: surface, text, border, background
39- **Emphasis**: subtle, default, strong, inverse
40
41#### 3. Component-specific
42Tokens tailored for specific UI components:
43- **Size**: xs, sm, md, lg, xl (contextual sizing)
44- **Content**: text, icon, text-icon combinations
45- **Hierarchy**: primary, secondary, tertiary priorities
46- **Density**: compact, comfortable, spacious layouts
47
48### Dimension structure
49
50Each dimension follows this structure:
51```javascript
52{
53 id: 'dimension-name', // Unique identifier
54 label: 'Display Name', // Human-readable label
55 column: 1, // UI organization column (1-3)
56 enabled: true, // Whether dimension is active
57 categories: ['semantic'], // Which categories include this dimension
58 values: ['value1', 'value2'] // Available values for this dimension
59}
60```
61
62### Property values with metadata
63
64Property dimensions include Figma variable metadata:
65```javascript
66{
67 name: 'background-color',
68 type: 'COLOR', // Figma variable type
69 scopes: ['FRAME_FILL', 'SHAPE_FILL'] // Figma scopes
70}
71```
72
73## Common dimension patterns
74
75### Color scales (primitives)
76```javascript
77{
78 id: 'colors',
79 label: 'Colors',
80 categories: ['primitives'],
81 values: ['red', 'green', 'blue', 'neutral', 'purple']
82}
83```
84
85Combined with scale values:
86```javascript
87{
88 id: 'scale',
89 label: 'Scale',
90 categories: ['primitives'],
91 values: ['50', '100', '200', '300', '400', '500', '600', '700', '800', '900']
92}
93```
94
95Generates: `red/500`, `neutral/100`, `blue/800`
96
97### Spacing scales (primitives)
98```javascript
99{
100 id: 'spacing',
101 label: 'Spacing',
102 categories: ['primitives'],
103 values: ['0', '4', '8', '12', '16', '24', '32', '48', '64', '80', '96']
104}
105```
106
107Generates: `spacing/8`, `spacing/16`, `spacing/32`
108
109### Semantic tokens
110```javascript
111{
112 id: 'variant',
113 label: 'Intent',
114 categories: ['semantic'],
115 values: ['primary', 'secondary', 'success', 'warning', 'danger']
116},
117{
118 id: 'state',
119 label: 'State',
120 categories: ['semantic'],
121 values: ['default', 'hover', 'active', 'disabled', 'focus']
122}
123```
124
125Generates: `primary/default`, `success/hover`, `warning/disabled`
126
127### Component-specific dimensions
128```javascript
129{
130 id: 'size',
131 label: 'Size',
132 categories: ['component-specific'],
133 values: ['xs', 'sm', 'md', 'lg', 'xl']
134},
135{
136 id: 'content',
137 label: 'Content',
138 categories: ['component-specific'],
139 values: ['text', 'icon', 'icon-text']
140}
141```
142
143## Property definitions
144
145Properties define the CSS attributes and their Figma mappings:
146
147### Color properties
148```javascript
149{ name: 'background-color', type: 'COLOR', scopes: ['FRAME_FILL', 'SHAPE_FILL'] },
150{ name: 'text-color', type: 'COLOR', scopes: ['TEXT_FILL'] },
151{ name: 'border-color', type: 'COLOR', scopes: ['STROKE_COLOR'] }
152```
153
154### Sizing properties
155```javascript
156{ name: 'width', type: 'FLOAT', scopes: ['WIDTH_HEIGHT'] },
157{ name: 'height', type: 'FLOAT', scopes: ['WIDTH_HEIGHT'] },
158{ name: 'border-radius', type: 'FLOAT', scopes: ['CORNER_RADIUS'] }
159```
160
161### Typography properties
162```javascript
163{ name: 'font-family', type: 'STRING', scopes: ['FONT_FAMILY'] },
164{ name: 'font-size', type: 'FLOAT', scopes: ['FONT_SIZE'] },
165{ name: 'font-weight', type: 'FLOAT', scopes: ['FONT_WEIGHT'] }
166```
167
168## Component mappings
169
170Define which dimensions apply to specific components:
171
172```javascript
173components: {
174 button: {
175 label: 'Button',
176 dimensions: ['variant', 'state', 'size', 'content', 'property']
177 },
178 card: {
179 label: 'Card',
180 dimensions: ['elevation', 'theme', 'size', 'property']
181 },
182 input: {
183 label: 'Input',
184 dimensions: ['state', 'size', 'validation', 'property']
185 }
186}
187```
188
189## Value organization patterns
190
191### Numerical progressions
192- **Linear**: 4, 8, 12, 16, 20, 24 (consistent increments)
193- **Exponential**: 2, 4, 8, 16, 32, 64 (powers of 2)
194- **Tailwind-style**: 0, 1, 2, 4, 6, 8, 12, 16, 20, 24
195
196### Scale-based systems
197- **T-shirt sizes**: xs, sm, md, lg, xl, xxl
198- **Numeric scales**: 100, 200, 300, 400, 500, 600, 700, 800, 900
199- **Named scales**: none, subtle, default, strong, max
200
201### State progressions
202- **Interaction**: default, hover, active, disabled
203- **Validation**: default, success, warning, error
204- **Emphasis**: muted, default, strong, inverse
205
206## Schema validation
207
208Ensure your schema follows these patterns:
209
210### Required fields
211- `id`: Unique, kebab-case identifier
212- `label`: Human-readable display name
213- `categories`: Array of category membership
214- `values`: Array of possible values
215
216### Naming conventions
217- Dimension IDs: kebab-case (variant, state, background-color)
218- Value names: lowercase with hyphens (primary, light-blue, extra-large)
219- Categories: hyphenated (component-specific, design-system)
220
221### Relationships
222- Property dimensions should include type/scope metadata
223- Component mappings should reference existing dimension IDs
224- Categories should align with design system taxonomy
225
226## Examples
227
228See [references/buttonSchema.js](references/buttonSchema.js) for a comprehensive schema example covering:
229- 30+ predefined dimensions
230- All three category types
231- Complete property definitions with Figma metadata
232- Component dimension mappings