Style Extractor (Web Style + Motion)
This skill extracts a reusable design system from web UIs: colors, typography, spacing, components, and—when the UI is dynamic—motion (runtime timings, keyframes, delay chains).
Output location (REQUIRED)
- •Save all generated deliverables under:
%USERPROFILE%\\style-extractor\\ - •Never write generated outputs under the skill folder (
.codex/skills/...)
Recommended structure:
- •
...\\<project>-<style>-style.md - •
...\\<project>-<style>-evidence\\(screenshots / css / js / motion / traces)
References (quality bar)
- •
references/endfield-design-system-style.md— best-practice style + motion reference - •
references/motherduck-design-system-style.md— strong static style reference
Workflow
Phase 0 — Inputs
- •Project name + style/variant name
- •Sources: URL / web repo / both
- •Motion importance: if meaningful motion exists, Strategy A2/A3 is required
Phase 1 — Evidence gathering (do this first)
Strategy A — Live website (Chrome MCP)
Use:
- •
new_page/select_page/navigate_page - •
take_screenshot(fullPage when helpful) - •
evaluate_script - •
list_network_requests/get_network_request(pull CSS/JS bodies when possible) - •
performance_start_trace/performance_stop_trace(optional for complex motion)
Strategy A1.5 — Screenshot-assisted evidence (HIGHLY RECOMMENDED)
Screenshots don’t replace computed styles, but they improve:
- •semantic intent (primary vs secondary vs disabled)
- •gated/hard-to-freeze states (login, region locks, scroll-only reveals)
- •visual-only details (textures, subtle gradients, composition)
Minimum screenshot set:
- •baseline (full page/section)
- •navigation visible + active state
- •primary CTA: default + hover + pressed (if possible)
- •form controls: default + focus-visible (+ invalid if present)
- •modal/dialog open (if any)
- •motion sequence (2–4 shots): ~0ms / ~120ms / ~300–600ms after trigger
Strategy A2 — Runtime motion evidence (REQUIRED for dynamic sites)
Computed styles alone won’t reconstruct timing quality. Capture runtime motion via:
- •
document.getAnimations({ subtree: true }) - •per animation:
duration/delay/fill/iterations/easing+ moved properties (opacity/transform/color/...) - •when possible: full keyframes via
animation.effect.getKeyframes()
Minimum capture loop:
- •baseline snapshot
- •trigger interaction (click/scroll/hover/focus)
- •snapshots at
t0,t80–120ms,t300–600ms
Reusable snippets (paste into evaluate_script):
- •
scripts/motion-tools.js - •
scripts/library-detect.js - •
scripts/extract-keyframes.py(offline keyframes extraction from downloaded.css)
Strategy A3 — JS-driven motion / third-party libs (IMPORTANT)
If motion is JS-driven (e.g., Swiper/carousels), document.getAnimations() may miss the main movement.
Detect via:
- •DOM/CSS fingerprints (
.swiper-wrapper/.swiper-slide,--swiper-theme-color) - •asset hints (script/style URLs containing
swiper/gsap/lottie/three) - •globals (
window.Swiper,window.gsap, ...)
Fallback evidence:
- •per-frame sampling (rAF loop ~700–900ms):
transform/opacity/... - •or a Performance trace
Phase 2 — Semantic tokenization (REQUIRED)
Do not stop at raw values. Convert repeated values into semantic tokens:
- •cluster repeated values (colors/radii/durations/easings/shadows)
- •map usage (CTA/text/border/overlay/active/etc.)
- •name by intent (e.g.,
--color-accent,--motion-300,nav.switch.iconColor) - •keep evidence alongside tokens (raw values + element/selector/screenshot)
Phase 3 — Write the style guide (recommended sections)
Minimum recommended sections:
- •Overview
- •Design philosophy (evidence-based)
- •Semantic tokens (colors + motion)
- •Color palette + usage mapping
- •Typography scale
- •Spacing scale
- •Components (with state matrix)
- •Motion (runtime evidence + full
@keyframes+ delay chains + JS-driven notes) - •Layering (z-index/overlays)
- •Responsive behavior (breakpoints + degradation)
- •Copy-paste examples (5+)
Component state matrix must include at least:
- •default / hover / active(pressed) / focus-visible / disabled (loading if present)
Quality checklist
Static:
- •tokens include usage intent (not just lists)
- •examples are copy-pasteable (HTML+CSS)
Motion (when dynamic):
- •3+ key interactions with
document.getAnimations()evidence - •full
@keyframesblocks for important animations - •at least one documented “delay chain” if present
- •JS-driven motion: detection proof + sampling/trace evidence