ui-color-palette-generate-semantic-code
Skill1 starsChanged 7 months agoMITView on GitHub
Generate semantic code files alongside primitives by passing a color system configuration to generate_code. Use when the user wants design tokens or code that includes both primitive shades and semantic layer (role/prominence/state mappings). Requires a SystemConfiguration in context or gathered from the user.
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 1 is distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 9
Use the ui-color-palette MCP tool generate_code with a system parameter to produce two output files: a primitives file and a semantics file.
- Distinctive: line 17
Before asking any questions, check the conversation context.
- Very specific: line 33
Ask the user to define the taxonomy first, or route to ui-color-palette-build-color-system.
- Very specific: line 89
Default theme block (:root / $variables / top-level object) uses the default theme's resolved ref.
- Very specific: line 99
Ask for format (and colorSpace if applicable) if not already specified.
- Very specific: line 100
Call generate_code with base, themes, format, colorSpace (if applicable), and system.
- Very specific: line 117
Format recommendations: prefer tailwind-v4 for new web projects, dtcg-tokens for design token interoperability, css for maximum …
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Generate Semantic Code
Use the ui-color-palette MCP tool generate_code with a system parameter to produce two output files: a primitives file and a semantics file.
Building the color system taxonomy is handled by ui-color-palette-build-color-system. Primitive-only code export (no semantic layer) is handled by ui-color-palette-generate-code.
Pre-flight — Check session state
Before asking any questions, check the conversation context.
If GeneratedSemanticCode[format] is already in context
Display it directly without calling generate_code again. Only regenerate if the user changes a parameter or requests a fresh export.
If SystemConfiguration is already in context
Skip Step 0 questions about the system. Use the existing system config.
If base and themes are already in context
Reuse them. Do not call get_palette or get_color_system again.
If neither SystemConfiguration nor system bindings are available
Ask the user to define the taxonomy first, or route to ui-color-palette-build-color-system.
Step 0 — Gather parameters
Required
1. Palette inputs — confirm base and themes are available. If not, recover from context or run ui-color-palette-scale-palette first.
2. System configuration — confirm system (schema + bindings) is available. If not, run ui-color-palette-build-color-system first or ask the user to provide the taxonomy.
3. Format — ask to choose. Default: css.
4. Color space — ask only for formats that use it (css, scss, less, dtcg-tokens). Default: RGB.
Tool — generate_code
| Parameter | Type | Required | Description |
base | object | Yes | Base palette configuration |
themes | array | Yes | Theme configurations |
format | enum | No | Output format (default: css) |
colorSpace | enum | No | Color space for output values (default: RGB) |
system | object | Yes (for semantic) | SystemConfiguration — schema + bindings |
format values and their two output files
| Value | Primitives file | Semantics file | colorSpace used? |
css | primitives.css | semantics.css | Yes |
scss | primitives.scss | semantics.scss | Yes |
less | primitives.less | semantics.less | Yes |
tailwind-v3 | primitives.js | semantics.js | No |
tailwind-v4 | primitives.css | semantics.css | No |
dtcg-tokens | primitives.json | semantics.json | Yes |
style-dictionary-v3 | primitives.json | semantics.json | No |
universal-json | primitives.json | semantics.json | No |
native-tokens | tokens.json (merged) | — | No |
swift-ui | Primitives.swift | SemanticTokens.swift | No |
ui-kit | Primitives.swift | SemanticTokens.swift | No |
compose | Primitives.kt | SemanticTokens.kt | No |
resources | primitives.xml | semantics.xml | No |
csv | primitives.csv | semantics.csv | No |
colorSpace applies only to css, scss, less, and dtcg-tokens. Values: RGB · LCH · OKLCH · LAB · OKLAB · HSL · HSLUV · HSV · CMYK · HEX · P3
Note:
native-tokens(Tokens Studio) merges primitives and semantics into a singletokens.jsonwith multiple sets whensystemis provided.
What the output contains
Primitives file — same as without system: one variable/token per shade (e.g. --blue-500).
Semantics file — one variable/token per bound token path, referencing the primitive:
- Default theme block (
:root/$variables/ top-level object) uses the default theme's resolved ref. - Per-theme override blocks are only emitted when a token's ref differs from the default — excluded tokens are omitted entirely.
Unbound tokens (no binding or ref not found in palette) appear as comments in the semantics file.
Workflow
- Confirm
base,themes, andsystemare available. - Ask for
format(andcolorSpaceif applicable) if not already specified. - Call
generate_codewithbase,themes,format,colorSpace(if applicable), andsystem. - Session state: store result as
GeneratedSemanticCode[format]slot. - Do not read or analyze the returned files. Present each file as-is in its own fenced code block, labelled with the filename. Do not parse, summarize, or reason over the content — the output can be very large.
- Offer to write the files locally or commit via
gh-cli/gitlab-cli-skills.
Arguments
$ARGUMENTS can specify the target format or color space.
/ui-color-palette:generate-semantic-code css oklch/ui-color-palette:generate-semantic-code dtcg-tokens/ui-color-palette:generate-semantic-code tailwind-v4
Tips
- Format recommendations: prefer
tailwind-v4for new web projects,dtcg-tokensfor design token interoperability,cssfor maximum compatibility. - Excluded tokens: tokens with
isExcluded: trueare present inSystemDatabut do not appear in the semantics file output. - Unbound tokens: appear as commented-out hints in the semantics output so the user can see what needs a binding.
- Primitives unchanged: the primitives file is identical whether
systemis provided or not — the semantic layer is purely additive.
Recommended subagents
uicper— orchestrates the full source → palette → system → deploy workflowpalette-codegen— normalized multi-format token and code export agentgh-cli— commit and open a PR on GitHubgitlab-cli-skills— commit and open an MR on GitLab
In this repository52 other files it gives its agents.
- gh-cliSkill
- glab-aliasSkill
- glab-apiSkill
- glab-attestationSkill
- glab-authSkill
- glab-changelogSkill
- glab-check-updateSkill
- glab-ciSkill
- glab-clusterSkill
- glab-completionSkill
- glab-configSkill
- glab-deploy-keySkill
- glab-duoSkill
- glab-gpg-keySkill
- glab-helpSkill
- glab-incidentSkill
- glab-issueSkill
- glab-iterationSkill
- glab-jobSkill
- glab-labelSkill
- glab-mcpSkill
- glab-milestoneSkill
- glab-mrSkill
- glab-opentofuSkill
- glab-quick-actionsSkill
- glab-releaseSkill
- glab-repoSkill
- glab-runner-controllerSkill
- glab-runnerSkill
- glab-scheduleSkill
- glab-securefileSkill
- glab-snippetSkill
- glab-ssh-keySkill
- glab-stackSkill
- glab-todoSkill
- glab-tokenSkill
- glab-userSkill
- glab-variableSkill
- glab-versionSkill
- glab-workitemsSkill
- gitlab-cli-skillsSkill
- ui-color-palette-audit-paletteSkill
- ui-color-palette-build-color-systemSkill
- ui-color-palette-figmaSkill
- ui-color-palette-framerSkill
- ui-color-palette-generate-codeSkill
- ui-color-palette-generate-source-colorsSkill
- ui-color-palette-helpSkill
- ui-color-palette-manage-palettesSkill
- ui-color-palette-penpotSkill
- ui-color-palette-scale-paletteSkill
- ui-color-palette-sketchSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

