Skip to content

Commit 18b4917

Browse files
committed
Add update-tokens skill
1 parent 2b861a4 commit 18b4917

1 file changed

Lines changed: 136 additions & 0 deletions

File tree

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
---
2+
name: update-tokens
3+
description: Safely edit Mistica token JSON files when the user requests new tokens, changes, or new brands.
4+
---
5+
6+
# Token Editor
7+
8+
This skill is used to modify Mistica design token JSON files in a controlled and consistent way.
9+
10+
---
11+
12+
## When to use
13+
14+
Use this skill **only** when the user explicitly requests:
15+
16+
- Adding a new token
17+
- Editing an existing token
18+
- Creating a new brand / skin
19+
- Modifying token values or descriptions
20+
21+
Do not use this skill for:
22+
23+
- UI implementation
24+
- Token usage in application code
25+
- Guessing, proposing, or inventing new tokens without explicit request
26+
27+
### Execution flow
28+
29+
When this skill is invoked, follow this order strictly:
30+
31+
1. Identify the exact user request (token name, type, brand)
32+
2. Locate the affected files:
33+
- Brand file(s)
34+
- Schema file (if adding tokens)
35+
- contrastPairs.js (if color tokens affect contrast)
36+
3. Apply the minimal required change
37+
4. Validate structure consistency across brands
38+
5. Update schema and linter only if impacted
39+
6. Summarize the changes made
40+
41+
---
42+
43+
## Token file structure
44+
45+
- Tokens live in the `tokens/` directory
46+
- Brand files are named: `<brand>.json`
47+
- Schema file: `tokens/schema/skin-schema.json`
48+
- Linter contrast pairs live in `tokens/linter/contrastPairs.js`
49+
50+
Each brand file must define **the same token structure**:
51+
52+
- `light`
53+
- `dark`
54+
- `radius`
55+
- `text`
56+
- `spacing`
57+
- `themeVariant`
58+
- `componentProperties`
59+
60+
May differ between brands:
61+
62+
- Token values
63+
- `global.palette` definitions
64+
65+
Token **keys and structure must always match across brands**.
66+
67+
---
68+
69+
## Editing rules (mandatory)
70+
71+
### General
72+
73+
- Never invent tokens not requested by the user
74+
- Never remove existing tokens unless explicitly requested
75+
- Keep JSON formatting consistent with existing files
76+
- Apply **minimal diffs**: change only what is required
77+
- Do not reorder unrelated tokens
78+
- All token values should follow the structure enforced in `tokens/schema/skin-schema.json`
79+
80+
---
81+
82+
## Adding or editing tokens
83+
84+
### Color tokens
85+
86+
- Must exist in **both** `light` and `dark`
87+
- Values must reference `global.palette`, if the have alpha `rgba({global.palette}, alphaValue)`
88+
- Token `description` must exactly match the palette reference
89+
- Do not use raw hex, rgb, or rgba values
90+
- Insert new tokens after the closest existing token name (alphabetical proximity)
91+
92+
---
93+
94+
### Text tokens
95+
96+
- A new `text.size` token **must** also define `text.lineHeight`
97+
- All `text.size` and `text.lineHeight` values must include:
98+
- `mobile`
99+
- `desktop`
100+
- `text.weight` values are restricted to:
101+
- `light`
102+
- `regular`
103+
- `medium`
104+
- `bold`
105+
106+
Do not introduce new text properties.
107+
108+
---
109+
110+
### Spacing tokens
111+
112+
- All `spacing` tokens must define values for:
113+
- `top`
114+
- `right`
115+
- `bottom`
116+
- `left`
117+
118+
---
119+
120+
## Schema updates
121+
122+
- The schema file **must** be updated when new tokens are added
123+
- Schema structure must exactly match the brand token structure
124+
- New `global.palette` tokens must be added per brand and included under the corresponding pattern in `definitions/constantProperties/patternProperties`
125+
- Do not modify schema entries unrelated to the change
126+
127+
---
128+
129+
## Linter contrastPairs updates
130+
131+
- Update existent or create a new contrast pair if needed
132+
133+
Do not update contrast pairs for:
134+
135+
- Media-specific tokens
136+
- Tokens using alpha

0 commit comments

Comments
 (0)