theme-color-token-enforcer
БесплатноБез исполняемых скриптовНе проверенAudit or fix semantic colour token usage in a WordPress block theme. Use when checking a file, folder, or glob for raw colours, direct preset-colour…
от lightspeedwp★ 20 звёзд на GitHubОб этом скилле
Theme Color Token Enforcer
Overview
Audit or remediate colour usage in a WordPress block theme so authored UI files use semantic custom colour tokens instead of direct palette references or raw visual colour values.
Treat:
theme.jsonas the default or light semantic token mappingstyles/dark.jsonas the required dark semantic token mirrorsettings.color.paletteas fixed palette values onlysettings.custom.coloras semantic usage tokens only- In this theme, the dark variation keeps the same preset palette values and changes only the preset references assigned to semantic tokens
Related shared non-colour token families:
settings.custom.animationfor repeated motion values such as duration, delay, easing, and scalesettings.custom.typography.font-weightfor repeated font-weight values such aslight,normal,medium, andsemiboldsettings.custom.z-indexfor repeated stacking layers- When a task also changes typography weight in a normal JSON property value, prefer
var:custom|typography|font-weight|...over raw numeric literals such as300or400 - Inside raw
cssstrings embedded in style JSON, continue using CSS custom property syntax such asvar(--wp--custom--typography--font-weight--...) - These families live in
theme.jsononly unless a task explicitly asks for mode-specific non-colour overrides - Only semantic colour tokens require dark-mode parity by default
Required inputs
- Theme root path
- Target file, directory, or glob
- Mode:
auditorapply - Optional list of approved non-visual exceptions such as masks or compositing helpers
Semantic naming defaults
Approved categories:
textsurfaceborderlinkbuttonformstateiconoverlayfocus
Prefer names such as:
text.defaulttext.inversesurface.canvassurface.cardborder.subtlebutton.primary.backgroundbutton.primary.texticon.backgroundicon.colorform.field.border-focus
Do not use appearance-based names such as button-blue, dark-text, or green-border.
Workflow (sequential)
- Load
theme.json.- Build a registry of
settings.color.paletteslugs and values. - Build a registry of
settings.custom.colortoken paths and preset mappings.
- Build a registry of
- Load
styles/dark.json.- Build the same registry for
settings.custom.color. - Compare token paths against
theme.jsonand flag or fix any parity gaps.
- Build the same registry for
- Scan the target paths in path order for:
var:preset|color|<slug>var(--wp--preset--color--<slug>)- raw
#hex,rgb(),rgba(),hsl(), andhsla()values - existing
var(--wp--custom--color--...)references
- Classify each colour occurrence.
- Ignore palette definitions in
settings.color.palette. - Ignore approved non-visual technical colours only if they do not control visible UI meaning.
- For visual UI usage, determine the semantic role: text, surface, border, link, button, form, state, icon, overlay, or focus.
- Reusable icon wells, icon frames, list-marker glyphs, and icon-only controls should prefer
icon.*tokens instead of borrowinglink.*ortext.*tokens unless the design intent is explicitly link-driven text.
- Ignore palette definitions in
- Reuse an existing semantic token from the same semantic family when one already fits the role and state.
- Check
surface.*before creating a newsurface.*token. - Check
text.*before creating a newtext.*token. - Keep token reuse within the matching semantic family; do not use a surface token for a text role or vice versa.
- Check
- If a proposed new same-family token would point to the same preset as an existing same-family token in the same mode and state, do not create it. Reuse the existing token instead.
- If no suitable token exists:
- Create a new token path in
theme.jsonundersettings.custom.color. - Create the exact same token path in
styles/dark.json. - Map both values only to preset colours.
- Keep names broad-to-specific and mode-stable.
- Create a new token path in
- Build the dark mapping contextually, not mechanically.
- Keep the preset palette itself unchanged in
styles/dark.json; only remap the semantic tokens onto existing preset slugs. - Start by testing whether the role is a direct foreground or surface inversion. If it is, a swap such as light
baseto darkcontrast, lightcontrastto darkbase, or light surface to dark surface is often correct. - For accents, gradients, glows, borders, button fills, and hover states, keep the semantic role and usually keep the same colour family, then move to a nearby palette step that works on the dark surface.
- In this theme, brand-led interactive and icon accents often remap from
brand-*in light mode tocta-*in dark mode. Treat that as a preferred dark-mode pattern when it improves contrast and emphasis. - Review the target background, neighbouring tokens, and interaction states together before choosing the dark value.
- Use li
- Keep the preset palette itself unchanged in
Установить theme-color-token-enforcer в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл theme-color-token-enforcer?
Audit or fix semantic colour token usage in a WordPress block theme. Use when checking a file, folder, or glob for raw colours, direct preset-colour references, missing settings.custom.color tokens, missing styles/dark.json token parity, or WCAG AA contrast issues. Reuse an existing semantic custom colour token where possible; otherwise create matching theme.json and styles/dark.json token paths and replace authored usage with semantic custom colour tokens, while preserving existing shared non-colour token families such as custom typography font-weight variables.
Как установить скилл theme-color-token-enforcer?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл theme-color-token-enforcer запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic