/skill-madness:design-token-guardfrom skill-madness
Source-level gate that detects inline styles and hardcoded colors bypassing design tokens. Auto-discovers token systems and can scaffold ESLint rules and pre-commit hooks for enforcement.
Ships in skill-madness. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
A hardcoded color renders identically to the token it should have used.
style={{ background: "#07090c" }} and style={{ background: "var(--tl-tooltip)" }}
produce the same pixels. So every render-level gate — visual review, e2e,
screenshots, "console is clean" — passes a component that has silently bypassed
the design system. The violation only exists in source.
That is why inline styles and hardcoded CSS accumulate invisibly until someone eyeballs the code weeks later and burns hours on a token refactor. The fix is a source-level gate: a deterministic check that reads the diff for styling that bypasses the token system, run before the code is declared done, and wired into the repo so it can't regress.
This skill is that gate. It does two things:
scripts/check_design_tokens.py) to find
every inline style and hardcoded color, each mapped to the exact token to use.lint:tokens script) so the gate runs on every commit/CI,
not just when an agent remembers to look.It is dynamic: it auto-discovers whatever token system the project already uses and derives the rules from it. TruthLens and a vanilla Vue app are two configs of one skill, not two skills.
The bundled checker is the authority, but the gate is the source scan, not the script binary. Degrade instead of declining — never report a clean pass you did not observe:
scripts/check_design_tokens.py as in
Step 1. A crash, a missing path, or a blocked inspection (exit 2) is never a
clean pass.#[0-9a-fA-F]{3,8},
rgb(, rgba(, hsl(, hsla( — in style contexts (style={{…}},
style="…", :style, [style], SVG fill/stroke, Tailwind arbitrary
[#…]), and compare each literal against the tokens you can read from the
token source. Report each finding as file:line with the exact token it should
use, the same shape the checker emits. Mark coverage partial where a file was
unreadable.BLOCKED is not a pass. Whether the checker ran or you hand-scanned, any check
you could not perform is reported BLOCKED with its reason, and an unrun gate is
an uncleared gate — not a clean build.
Run the checker from the project root. It needs no flags for a first pass:
python3 <skill-dir>/scripts/check_design_tokens.py --root .
What it does automatically:
Discovers the token source — scans for CSS custom properties
(--name: …), SCSS/Less vars ($name, @name), JS/TS theme objects, or
design-token JSON. From those it builds a color-value → token map.
Scans the source tree (.tsx/.ts/.jsx/.js/.vue/.svelte/.astro/.html),
skipping node_modules, build dirs, config files, and the token files
themselves.
Reports each finding as file:line:col, the offending snippet, and — when
the literal matches a declared token — the exact fix:
no-hardcoded-color (error) — 2
src/components/schedule/EventBar.tsx:69:17
fill="#0E1116"
→ hardcoded color #0E1116 is var(--tl-bg-0) · use var(--tl-bg-0)
Useful flags:
--staged — only git-staged files (this is what the pre-commit hook uses).--json — machine-readable output for a gate/CI to parse ({ ok, summary, findings }).PATHS… — limit to specific files/dirs (e.g. just the component you changed).--config <path> — explicit config location.Exit code is 2 when inspection/configuration fails, 1 when there are error-severity findings, 0 when clean — so
it drops straight into a gate or CI step.
Two outcomes per color finding, and they need different fixes — don't blur them:
var(--token)" — the literal duplicates an existing token. Replace
it with the token reference. Mechanical and safe.For no-inline-style findings, move the value into a token or a utility class.
Inline styles whose values are all dynamic (var(--…), JS expressions) are
allowed by default — the rule fires on hardcoded literals, not on the
mechanism. Use "inlineStyleMode": "strict" only if the project bans inline
style attributes outright.
Frontend-agent and madness invoke this path on solo and native UI builds. Resolve the actual skill roots from installed resources; do not assume Claude home. The bootstrap bundles both existing guards and a small shared-layout checker, not a new orchestration framework. Preview first; obtain project setup consent before --apply:
python3 <design-guard-root>/scripts/bootstrap_frontend_guards.py --root <project> \
--class-guard-dir <class-extraction-guard-root>
# After scoped approval:
python3 <design-guard-root>/scripts/bootstrap_frontend_guards.py --root <project> \
--class-guard-dir <class-extraction-guard-root> --apply
python3 <project>/scripts/frontend-guards/run.py
This creates layout ERROR policy, error-level utility/CSS duplication policy, a full-source runner, CI, and an inactive hook snippet. Merge the runner into existing Husky/lefthook/pre-commit after approval; optional --wire-precommit --apply creates a plain project-local hook only when no hook/manager/path override exists. Worktrees must use their existing hook setup; no global settings or hooksPath are changed. Conflicting files block before writes; never overwrite user config. Missing sibling resources fail closed. Repeated apply keeps identical files unchanged.
The bundle checks authored source, not generated output (build directories are ignored). Add project-specific generated paths deliberately. Visible two-width rendering, project typecheck/tests and independent review are separate proofs. Setup declined or unavailable means enforcement BLOCKED, not a guarded success.
A one-time audit doesn't stop regression. Wire the gate into the repo so it runs
without anyone remembering. Read references/scaffolding.md for the full
procedure; the short version:
.design-guard.json at the repo root (template:
assets/design-guard.config.json). Set tokenSources explicitly so
discovery is deterministic in CI, and turn on any project-specific rules.scripts/check_design_tokens.py into
the project's scripts/, or reference the skill path. Add a script:
"lint:tokens": "python3 scripts/check_design_tokens.py --root .".assets/pre-commit (runs --staged, blocks the
commit on error-severity findings). Wire via Husky/lefthook if present, else a
plain .git/hooks/pre-commit.assets/eslint-tokens.snippet.mjs into
the repo's flat config (create eslint.config.mjs if absent). ESLint gives
in-editor squiggles for the patterns it expresses well (inline-style literals,
forbidden radius/partisan-color classes). The Python checker stays the
authority — it's the only layer that can do the value → token mapping, so
pre-commit/CI run that, and ESLint is fast feedback, not the source of truth.lint:tokens step to the pipeline (assets/ci-step.yml shows a
GitHub Actions example).Tell the user which layers you installed and which you skipped (e.g. "no Husky here, used a raw git hook").
--profile layout enforces no-inline-style: error while preserving explicit CSS custom-property-only inputs such as style="--progress: 72%" or style={{'--progress': progress}}. Ordinary inline properties, including token-backed layout, bound/opaque objects and spreads, must move to stylesheets or be manually refactored; a token value does not fix cascade precedence. The legacy literal/warn default remains for existing adopters; it now recognizes unquoted HTML CSS dimensions separately from quoted JSX values. summary.files/files_scanned count inspected source files; files_with_findings is distinct. Git enumeration, unreadable source/config and missing explicit paths return blocked status, never clean success. These are conservative source patterns, not a complete framework compiler.
Two universal rules, on by default (these are the "no inline CSS" core):
| rule | catches | default |
|---|---|---|
no-hardcoded-color | #hex, rgb()/rgba(), hsl()/hsla() literals anywhere a token belongs — inline styles, SVG fill/stroke, JS color strings, Tailwind arbitrary [#…] | error |
no-inline-style | style={{…}} / style="…" / :style / [style] carrying hardcoded literals (React/Vue/Svelte/Angular/HTML) | warn |
A project-specific library, off by default — opt in via config when a repo has these conventions:
| rule | catches |
|---|---|
no-class-in-svg | utility/Tailwind classes on <svg> primitives (rect, path, g, …) where styling should be token attributes |
restricted-radius | border-radius above maxRadiusPx, or rounded-{md,lg,xl,…} classes |
forbidden-colors | configured regexes — banned second accent, partisan red/blue, etc. |
no-arbitrary-tailwind | Tailwind arbitrary values — text-[10px], max-w-[1100px], leading-[1.75] — that bypass the spacing/type scale. Arbitrary colors (border-[rgba(…)]) are already caught by no-hardcoded-color, so this rule skips them. *-[var(--token)] is allowed. |
Each rule's severity is "error" | "warn" | "off". Errors fail the gate
(exit 1); warnings report but pass. Full config reference and per-rule notes:
references/config.md.
When a frontend build runs under an orchestrator or agent team, this is a hard source-level wave-gate, complementary to the render-level gates (render-sanity, ux-review) — those check pixels, this checks source, and a build needs both:
--json scans are extra diagnostics,
never a substitute for cross-file CSS/chrome checks.See references/wiring-into-orchestrator.md for the exact gate snippet and how
this plugs into the orchestrator's Definition of Done.
references/config.md — full .design-guard.json schema, every field, per-rule notes, and adapting to non-CSS-variable token systems (SCSS, JS theme, Style Dictionary).references/scaffolding.md — step-by-step repo enforcement: config, hook, ESLint, CI, with the Husky/lefthook/raw-hook decision.references/wiring-into-orchestrator.md — the agent self-check + orchestrator wave-gate snippets, and the Definition-of-Done line this closes.assets/ci-step.yml (opens in a new tab)assets/design-guard.config.json (opens in a new tab)assets/eslint-tokens.snippet.mjs (opens in a new tab)assets/pre-commit (opens in a new tab)references/config.md (opens in a new tab)references/scaffolding.md (opens in a new tab)references/wiring-into-orchestrator.md (opens in a new tab)scripts/bootstrap_frontend_guards.py (opens in a new tab)scripts/check_design_tokens.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
87 skills in this plugin
/accessibility-auditAudit and fix web accessibility against WCAG 2.2 AA, Section 508 and the ADA: axe scan, keyboard, screen-reader and zoom checks, plain-language content and PDFs, source fixes, and an honest conformance report (ACR/VPAT draft). Use for any a11y review, fix or compliance question. Trigger on "accessibility audit", "is this ADA compliant", "Section 508", "WCAG", "VPAT", "a11y"./andonRun work through a live Andon board (the kanban that dispatches cards to Claude Code, Codex and Gemini on your machines): push a plan's cards with the skills each run must load, read the board, answer what needs you, administer a machine, and refresh this skill when Andon changes. Trigger on "/andon", "put this plan on andon", "what needs me on andon", "why isn't my card running".
/architecture-rescueFind deepening opportunities in a codebase (shallow modules, missing seams, leaky abstractions) and present them as numbered candidates for a grilling session before any interface is proposed. Use when the code feels tangled or hard to test. Trigger on "improve architecture", "rescue this codebase", "find refactoring opportunities", "ball of mud", "shallow modules"./artifact-publishPublish a visual or interactive result as a Claude Code Artifact: a self-contained HTML or Markdown page on a private, shareable claude.ai link instead of a local file. Use when a dashboard, report, chart, diagram or prototype reads better as a page. Not the claude.ai design canvas (claude-design-brief). Trigger on "publish this as an artifact", "make a shareable link", "give me a link to this"./babysitKeep an open PR healthy on a schedule: poll for review activity, auto-address bot and Copilot nits and routine rebases, re-run the gate, until the PR is mergeable. HITL on anything irreversible; never auto-merges. The scheduled loop around git-pr-feedback, run as "/loop 5m /babysit". Trigger on "babysit my PR", "watch this PR", "keep my PR green", "keep the PR rebased"./backend-agentBuild API servers, business logic and data layers against authored contracts. Use in native orchestrator dispatch or explicitly requested solo backend implementation; load it when the orchestrator assigns this role or the user asks for it.npx claudepluginhub ivy00johns/skill-madness --plugin skill-madnessOther plugins' skills for the same job