<< All versions

Skill v1.0.0

currentLLM-judged scan90/100
muratcakmak/shipwright/design-tokens
──Details
PublishedOctober 24, 2026 at 02:36 AM
Content Hashsha256:f0d45592030054fd...
Git SHAb1ab83155278
──Files
Files (1 file, 4.1 KB)
SKILL.md4.1 KBactive
SKILL.md · 125 lines · 4.1 KB

version: "1.0.0" name: design-tokens description: Extract or create a typed design token system for a React Native app. Generates color, spacing, and typography token files with light and dark mode support mapped to iOS HIG values. Use when setting up or refactoring the design system. argument-hint: [figma-url-or-description]


Design Tokens

Create or extract a typed design token system for this React Native app.

Input: $ARGUMENTS

MANDATORY PREPARATION

  1. Read Shipwright Context from CLAUDE.md for existing token locations and styling approach
  2. Scan for existing tokens:
  • **/tokens/**, **/theme/**, **/constants/colors.*, **/constants/spacing.*
  • Check if NativeWind, Tamagui, or Unistyles is used (tokens live in their config)
  1. If Figma URL provided: Note the URL — tell the user to export color/typography values, or ask them to paste the token values

TOKEN STRUCTURE

Create token files in the project's preferred location (default: src/tokens/ or tokens/).

Colors (colors.ts)

typescript
export const palette = {
// Brand colors
primary: { light: '#007AFF', dark: '#0A84FF' },
// ... brand-specific colors
// iOS Semantic Colors (map to PlatformColor equivalents)
background: { light: '#FFFFFF', dark: '#000000' },
secondaryBackground: { light: '#F2F2F7', dark: '#1C1C1E' },
tertiaryBackground: { light: '#FFFFFF', dark: '#2C2C2E' },
groupedBackground: { light: '#F2F2F7', dark: '#000000' },
label: { light: '#000000', dark: '#FFFFFF' },
secondaryLabel: { light: '#3C3C43', dark: '#EBEBF5' }, // with 60% opacity
separator: { light: '#3C3C4349', dark: '#54545899' },
// ... extend as needed
} as const;
export type ColorToken = keyof typeof palette;

Spacing (spacing.ts)

typescript
export const spacing = {
xxs: 4,
xs: 8,
sm: 12,
md: 16,
lg: 24,
xl: 32,
xxl: 48,
} as const;
export type SpacingToken = keyof typeof spacing;

Typography (typography.ts)

Map to iOS HIG type scale with Dynamic Type support:

typescript
import { Platform, TextStyle } from 'react-native';
export const typography = {
largeTitle: { fontSize: 34, fontWeight: '700', lineHeight: 41 },
title1: { fontSize: 28, fontWeight: '700', lineHeight: 34 },
title2: { fontSize: 22, fontWeight: '700', lineHeight: 28 },
title3: { fontSize: 20, fontWeight: '600', lineHeight: 25 },
headline: { fontSize: 17, fontWeight: '600', lineHeight: 22 },
body: { fontSize: 17, fontWeight: '400', lineHeight: 22 },
callout: { fontSize: 16, fontWeight: '400', lineHeight: 21 },
subheadline: { fontSize: 15, fontWeight: '400', lineHeight: 20 },
footnote: { fontSize: 13, fontWeight: '400', lineHeight: 18 },
caption1: { fontSize: 12, fontWeight: '400', lineHeight: 16 },
caption2: { fontSize: 11, fontWeight: '400', lineHeight: 13 },
} as const satisfies Record<string, TextStyle>;
export type TypographyToken = keyof typeof typography;

Theme Hook (useTheme.ts)

typescript
import { useColorScheme } from 'react-native';
import { palette } from './colors';
export function useTheme() {
const colorScheme = useColorScheme();
const isDark = colorScheme === 'dark';
const colors = Object.fromEntries(
Object.entries(palette).map(([key, value]) => [
key,
isDark ? value.dark : value.light,
])
) as Record<keyof typeof palette, string>;
return { colors, isDark };
}

ADAPTATION RULES

  • If the project uses NativeWind: Create tokens as Tailwind config values in tailwind.config.js
  • If the project uses Tamagui: Create tokens in the Tamagui config (tamagui.config.ts)
  • If the project uses Unistyles: Create tokens as Unistyles themes
  • If the project uses plain StyleSheet: Create the token files above with a useTheme hook

CHECKLIST

  • [ ] Colors defined with light and dark variants
  • [ ] Spacing scale created (consistent multiplier)
  • [ ] Typography scale mapped to iOS HIG
  • [ ] Theme hook or config created for the project's styling approach
  • [ ] Existing hardcoded values identified for migration
  • [ ] Token files are TypeScript with as const for type safety
  • [ ] Updated Shipwright Context in CLAUDE.md with token file locations
All versions