educlopez/ui-craft-codex-tokens
Audit or establish the project's 3-layer token spine. Invoke when the user asks for tokens on their UI, or mentions 'tokens' alongside design / UI / frontend work.
This is a copy. The original lives at educlopez/tokens.
npx skills add https://github.com/educlopez/ui-craft --skill tokens
<!-- HARNESS MIRROR — do not edit here. Canonical source: skills/ or commands/. After editing source, copy into cli/assets/<harness>/ and repo-root harness mirrors. -->
Context: this sub-skill is one lens of the broader ui-craft skill. If the ui-craft skill is also installed, read its SKILL.md first for Discovery + Anti-Slop + Craft Test, then apply the specific lens below.
Read references/tokens.md before proceeding. The 3-layer contract (primitive → semantic → component) and the intentional-dark test are defined there.
Scan for token definitions in the project:
:root, [data-theme], [data-mode], or theme wrapper selectorstailwind.config.js/ts) under theme.extend or themetheme.ts, *.styles.ts, styled.d.ts, ThemeProvider)design-tokens.json or tokens.json (Style Dictionary / Theo)globals.css, variables.css, tokens.cssBuild an inventory: which of the 7 categories exist (color / spacing / type / radii / shadows / motion / z-index), which layers are present (primitive / semantic / component), and whether both light and dark are defined.
$ARGUMENTS and inventoryEvaluate against the contract in references/tokens.md. Output a severity-ranked gap list — don't propose code yet.
Check:
--text-primary? Is --surface-canvas a tinted near-black (not #000)? Is accent chroma reduced 10-15%? Are shadows replaced with border rings?--gray-500) not roles (--button-bg)? Are semantics named for roles (--text-primary) not values (--gray-900-text)?Output format:
| Severity | Category | Finding |
|---|---|---|
| Critical | Dark mode | --surface-canvas is #000 — runs the intentional-dark test |
| High | Semantics | No surface stack — components use raw primitives |
| Medium | Shadows | Single-layer shadows — ambient layer missing |
| Low | Z-index | Arbitrary values (z-index: 999) in 3 components |
Show what's missing. Do not propose code during audit unless the user asks.
Load skills/ui-craft/references/loops.md preset token-consistency (budget = the default loop budget defined in loops.md). Emit the pre-flight cost notice. After fixing the top off-system value (raw hex color, arbitrary radius, or magic spacing), re-scan until zero off-system values or budget exhausted.
Propose a minimal spine inline. Cover all 7 categories. Always include both light and dark blocks — both intentional.
Minimal spine order:
Use OKLCH for color unless the project uses sRGB across the board — in that case flag the gap, propose OKLCH, but don't auto-convert.
Before writing to a file, ask which file to write to. Detect from project structure and suggest one:
globals.css (CSS variables inside :root)theme.ts (exported theme object)tokens.css (standalone variables file)design-tokens.json (Style Dictionary format)Confirm with the user before writing.
If the project has an existing token file, propose additions as patches — show what would change in a diff block:
:root {
+ /* ── Semantic surface stack (new) ── */
+ --surface-canvas: var(--gray-50);
+ --surface-raised: var(--gray-100);
+ --surface-overlay: #fff;
+ --surface-sunken: var(--gray-200);
+ --surface-inverse: var(--gray-900);
}
Let the user apply. Don't write directly unless they approve.
--color-primary over --accent-500, extend that pattern rather than introducing a parallel naming scheme.Next step: /craft — build on the spine you just established (rung 1).
Take educlopez/ui-craft-codex-tokens from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.