home / skills / phrazzld / claude-config / design-theme

design-theme skill

/skills/design-theme

This skill implements a design theme system using tokens and CSS-first Tailwind integration, delegating work to Kimi for tokenized themes.

npx playbooks add skill phrazzld/claude-config --skill design-theme

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
3.1 KB
---
name: design-theme
description: |
  DESIGN-THEME
effort: high
---

---
description: Create or update theme with design tokens
argument-hint: "[selected-direction]"
---

# DESIGN-THEME

Implement a theme system with proper design tokens.

## MANDATORY: Kimi Delegation

**Theme implementation MUST be delegated to Kimi K2.5 via MCP.**

Kimi excels at CSS/Tailwind work:

```javascript
mcp__kimi__spawn_agent({
  prompt: `Implement design theme with tokens:
Direction: ${selectedDNA}
Typography: ${fontStack}
Colors: ${palette}
Use Tailwind 4 @theme directive (CSS-first).
OKLCH for colors. Modular type scale.
Output: Update app/globals.css with token architecture.
Then update components to use tokens.`,
  thinking: true
})
```

**Workflow:**
1. Define direction → Claude (from catalog selection)
2. Implement tokens → Kimi (CSS/Tailwind work)
3. Validate → Claude (quality checks)

## When to Use

- After `/design-catalog` — user selected a direction
- After `/design-audit` — fixing design debt
- Starting fresh — establishing design system

## Process

### 1. Understand Direction

If `$1` provided (from catalog selection):
- Load the selected design DNA
- Extract: typography, colors, spacing, motion

If from audit:
- Address issues found
- Maintain existing patterns where working

### 2. Define Token Architecture

Using Tailwind 4 `@theme` directive (CSS-first):

```css
@theme {
  /* Colors - OKLCH for perceptual uniformity */
  --color-primary: oklch(0.7 0.15 250);
  --color-primary-hover: oklch(0.65 0.15 250);

  /* Typography - modular scale */
  --font-sans: "Custom Font", system-ui, sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;

  /* Spacing - consistent scale */
  --spacing-1: 0.25rem;
  --spacing-2: 0.5rem;
  --spacing-4: 1rem;
  --spacing-8: 2rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px oklch(0 0 0 / 0.1);

  /* Radii */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 1rem;
}
```

### 3. Implement Tokens

Update `app/globals.css` (or equivalent):
- Define all tokens in `@theme`
- Remove `tailwind.config.ts` (CSS-first approach)
- Migrate hardcoded values to tokens

### 4. Update Components

For each component:
- Replace hardcoded colors → `var(--color-*)`
- Replace magic numbers → `var(--spacing-*)`
- Ensure dark mode support

### 5. Validate

Run quality checks:
```
/check-quality  # Typecheck, lint, tests
/rams           # Accessibility score
```

### 6. Document Theme

Create or update design system docs:

```markdown
## Theme: [Name]

### Colors
[Visual color palette with names and values]

### Typography
[Font stack, scale, usage guidelines]

### Spacing
[Scale and when to use each]

### Components
[Key component patterns]
```

## Token Naming Convention

```
--category-variant-state

Examples:
--color-primary
--color-primary-hover
--color-text-muted
--text-heading-1
--spacing-component-gap
```

## Output

Theme implemented with tokens. Commit:
```bash
git add -A && git commit -m "feat: implement design system tokens"
```

Overview

This skill creates or updates a design theme using a CSS-first token architecture and Tailwind 4 @theme. It defines perceptually-uniform color tokens (OKLCH), a modular typography scale, spacing, shadows, and radii, then migrates components to use those tokens. Theme implementation is delegated to Kimi K2.5 via MCP for the CSS/Tailwind work.

How this skill works

Load the selected design DNA (typography, colors, spacing, motion) or use audit findings as input. Generate a token architecture inside @theme in app/globals.css, remove tailwind.config.ts in favor of CSS-first tokens, then update components to reference var(--...) tokens. Delegate the CSS/Tailwind implementation to Kimi using the provided MCP spawn pattern and run quality checks after changes.

When to use it

  • After a design direction is selected from the catalog (post /design-catalog).
  • Following a design audit to fix debt and align tokens (post /design-audit).
  • When starting a new project to establish a consistent design system.
  • Before a major visual refactor to centralize style variables.
  • When migrating from hardcoded styles to a token-based approach.

Best practices

  • Always delegate the CSS/Tailwind implementation to Kimi K2.5 via MCP and keep Claude for direction and validation.
  • Define all tokens inside @theme in app/globals.css and avoid duplicating values in tailwind.config.ts.
  • Use OKLCH for color tokens for perceptual uniformity and a modular scale for typography.
  • Replace hardcoded values in components with var(--category-variant-state) tokens incrementally.
  • Include dark mode counterparts and test accessibility (contrast, focus states) as part of validation.

Example use cases

  • Implement a new brand direction: extract palette and typography from the selected DNA and build tokens.
  • Refactor an app with scattered color and spacing values into a centralized token set.
  • Fix accessibility issues uncovered in a design audit by adjusting token values and revalidating.
  • Establish a baseline theme for multiple projects to share consistent design primitives.
  • Adopt a CSS-first Tailwind workflow by removing tailwind.config.ts and driving tokens from @theme.

FAQ

Why delegate to Kimi K2.5?

Kimi is optimized for CSS/Tailwind work; delegating the implementation ensures consistent token syntax and correct Tailwind 4 @theme usage.

What files get updated?

Primary updates go to app/globals.css for token definitions and component files where hardcoded values are replaced. tailwind.config.ts is removed in the CSS-first approach.