plugins/smedjen/skills/design-to-code-patterns/SKILL.md
Translating design specs into frontend components — design token consumption, spacing/typography/color systems, responsive breakpoints, component decomposition from mockups, and design-code handoff conventions.
npx skillsauth add hjemmesidekongen/ai design-to-code-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Never hardcode colors, spacing, fonts, or shadows. Reference design tokens via CSS custom properties (var(--color-primary-500)) or utility classes. Token categories: color (palette + semantic), typography (family, size, weight, line-height), spacing (4px base scale), shadows, radii, breakpoints. If the design system provides tokens, consume them. If not, extract them from the design file first.
Base unit: 4px. Scale: 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 80, 96. All spacing (padding, margin, gap) snaps to scale values. Vertical rhythm: line-height multiples of the base unit. Component internal spacing is smaller (8-16px). Section spacing is larger (48-96px). Never use arbitrary pixel values.
Use a type scale (e.g., 12, 14, 16, 18, 20, 24, 30, 36, 48, 60px). Each size has a corresponding line-height and letter-spacing. Map semantic names: text-xs through text-6xl. Headlines: tighter letter-spacing (-0.01 to -0.02em). Body: default tracking. Use 2-3 font weights max (regular, medium, bold).
Read the design top-down: page → sections → cards/groups → elements. Each visual group that repeats or has distinct state becomes a component. Props mirror design variants (size, variant, color). Slot patterns for flexible content areas. Component names match the design system naming.
Mobile-first: base styles are mobile, layer up with min-width queries. Named breakpoints: sm (640px), md (768px), lg (1024px), xl (1280px), 2xl (1536px). Grid: 4 cols mobile → 8 cols tablet → 12 cols desktop. Touch targets: 44px minimum. Check the design at each breakpoint — don't assume intermediate states.
Palette: 10-step scales (50-950) per hue. Semantic tokens: --color-primary, --color-error, --color-success, --color-text-primary, --color-bg-surface. Dark mode: swap semantic tokens, not palette values. Contrast: 4.5:1 minimum for text (WCAG AA). Never reference palette values directly in components — use semantic tokens.
See references/process.md for token extraction workflow, component mapping examples, handoff checklists, and responsive grid patterns.
development
Creates a brand from scratch through market research and interactive sparring. Runs competitive research via Perplexity, then guides the user through positioning, audience, voice, values, and content pillars. Produces the full brand guideline set at .ai/brand/{name}/. Use when building a new brand, defining brand strategy for a product, or when /våbenskjold:create is invoked.
testing
Loads brand guidelines from .ai/brand/{name}/ and makes them available to the current context. Progressive disclosure: L1 confirms brand exists, L2 loads summary, L3 loads specific files on demand. Use when a downstream skill or user needs brand context, or when /våbenskjold:apply is invoked.
documentation
Guided reinvention of an existing brand guideline. Loads current brand from .ai/brand/{name}/, identifies what to keep vs change, and walks the user through targeted evolution. Preserves brand equity while updating positioning, voice, or values. Use when refreshing a brand or when /våbenskjold:evolve is invoked.
development
Codifies an existing brand from materials, samples, and references. Analyzes provided content to extract voice patterns, values, and positioning. Produces the same guideline format as brand-strategy. Use when a brand already exists but isn't documented, or when /våbenskjold:audit is invoked.