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
Request Shapes
Use $theme-color-token-enforcer when the user asks for workflows like these:
- "Audit this block theme for raw colours and direct preset references in
patterns/**/*.phpandstyles/**/*.json." - "Apply semantic custom colour tokens across this theme and add any missing
styles/dark.jsonmirrors." - "Check whether our button, icon, and border tokens have dark-mode parity and AA-safe contrast."
Success looks like:
- every visual authored colour usage is classified correctly
- existing semantic colour tokens are reused when they already fit
- new semantic colour tokens are created only when necessary, in both
theme.jsonandstyles/dark.json - authored UI usage is rewritten to semantic custom colour token references in
applymode - unresolved contrast or parity gaps are surfaced clearly instead of being hidden with invented raw colours
Required Inputs
Collect or confirm:
- theme root path
- target file, directory, or glob
- mode:
auditorapply - optional list of approved non-visual exceptions such as masks or compositing helpers
If any required input is missing, ask only for the missing item before proceeding.
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
Follow this sequence in order.
- 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.
- Kee
- Create a new token path 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