AGENT SKILL

mh-cto-sdlc-design-token

暂无简介

License 许可
MIT
最近更新
2026-05-13
Stars
★ 2
Forks
0

02 资源文件 2

03 SKILL.md 正文

Design Token

Mode: synthesize-first (D34). Derive token values from the design system decisions. Ask only when a value is genuinely undetermined (color palette not specified, specific px value not stated).

Design tokens are the single source of truth for all visual decisions. Every value in the wireframes and component specs must reference a token — never a raw hex code or px value in component logic.

Step 1 — Load

Read the design system output. Confirm the following are defined:

  • Color system decisions ✓ / ✗
  • Typography system ✓ / ✗
  • Spacing system ✓ / ✗
  • Border/radius decisions ✓ / ✗
  • Elevation/shadow ✓ / ✗

If any is missing: "Cannot define tokens without the complete design system. Run /mh-cto-sdlc-design-system first."

Read the UX brief for the tech stack — the token format depends on the framework.

Step 2 — Determine Token Format

Based on the tech stack from the UX brief:

Tech Stack Token Format
React + Tailwind CSS tailwind.config.js extend block + CSS variables
React + CSS Modules / plain CSS CSS custom properties (:root { --token-name: value; })
React Native JS/TS constants object
Vue + any CSS custom properties
Plain HTML/CSS CSS custom properties

Ask if not clear from UX brief: "What's the UI tech stack? I need to output tokens in the right format."

Step 3 — Define Token Values

Color Tokens

Generate the color palette from the design system's color decisions. Follow semantic naming — tokens reference role, not value:

/* Naming pattern: --color-{role}-{scale} */
/* Roles: brand, neutral, success, warning, error, info */

--color-brand-50  → lightest tint
--color-brand-500 → primary (the main brand action color)
--color-brand-900 → darkest shade

--color-neutral-0   → white
--color-neutral-100 → lightest surface
--color-neutral-200 → border
--color-neutral-500 → secondary text
--color-neutral-900 → primary text
--color-neutral-950 → near-black

--color-success-500, --color-warning-500, --color-error-500, --color-info-500

Semantic alias tokens (what components actually use):

--color-surface-page         → maps to --color-neutral-0 or --color-neutral-100
--color-surface-card         → maps to --color-neutral-0
--color-surface-elevated     → ...
--color-text-primary         → maps to --color-neutral-900
--color-text-secondary       → maps to --color-neutral-500
--color-text-disabled        → maps to --color-neutral-400
--color-text-on-brand        → maps to --color-neutral-0 (text on brand buttons)
--color-border-default       → maps to --color-neutral-200
--color-border-focus         → maps to --color-brand-500
--color-action-primary       → maps to --color-brand-500
--color-action-primary-hover → maps to --color-brand-600
--color-action-destructive   → maps to --color-error-500

Ask the user to confirm the brand primary color if not specified: "What's the primary brand color? (hex value, or describe — e.g., 'blue like Notion' / 'green like Stripe')"

Typography Tokens

--font-family-base: {font stack}
--font-family-mono: {monospace stack — for code, IDs, technical data}

--font-size-xs:   12px / 0.75rem
--font-size-sm:   14px / 0.875rem
--font-size-base: 16px / 1rem
--font-size-lg:   18px / 1.125rem
--font-size-xl:   20px / 1.25rem
--font-size-2xl:  24px / 1.5rem
--font-size-3xl:  30px / 1.875rem

--font-weight-regular: 400
--font-weight-medium:  500
--font-weight-semibold: 600
--font-weight-bold:    700

--line-height-tight:   1.25
--line-height-normal:  1.5
--line-height-relaxed: 1.75

Spacing Tokens

Based on the spacing system (4px or 8px base unit):

--space-1: 4px
--space-2: 8px
--space-3: 12px
--space-4: 16px
--space-5: 20px
--space-6: 24px
--space-8: 32px
--space-10: 40px
--space-12: 48px
--space-16: 64px
--space-20: 80px
--space-24: 96px

Border & Radius Tokens

--radius-sm:   4px
--radius-md:   8px
--radius-lg:   12px
--radius-xl:   16px
--radius-full: 9999px  (pills, circular avatars)

--border-width-default: 1px
--border-width-thick:   2px

Elevation / Shadow Tokens

--shadow-none:    none
--shadow-sm:      0 1px 2px 0 rgba(0,0,0,0.05)
--shadow-md:      0 4px 6px -1px rgba(0,0,0,0.1)
--shadow-lg:      0 10px 15px -3px rgba(0,0,0,0.1)
--shadow-xl:      0 20px 25px -5px rgba(0,0,0,0.1)

Transition Tokens

--duration-instant:  100ms
--duration-fast:     150ms
--duration-normal:   200ms
--duration-slow:     300ms
--easing-default:    ease-in-out
--easing-spring:     cubic-bezier(0.175, 0.885, 0.32, 1.275)

Breakpoint Tokens (if responsive)

--breakpoint-sm:  640px
--breakpoint-md:  768px
--breakpoint-lg:  1024px
--breakpoint-xl:  1280px
--breakpoint-2xl: 1536px

Step 4 — Format Output for Tech Stack

Render the tokens in the correct format for the project's tech stack.

CSS custom properties format:

:root {
  /* Colors — Primitives */
  --color-brand-500: #3b82f6;
  /* ... */

  /* Colors — Semantic */
  --color-action-primary: var(--color-brand-500);
  /* ... */

  /* Typography */
  --font-family-base: 'Inter', system-ui, sans-serif;
  /* ... */
}

Tailwind config format:

// tailwind.config.js — theme.extend section
colors: {
  brand: {
    50: '#eff6ff',
    500: '#3b82f6',
    900: '#1e3a8a',
  },
  // ...
},
fontFamily: {
  base: ['Inter', 'system-ui', 'sans-serif'],
},
spacing: {
  // override or extend spacing scale
},

Step 5 — Write Output

Save to _mh-output/cto/sdlc/design-token/{YYYY-MM-DD}_{r###}_design-tokens.md:

# Design Tokens

**Product:** {from PRD}
**Format:** {CSS custom properties / Tailwind config / JS constants}
**Date:** {date}

---

## Token Reference

{Human-readable table of all semantic tokens — name, value, usage}

## Implementation File

\`\`\`{format}
{Full token file — copy-paste ready}
\`\`\`

## Dark Mode (if applicable)

\`\`\`css
[data-theme="dark"] { ... }
\`\`\`

Step 6 — Present Summary

Design tokens defined. {N} total tokens across {N} categories.

Format: {CSS variables / Tailwind / JS constants}. Copy-paste ready.

Next step: Run /mh-cto-sdlc-component-spec to spec custom components using these tokens.

04 同仓库更多 Skills

Imad-Oute
Imad-Oute/MicroHard

mh-vo-vault-brief

Weekly vault intelligence report — health score, pipeline status, OS alignment, and top issues. Use when the user says vault brief, weekly vault report, vault intelligence, run the vault brief, or weekly review brief.

★ 2
Imad-Oute
Imad-Oute/MicroHard

mh-vo-output-bridge

Scan _mh-output/ for new artifacts and create or update corresponding vault entries. Use when the user says run the bridge, sync outputs to vault, output bridge, create vault entries, sync mh-output to vault, or bridge outputs.

★ 2
Imad-Oute
Imad-Oute/MicroHard

mh-vo-moc-builder

Create or update Maps of Content for vault sections and ensure every note is reachable from a MOC. Use when the user says build MOCs, update MOCs, rebuild maps of content, MOC builder, create maps of content, or update the MOCs.

★ 2
Imad-Oute
Imad-Oute/MicroHard

mh-vo-link-architect

Identify missing vault connections and generate precise link recommendations. Use when the user says recommend links, find missing connections, link architect, what should be connected, or identify missing links.

★ 2
Imad-Oute
Imad-Oute/MicroHard

mh-vo-base-builder

Generate Obsidian Bases (.base files) for live database views of vault data. Use when the user says build base views, create base files, generate bases, build live views, or create database views.

★ 2
Imad-Oute
Imad-Oute/MicroHard

mh-vo-taxonomy-enforcer

Audit vault tags and frontmatter, find drift, and apply corrections. Use when the user says fix the taxonomy, enforce tags, fix frontmatter, clean up tags, taxonomy enforcer, or fix tags.

★ 2