design-token-system
Build a three-tier token architecture (global, semantic, component) with theming. Use when setting up design tokens, adding themes or dark mode to a design system, or untangling hard-coded colors and spacing.
- License 许可
- MIT
- 最近更新
- 2026-10-14
- Stars
- ★ 25
- Forks
- 3
01 前言 Front Matter
- name
- design-token-system
- metadata
- { "title": "Design Token System" }
- description
- Build a three-tier token architecture (global, semantic, component) with theming. Use when setting up design tokens, adding themes or dark mode to a design system, or untangling hard-coded colors and spacing.
03 SKILL.md 正文
Design Token System
Use this skill to design a scalable token architecture that survives rebrands, theming, and growth - instead of hard-coded values sprinkled through the codebase.
The three tiers
Tier 1: Global (primitive) tokens
Raw values with no meaning attached. The full palette of options.
const global = {
blue500: '#3B82F6',
gray900: '#111827',
space4: '16px',
fontSize3: '18px',
};
Rules: name by value, never by use. blue500, not primary. Components never
reference these directly.
Tier 2: Semantic (alias) tokens
Assign meaning by pointing at globals. This is where theming lives.
const semantic = {
colorTextPrimary: global.gray900,
colorActionDefault: global.blue500,
colorSurfaceBase: global.white,
spaceInline: global.space4,
};
Rules: name by intent (colorActionDefault), not appearance (colorBlue). Most
components consume this tier.
Tier 3: Component tokens
Optional, for components that need fine control. Point at semantic tokens.
const button = {
buttonBackground: semantic.colorActionDefault,
buttonText: semantic.colorTextOnAction,
buttonPaddingX: semantic.spaceInline,
};
Why three tiers
- A rebrand changes global values; semantics and components follow automatically.
- A theme (dark mode) re-points semantic tokens to different globals.
- A one-off component tweak touches only its component tokens, not the system.
Theming with token sets
Define one semantic set per theme that re-points to the same global palette:
const semanticDark = {
colorTextPrimary: global.gray050,
colorSurfaceBase: global.gray900,
colorActionDefault: global.blue400, // lightened for dark surfaces
};
Components reference colorSurfaceBase; switching the active semantic set flips
the whole theme with zero component changes.
Naming convention
Adopt a predictable structure: category-property-variant-state.
color-text-primarycolor-action-default-hoverspace-inline-sm
Keep it consistent and machine-parseable so tooling can generate platform outputs.
Token categories to cover
Color, spacing, typography (family, size, weight, line-height, letter-spacing), radii, borders, shadows, z-index, motion (duration, easing), and breakpoints.
Tooling
- Store source tokens as JSON (W3C DTCG format) so they are platform-agnostic.
- Use Style Dictionary or similar to transform into CSS variables, JS, iOS, Android.
- Validate references resolve and no component points directly at a global.
Guardrails
- No raw hex or px in component code - everything resolves through tokens.
- Every semantic token must have a value in every theme.
- Deprecate, don't delete: keep an alias when renaming so consumers migrate gradually.
Output
Deliver the three-tier JSON source, a light and dark semantic set, the naming convention doc, and the build config that emits platform-specific token files.
04 同仓库更多 Skills
zone-2-cardio-plan
Use when someone asks to build a steady-state cardio plan, train an aerobic base or Zone 2, structure easy or endurance weekly cardio, train by heart-rate zones, or improve resting heart rate, VO2, or endurance. Builds a heart-rate-zone aerobic training block with session structure, modality choice, and progression. General fitness guidance, not medical advice. Do NOT use to design a strength or lifting program (use Strength Training Plan), high-intensity interval conditioning, HIIT, or circuits (use Conditioning & HIIT Program), or a mobility/flexibility routine (use Mobility Routine).
youtube-script-writer
Writes retention-engineered long-form YouTube scripts on a hook/body/payoff architecture - a first-30-seconds hook that survives the retention cliff, a beat-sheet body with mini-hooks and bridges, timed pattern interrupts, and a payoff that over-delivers - with B-roll and editing cues marked inline. Use when someone says "script my next video", "my retention graph dies at the start", "tighten this draft", or "outline a video on X". Do NOT use for the 3-second opener of TikTok, Reels, or Shorts - use video-hook-writer instead; do NOT use for spoken voiceover synced to on-screen tutorial actions - use narration-script instead; do NOT use for a sales demo built on a buyer's discovery notes - use demo-script instead; do NOT use to design the thumbnail and title - use thumbnail-concept instead.
win-back-campaign
Designs segmented win-back email sequences for dormant users - dormancy tiers, a three-beat sequence with a single proportional incentive, and a suppression rule - and measures success by re-activation, not opens. Use when someone says "our users went quiet", "design a win-back campaign", "how do I re-engage lapsed customers", "should we email people who haven't logged in for months", or lifecycle messaging has stopped landing with a lapsed segment. Do NOT use for recovering an unfinished checkout - use abandoned-cart-sequence instead. Do NOT use for diagnosing and fixing why active customers cancel - use churn-reduction instead. Do NOT use for building always-on onboarding or nurture flows - use email-drip-builder instead.
wikipedia-style
Writes neutral, verifiable, encyclopedic prose following Wikipedia's core content policies and manual of style - NPOV, inline citations, notability-backed claims, and a strict ban on promotional language. Use when someone asks "write this like a Wikipedia article", "draft a Wikipedia page for this company or person", "make this neutral and encyclopedic", or "why does my article draft keep getting rejected". Do NOT use for persuasive or opinion writing - use op-ed-writer instead; for thesis-driven academic papers, use academic-essay; for verifying claims in existing text, use fact-checker.
whitepapers
Structures and writes authoritative B2B whitepapers - a standalone executive summary, a data-sized problem statement, methodology, evidence-driven findings, recommendations, and a soft call to action - flagging every claim that needs a real citation. Use when a marketer asks "write a whitepaper on this topic", "turn our research into a lead-gen asset", "make this credible enough for executives", or a draft reads like a product pitch instead of analysis. Do NOT use for customer-story-driven proof - use case-study-builder instead; for policy audiences, use policy-brief.
white-space-analysis
Finds unmet market gaps by ranking jobs-to-be-done on importance versus satisfaction, overlaying them against current solutions and workarounds, and validating that each gap is real, winnable, and worth winning. Use when someone asks "where are the gaps in this market", "what's underserved here", "where should we play next", or is hunting for product, feature, or market-entry opportunities. Do NOT use for profiling competitors and building battle cards - use competitive-intelligence instead; for putting a dollar figure on an identified opportunity - use market-sizing instead; for extracting jobs-to-be-done from raw customer interviews - use jtbd-extractor instead.