From adhd
Sync design tokens between this Tailwind v4 codebase and the configured Figma file. Reads adhd.config.ts at the repo root. Supports --dry-run (read-only diff) and --domains <comma,separated> (limit to specific domains: colors, spacing, typography, radius, shadow).
How this skill is triggered — by the user, by Claude, or both
Slash command
/adhd:sync [--dry-run] [--domains <comma,separated>][--dry-run] [--domains <comma,separated>]This skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are running the ADHD design-token sync workflow. ADHD ("agent-driven harmonious development") keeps design tokens synchronized between this Tailwind v4 codebase (`globals.css`) and a Figma file via a leader-follower model defined in `adhd.config.ts`.
You are running the ADHD design-token sync workflow. ADHD ("agent-driven harmonious development") keeps design tokens synchronized between this Tailwind v4 codebase (globals.css) and a Figma file via a leader-follower model defined in adhd.config.ts.
Authoritative spec: docs/superpowers/specs/2026-05-09-adhd-token-sync-design.md — read it if you need detail beyond what this skill provides.
Parse $ARGUMENTS:
--dry-run flag (boolean) — if present, run phases 1–4 only (validate → read → diff → display) and stop without applying changes.--domains <list> flag — optional comma-separated subset of supported domains. If absent, use all domains from the config (or all five supported domains if the config doesn't restrict).Stop the workflow on any failure here. Print the failure message and the relevant fix-up guidance from the "Common errors" section at the bottom of this skill.
adhd.config.tsUse the Read tool on adhd.config.ts at the repo root.
If the file does not exist, abort with:
ADHD sync cannot proceed.
Reason: Cannot find adhd.config.ts at the repo root.
Next step: Run /adhd:config to fix.
PAT-leak preflight. Before parsing for fields, scan the source text of the file you just read with two regex checks:
figd_[A-Za-z0-9_-]+ — Figma PAT prefix.(pat|token|secret)\s*:\s*"[^"]{30,}" — long opaque value assigned to a credential-named key. If the matched value also satisfies ^[A-Z][A-Z0-9_]*$ (i.e., it looks like an env var name), skip this heuristic — it's a valid name, not a token.On match, abort with the credential-leak message:
ADHD sync cannot proceed.
Reason: Looks like a Figma PAT is committed to adhd.config.ts. This is a credential leak.
Next step: Remove it from the config and store it as FIGMA_PAT in either .env.local
(gitignored) or your shell environment. Then run /adhd:config.
Parse the default-exported object. Since this is a plain TypeScript literal (no imports), extract the fields with targeted regex (look for leader:, figma:, domains:, cssEntry:).
Validate:
leader (if present) is exactly "code" or "figma". Absent is treated as "figma".
figma.url matches ^https://www\.figma\.com/design/[^/]+/.
domains (if present) is an array containing only "colors", "spacing", "typography", "radius", "shadow".
cssEntry (if present) points to a file that exists.
figma.pat (if present) matches ^[A-Z][A-Z0-9_]*$. If it contains lowercase letters, special chars beyond underscore, or is longer than ~30 chars, abort with:
ADHD sync cannot proceed.
Reason: figma.pat must be the NAME of an env var (e.g., "FIGMA_PAT"), not the token itself.
Next step: Run /adhd:config to fix.
On any field mismatch, abort with:
ADHD sync cannot proceed.
Reason: adhd.config.ts field <field> has an unexpected value: <offending value>.
Expected: <expected schema description>.
Next step: Run /adhd:config to fix.
leader: "code" apply path — the code → Figma push apply phase is being implemented in a separate plan (docs/superpowers/plans/2026-05-09-adhd-config-hybrid-writes.md, forthcoming). Until that plan lands, abort with:
ADHD sync cannot proceed.
Reason: leader: "code" is configured, but the apply path is still being built (Plan 2 of the
ADHD config + hybrid-writes spec). Your config schema is valid; PAT validity will be
verified by Plan 2's apply path when it ships.
Next step: For now, switch leader to "figma" via /adhd:config to use the pull-from-Figma path.
Or wait for Plan 2 to ship the code→Figma writes engine.
globals.cssResolve CSS path: config.cssEntry ?? "app/globals.css".
If the resolved file does not exist, abort with:
ADHD sync cannot proceed.
Reason: Cannot find CSS entry at <path>.
Next step: Run /adhd:config to fix.
Read the file's first ~40 lines and confirm @import "tailwindcss" is present. If not, warn (don't abort) and continue.
Extract the file key from config.figma.url: it is the path segment immediately after /design/.
Call mcp__figma__get_metadata with the file key.
If the call fails with an authentication error, abort with:
ADHD sync cannot proceed.
Reason: Figma MCP is not authenticated.
Next step: Run the Figma MCP auth flow per Figma's docs.
If the call returns 404 / not found, abort with:
ADHD sync cannot proceed.
Reason: Cannot reach the Figma file at <url>.
Next step: Run /adhd:config to fix.
Call mcp__figma__get_variable_defs (or the equivalent variable-listing tool) on the file.
Confirm:
Primitives exists. It must have either no modes or exactly one mode (Figma always has at least one mode per collection; treat the single-mode case as "no modes").Semantic exists with exactly two modes named Light and Dark (case-sensitive).^[a-z0-9]+(-[a-z0-9]+)*(/[a-z0-9]+(-[a-z0-9]+)*)*$).Primitives variables have raw values (color, number, string) — not aliases.Semantic variables alias to a Primitives variable in BOTH modes — not raw values, not aliases to other semantic variables.On any failure, abort with:
ADHD sync cannot proceed.
Reason: <specific issue, e.g.: Semantic collection has 3 modes (Light, Dark, HighContrast);
v1 supports exactly Light and Dark.>
Next step: Fix the Figma file: <specific corrective action>.
--domains argument was passed, parse it and use that subset.config.domains is present, use it.--domains includes anything not in config.domains (when set), warn the user and use the intersection.Read the resolved globals.css file in full. Parse the canonical block structure to extract ADHD-managed variables.
Look for the @theme { block (NOT @theme inline {). Within it, extract every variable matching ADHD-managed name patterns:
--color-{palette}-{shade} → colors primitive--spacing-{n} → spacing primitive--radius-{name} → radius primitive--shadow-{name} → shadow primitive--font-{family-name} → typography primitive (font family)--text-{size-name} → typography primitive (font size)--font-weight-{name} → typography primitive (font weight)--leading-{name} → typography primitive (line height)Skip variables that do not match any pattern — they are user-owned.
Look for the top-level :root { block (the one NOT inside @media). Extract every variable that is NOT prefixed with the ADHD primitive prefixes — i.e., it does NOT start with --color-, --spacing-, --radius-, --shadow-, --font-, --text-, --leading-. These are semantic role tokens like --brand-surface.
For each, parse its value: it should be var(--color-{palette}-{shade}) or another ADHD primitive reference. Record the role name → primitive reference.
Look for @media (prefers-color-scheme: dark) containing a :root { block. Extract semantic role tokens the same way as 2.2; these are the Dark mode values.
Look for the @theme inline { block. Confirm every semantic role token from 2.2 has a matching --color-{role}: var(--{role}) line. Note any missing exposures — they will be added during apply.
Produce a structured map:
{
primitives: {
colors: { "gold-100": "#faf0c5", ... },
spacing: { "1": "0.25rem", ... },
typography: { "sans": "...", "base": "1rem", ... },
radius: { ... },
shadow: { ... }
},
semantic: {
"brand-surface": { light: "var(--color-gold-100)", dark: "var(--color-gold-900)" },
...
}
}
This is the code-side input to the diff.
Use mcp__figma__get_variable_defs (or the appropriate tool surfaced by the Figma MCP — check available tools at runtime) to retrieve all variables in the Primitives and Semantic collections.
Apply this mapping (slash → dash, prepend Tailwind prefix where applicable):
| Figma name | CSS variable name |
|---|---|
colors/{palette}/{shade} | --color-{palette}-{shade} |
spacing/{n} | --spacing-{n} |
radius/{name} | --radius-{name} |
shadow/{name} | --shadow-{name} |
font/{family-name} | --font-{family-name} |
text/{size-name} | --text-{size-name} |
font-weight/{name} | --font-weight-{name} |
leading/{name} | --leading-{name} |
colors/{role-path} (Semantic) | --{role-path-with-dashes} |
For Semantic variables, the alias target (e.g., colors/gold/100) translates to a var(--color-gold-100) reference.
Produce the same structure as Phase 2.5 (primitives and semantic keys) so the two maps can be diffed directly.
Drop entries from both maps that don't belong to a selected domain (from Phase 1.5).
Compare the two token maps. For each domain, produce three lists:
The leader / follower assignment depends on config.leader:
leader: "code" → leader = code-side map (Phase 2), follower = Figma-side map (Phase 3)leader: "figma" → leader = Figma-side map, follower = code-side mapPrint a per-domain summary, e.g.:
ADHD Sync — leader: code → figma
Domain Added Changed Removed
─────────────────────────────────────
colors 3 2 0
spacing 0 1 0
typography 0 0 0
radius 0 0 0
shadow 0 0 0
─────────────────────────────────────
Total 3 3 0
For each domain with changes, print a detailed table showing per-token diffs. Color-code: added=green, changed=yellow, removed=red. For semantic tokens, show per-mode differences explicitly (e.g., brand-surface | dark only: gold-800 → gold-900).
--dry-run: stop herePrint: Dry run complete. No changes applied. and exit.
Use AskUserQuestion to prompt the user with a single y/n: "Apply these changes?". Default to "no" if the diff includes any removals — those require explicit confirmation because the follower may have legitimate orphans the leader lost track of.
If the user declines, stop with: Sync cancelled. No changes applied.
If the user confirms, proceed to Phase 6.
Process domain-by-domain so the user sees clear progress. After each domain, commit the changes (code side) so partial failures are recoverable.
For each token in the diff:
After each domain, print: ✓ <domain> synced to Figma (N changes).
For each token in the diff, edit globals.css in place:
@theme { block. Insert in alphabetical order within the block. If the block doesn't exist, create it after the @import "tailwindcss"; line.:root { block.@media (prefers-color-scheme: dark) → :root { block.--color-{role}: var(--{role}); into the @theme inline { block.After each domain, run git add <resolvedCssEntryPath> and git commit -m "ADHD sync: <domain> from Figma (N changes)" so each domain is its own commit. Use the path resolved in Phase 1.2 (defaults to app/globals.css but may be overridden by config.cssEntry).
Variables that don't match an ADHD name pattern (e.g., user-written --my-custom-var) are NEVER modified or removed. If a user-written variable accidentally matches an ADHD pattern, surface the warning during Phase 2 (when globals.css is parsed and ADHD-pattern variables are extracted) — do not silently overwrite.
Re-run Phases 2 and 3 to read both sides afresh. Recompute the diff for the synced domains. Assert it is empty (excluding any explicitly skipped removals).
If the diff is NOT empty, the apply step failed somewhere. Print the post-apply diff and DO NOT claim success. Tell the user: Sync verification failed for domain(s): <list>. The apply step did not produce the expected result. Review the diff above and re-run.
Print a final summary:
ADHD Sync complete.
Domain Applied
────────────────────
colors 5
spacing 1
typography 0
radius 0
shadow 0
────────────────────
Total 6
Commits (code side):
abc1234 ADHD sync: colors from Figma (5 changes)
def5678 ADHD sync: spacing from Figma (1 changes)
Warnings:
- 0 user-content collisions
- 0 orphans skipped
Include git commit short-SHAs for code-side changes (which apply when leader = "figma" and the code is the follower being updated). If leader = "code", mention that Figma changes were applied via MCP and are not git-tracked. (Note: in v1, leader = "code" aborts in Phase 1, so this branch is currently unreachable; included for forward compatibility.)
ADHD v1 requires this exact structure in the Figma file. Validation will fail otherwise.
Primitives collection (no modes — or single mode treated as no modes)Variables follow these naming patterns:
| Domain | Pattern | Example |
|---|---|---|
| Colors | colors/{palette}/{shade} | colors/gold/100 |
| Spacing | spacing/{n} | spacing/4 |
| Radius | radius/{name} | radius/md |
| Shadow | shadow/{name} | shadow/lg |
| Typography | font/{family-name}, text/{size}, font-weight/{name}, leading/{name} | font/sans, text/base, font-weight/medium, leading/tight |
All values are RAW (not aliases). No modes (or one mode treated as no modes).
Semantic collection (exactly two modes: Light, Dark)Variables follow colors/{role-path} pattern, e.g., colors/brand/surface, colors/background. ADHD does not mandate the role vocabulary — surface/on-surface (Material), bg/fg, main/text are all valid as long as they're kebab-case + slash hierarchy.
All values are ALIASES to a Primitives variable. Both modes (Light and Dark) must have alias values.
Translation between Figma variable names and CSS variable names:
| Figma | CSS variable | Block in globals.css |
|---|---|---|
colors/gold/100 (Primitives) | --color-gold-100 | @theme {} |
spacing/4 (Primitives) | --spacing-4 | @theme {} |
radius/md (Primitives) | --radius-md | @theme {} |
shadow/md (Primitives) | --shadow-md | @theme {} |
font/sans (Primitives) | --font-sans | @theme {} |
text/base (Primitives) | --text-base | @theme {} |
font-weight/medium (Primitives) | --font-weight-medium | @theme {} |
leading/tight (Primitives) | --leading-tight | @theme {} |
colors/brand/surface (Semantic) | --brand-surface (Light value) | :root {} |
colors/brand/surface (Semantic) | --brand-surface (Dark value) | @media (prefers-color-scheme: dark) :root {} |
colors/brand/surface (Semantic) | --color-brand-surface: var(--brand-surface) | @theme inline {} (Tailwind exposure) |
Run /adhd:config — the wizard walks you through creating one. (For reference, the schema is documented in plugins/adhd/skills/config/SKILL.md under "Reference: adhd.config.ts schema".)
The Figma MCP needs OAuth. Run the MCP auth flow per Figma MCP documentation, then retry.
Verify the URL is for a Figma file (not a node selection or a non-Figma URL). Confirm you have read access to the file. If leader: "code", you also need write access.
ADHD v1 mandates these exact collection names. Rename your collections in Figma, or create them.
ADHD v1 supports only the two-mode Light/Dark model. Remove or rename modes. Multi-mode support is planned for v2.
Rename the offending variable. Examples of valid names: colors/gold/100, spacing/4, colors/brand/surface. Examples of invalid names: Colors/Gold/100 (capitalized), colors gold 100 (spaces), colors_gold_100 (underscores).
Edit the variable in Figma to alias a Primitives variable. ADHD requires Semantic to be aliases-only.
Rename your CSS variable to avoid collision, OR accept that ADHD will overwrite it on next sync. The collision is in the listed file/line of globals.css.
Provides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub sanctuarycomputer/adhd --plugin adhd