Reference Design System Generator
Analyze the user's design references (app screenshots, mockups, PDFs, links, text descriptions, or existing code) and generate a comprehensive 4-file design system for mobile apps: iOS, Android, or cross-platform (React Native, Flutter, Expo, KMP).
Mobile adds concerns a web design system doesn't have: platform conventions, safe areas and system bars, Dynamic Type / font scaling, gesture-driven navigation, springs and interruptible animations, haptics, and the screen-level patterns apps are built from. This skill documents all of it.
Inputs
Accept ANY combination of:
- Images: App screenshots, App Store / Play Store screenshots, mockups, design tool exports
- PDFs: Brand guidelines, style guides, design specs, motion specs
- Links: Design system docs, component libraries, App Store / Play Store listings, Figma files
- Text descriptions: Written descriptions of the design language, brand personality, motion feel
- Existing code: SwiftUI / UIKit themes, Jetpack Compose
MaterialTheme, React Native / Expo theme files, FlutterThemeData, design tokens JSON, Lottie JSON
If the user provides a link, use WebFetch to retrieve the content (use Figma tools for figma.com links when available). If they provide a file path, read the file.
Output
Generate exactly 4 markdown files in the user's working directory (or a specified path):
- design.md — Token Reference (color, type, spacing, shape, elevation, layout, icons)
- design-motion.md — Motion, Animation & Haptics
- design-guidelines.md — Accessibility, Gestures, Platform Conventions & Do's/Don'ts
- design-components.md — Component Specs & Screen Patterns
Before You Analyze
1. Determine target platform(s)
Infer from the references; ask only if there's no signal at all.
| Signal | iOS | Android |
|---|---|---|
| Status bar | Clock left, Dynamic Island / notch centered | Clock left, icons right, punch-hole camera |
| Bottom | Home indicator bar, tab bar with labels | Gesture pill or 3-button nav, navigation bar with active indicator pill |
| Typeface | SF Pro / New York | Roboto / Google Sans / Product font |
| Top bar | Large title that collapses, centered inline title | Left-aligned title, top app bar |
| Controls | Segmented control, iOS switch, wheel picker, action sheet | M3 switch with thumb icon, FAB, chips, snackbar |
| Code | .swift, Color(…), Font.system | .kt, MaterialTheme, dp/sp |
- iOS only → use
pt, map to Apple HIG names (text styles, SF Symbols, materials). - Android only → use
dp/sp, map to Material 3 names (md.sys.*). - Cross-platform → use
pt/dp(equivalent at 1x) and add an iOS / Android column wherever the platforms differ.
2. Convert screenshot pixels to points
Screenshots are at device scale. Divide pixel measurements by the scale factor before writing any value.
| Screenshot width (px) | Device class | Logical width | Scale |
|---|---|---|---|
| 750 | iPhone SE | 375pt | @2x |
| 1170 / 1179 | iPhone 13–16 | 390 / 393pt | @3x |
| 1206 | iPhone 16 Pro | 402pt | @3x |
| 1284 / 1290 | iPhone Plus / Pro Max | 428 / 430pt | @3x |
| 1320 | iPhone 16 Pro Max | 440pt | @3x |
| 1080 | Typical Android phone | ~411dp (420dpi) or 360dp (480dpi) | ~2.625–3x |
| 1440 | High-density Android | ~411dp | 3.5x |
Round to the nearest value on the detected spacing grid (usually 4 or 8). Report hex colors as sampled; if a screenshot looks compressed or color-shifted, note "(approx.)".
3. Infer motion when it isn't shown
Static references rarely show motion. Derive it from, in order:
- Explicit sources: Lottie JSON (
fr= frame rate,op − ip= frames → duration; keyframeo/ihandles = bezier easing), Figma prototype settings (Smart Animate easing + duration), code (withAnimation,.spring(…),animate*AsState,withSpring,Curves.*), motion spec PDFs. - Platform defaults for the detected platform (see design-motion.md spec below).
- Brand personality: playful/consumer → bouncier springs (damping 0.6–0.75), overshoot on success; calm/premium → critically damped springs, longer fades; utility/enterprise → short, no bounce.
Mark everything derived this way "(inferred)".
File Specifications
All four files must open with an H1 and a blockquote cross-referencing the other three files.
design.md — Token Reference
# [System Name] Design System — Token Reference
> Always read this file first. For motion & haptics see [design-motion.md](design-motion.md). For component specs see [design-components.md](design-components.md). For accessibility, gestures and do's/don'ts see [design-guidelines.md](design-guidelines.md).
[1–2 sentence intro: design language, target platforms, primary typeface, base spacing unit, light/dark support, motion personality in one phrase]
Required sections:
Colors
Group by semantic role using H3 subsections (### Brand & Accent, ### Background & Surface, ### Content (Text & Icons), ### Separator & Border, ### Status, ### Overlay & Scrim, ### Gradients). Always give light and dark values. Mobile apps ship both, so infer the missing mode if only one is shown and mark it "(inferred)".
| Role | Light | Dark | Usage |
|---|---|---|---|
| primary | #6442D6 | #CFBCFF | Primary buttons, active tab, links |
| on-primary | #FFFFFF | #381E72 | Text/icons on primary |
| background | #FFFFFF | #000000 | Screen background |
| background-grouped | #F2F2F7 | #000000 | Grouped list / settings background |
| surface | #FFFFFF | #1C1C1E | Cards, sheets, grouped cells |
| surface-elevated | #FFFFFF | #2C2C2E | Sheets/popovers over surface (dark mode lifts) |
| label-primary | #000000 | #FFFFFF | Primary text |
| label-secondary | #3C3C43 @ 60% | #EBEBF5 @ 60% | Secondary text |
| separator | #3C3C43 @ 29% | #545458 @ 60% | Hairline dividers (0.5pt / 1px) |
| scrim | #000000 @ 40% | #000000 @ 60% | Behind sheets and modals |
Include alpha where the system uses translucent labels. For gradients list stops, angle and where each one is used.
Typography
Font family + fallback chain per platform (e.g., "Inter", SF Pro (iOS), Roboto (Android)). Note custom font weights available.
| Style | Size | Weight | Line Height | Tracking | iOS Text Style | Android (M3) |
|---|---|---|---|---|---|---|
| Large Title | 34 | 700 | 41 | 0.4 | .largeTitle | Display Small |
| Title 1 | 28 | 700 | 34 | 0.38 | .title | Headline Medium |
| Headline | 17 | 600 | 22 | -0.43 | .headline | Title Medium |
| Body | 17 | 400 | 22 | -0.43 | .body | Body Large |
| Caption | 12 | 400 | 16 | 0 | .caption | Label Small |
Units: pt (iOS) / sp (Android). List every level found (Display, Title, Headline, Body, Callout, Subheadline, Footnote, Caption, Label, or equivalent), plus a Numerals row if the design uses tabular/monospaced digits (prices, timers, stats).
Add a Dynamic Type / Font Scaling subsection: which styles scale, max scale (iOS up to AX5, Android up to 200%), which styles are capped (tab bar labels, badges), and how layouts reflow (stack horizontally → vertically, truncation vs wrapping).
Spacing
Base unit and scale.
| Token | Value | Usage |
|---|---|---|
| space-1 | 4 | Icon-to-label gap |
| space-4 | 16 | Screen horizontal margin, card padding |
| space-6 | 24 | Section spacing |
Also give: screen margins (compact phone / large phone / tablet), list row insets, section header spacing, and inter-component gaps.
Shape
| Token | Radius | Components |
|---|---|---|
| xs | 4 | Badges, tags |
| sm | 8 | Text fields, small buttons |
| md | 12 | Cards, list groups |
| lg | 20 | Bottom sheets (top corners), large cards |
| full | 50% | Pills, avatars, FAB |
State whether corners are continuous (squircle) (iOS .continuous, Figma corner smoothing ~60%) or circular. Note concentric radius rules (inner radius = outer radius − padding).
Elevation & Materials
| Level | iOS Shadow | Android Elevation | Tonal Overlay (dark) | Usage |
|---|---|---|---|---|
| 0 | none | 0dp | 0% | Base surface |
| 1 | y 1, blur 3, #000 @ 10% | 1dp | 5% | Cards |
| 3 | y 8, blur 24, #000 @ 15% | 6dp | 11% | Sheets, menus, FAB |
Shadows as x, y, blur, spread, color @ opacity (+ React Native shadow* / elevation equivalents if cross-platform). Add a Materials / Blur table if translucency is used: material name, blur radius, tint, opacity, where used (tab bars, nav bars, sheets, overlays), and the solid fallback for Reduce Transparency.
Opacity & Interaction States
| State | Treatment | Notes |
|---|---|---|
| Enabled | 100% | Resting |
| Pressed | 8–12% state layer / ripple (Android); opacity 0.7 or scale 0.97 (iOS) | Show within 1 frame of touch-down |
| Focused | 2–3pt focus ring, primary color | Hardware keyboard / switch control |
| Selected | Fill or checkmark, + selected accessibility trait | |
| Disabled | 38% content, 12% container | Not focusable by touch |
| Dragged | 16% state layer + elevation raise | Reorder, drag & drop |
Layout
| Class | Width | Columns | Margins | Navigation |
|---|---|---|---|---|
| Compact phone | < 400 | 4 | 16 | Tab bar / bottom nav |
| Large phone | 400–599 | 4 | 20 | Tab bar / bottom nav |
| Tablet / foldable (medium) | 600–839 | 8 | 24 | Nav rail or sidebar |
| Tablet (expanded) | ≥ 840 | 12 | 24–32 | Sidebar / split view |
Plus a System UI table: status bar height, nav bar height (44pt iOS inline / 96pt large title; 64dp Android top app bar), tab bar (49pt + home indicator 34pt; 80dp M3 nav bar), keyboard handling, safe area rules, edge-to-edge behavior (Android 15+), orientation support, Dynamic Island / cutout avoidance.
Icons
Icon set (SF Symbols, Material Symbols, custom), style (outlined/filled/rounded), weight/stroke, sizes (e.g., 16/20/24/28), grid and padding, filled vs outlined usage (e.g., filled = selected tab). App icon specs if shown.
Imagery & Illustration
Aspect ratios, corner radii, placeholder/loading treatment, overlay gradients for text-on-image, illustration style. Omit if not detectable.
Design Tokens
Naming convention (e.g., color.background.primary, md.sys.color.primary) and a platform mapping table:
| Token | SwiftUI | Jetpack Compose | React Native / Flutter |
|---|---|---|---|
| color.primary | Color.brandPrimary | MaterialTheme.colorScheme.primary | theme.colors.primary |
| type.body | .font(.body) | MaterialTheme.typography.bodyLarge | theme.typography.body |
design-motion.md — Motion, Animation & Haptics
# [System Name] Motion — Animation, Transitions & Haptics
> See [design.md](design.md) for tokens. See [design-components.md](design-components.md) for component specs. See [design-guidelines.md](design-guidelines.md) for accessibility (including Reduce Motion).
[1–2 sentence motion personality: e.g., "Responsive and physical — springs with light bounce for direct manipulation, quick fades for system feedback."]
Required sections:
Motion Principles
3–5 principles specific to this system (e.g., "Follow the finger", "Interruptible always", "Motion explains hierarchy").
Easing
| Token | cubic-bezier | iOS | Android / Compose | Usage |
|---|---|---|---|---|
| standard | 0.2, 0, 0, 1 | .timingCurve(0.2, 0, 0, 1) | CubicBezierEasing(0.2f, 0f, 0f, 1f) | On-screen movement |
| decelerate | 0, 0, 0, 1 | .easeOut (approx.) | EaseOut / emphasized decelerate | Entering elements |
| accelerate | 0.3, 0, 1, 1 | .easeIn (approx.) | EaseIn / emphasized accelerate | Exiting elements |
| linear | 0, 0, 1, 1 | .linear | LinearEasing | Progress, shimmer, rotation |
Duration
| Token | ms | Usage |
|---|---|---|
| instant | 100 | Press feedback, color change |
| short | 150–200 | Small toggles, fades, icon swaps |
| medium | 250–350 | Component expand, sheet, push |
| long | 400–500 | Full-screen, shared element |
| extra-long | 600–1000 | Onboarding, celebration (non-blocking only) |
Exits are faster than entrances (~70–80% of enter duration).
Springs
Prefer springs for anything gesture-driven or interruptible. Document every spring with all platform equivalents. Conversion (mass = 1): ω = 2π / response, stiffness = ω², damping = 2 · dampingRatio · ω.
| Token | Response (s) | Damping Ratio | SwiftUI | Compose | Reanimated / Flutter | Usage |
|---|---|---|---|---|---|---|
| spring-snappy | 0.35 | 0.85 | .spring(response: 0.35, dampingFraction: 0.85) | spring(0.85f, 322f) | {stiffness: 322, damping: 30.5} | Toggles, chips, small moves |
| spring-smooth | 0.5 | 1.0 | .smooth | spring(1f, 158f) | {stiffness: 158, damping: 25.1} | Sheets, layout changes |
| spring-bouncy | 0.5 | 0.7 | .bouncy | spring(0.7f, 158f) | {stiffness: 158, damping: 17.6} | Success, playful moments |
Transitions
Screen- and container-level transitions. For each, describe the choreography (what moves, fades, scales, in what order).
| Transition | Trigger | Choreography | Easing / Spring | Duration | Platform Notes |
|---|---|---|---|---|---|
| Push | Drill into detail | New screen slides in from trailing edge; previous moves 30% with dim | iOS default / M3 shared axis X | 350ms | Interactive edge-swipe back on iOS; predictive back on Android |
| Modal / Sheet | Create, compose | Slides up from bottom, scrim fades to 40% | spring-smooth | ~400ms | Swipe down to dismiss; detents |
| Tab switch | Tab tap | Crossfade content, no slide | standard | 150ms | Preserve scroll position per tab |
| Shared element / Hero | Thumbnail → detail | Image morphs bounds + corner radius, rest fades through | spring-smooth | 400–500ms | matchedGeometryEffect / SharedTransitionLayout |
| Fade through | Unrelated content swap | Out 90ms, in 210ms with 0.92→1 scale | standard | 300ms |
Micro-interactions
| Element | Trigger | Animation | Timing | Haptic |
|---|---|---|---|---|
| Button | Press | Scale 0.97 + opacity 0.85, release springs back | instant / spring-snappy | none or light |
| Switch | Toggle | Thumb slides, track color crossfades | spring-snappy | selection |
| Like / Favorite | Tap | Icon scales 1 → 1.25 → 1, fill, optional particles | spring-bouncy | light impact |
| Pull to refresh | Drag past threshold | Indicator follows finger with resistance, then spins | linear loop | light impact at threshold |
| Swipe action | Swipe row | Action reveals proportionally, snaps at threshold | spring-snappy | medium impact at commit |
| Error | Invalid submit | Horizontal shake 3 × 6pt | 300ms | error notification |
Cover every interactive component found in the references.
Gesture-Driven Motion
Rules for direct manipulation: follow the finger 1:1, rubber-banding at bounds (resistance factor), velocity hand-off into the release spring, commit thresholds (distance % and fling velocity), interruptibility (a new touch grabs the in-flight animation), snap points / detents.
Scroll-Linked Effects
Collapsing / large-title headers, sticky headers, parallax ratios, fade-on-scroll toolbars, scroll-edge appearance changes (blur/separator appears when content scrolls under the bar), pagination snapping.
Loading & Progress Motion
Skeleton shimmer (direction, duration, gradient), spinners (rotation period), determinate progress (easing between values), optimistic UI, content reveal (stagger: delay per item, max items staggered).
Illustrative Animation (Lottie / Rive)
Where used (onboarding, empty states, success), frame rate, duration, loop behavior, size, file budget, static fallback frame. Omit if not detectable.
Haptics
| Event | iOS | Android | Notes |
|---|---|---|---|
| Selection change (picker, segmented, toggle) | UISelectionFeedbackGenerator / .sensoryFeedback(.selection) | CLOCK_TICK / TOGGLE_ON/OFF (API 34+) | |
| Success | .notificationOccurred(.success) | CONFIRM | |
| Warning / Error | .warning / .error | REJECT | |
| Light impact (snap, threshold) | UIImpactFeedbackGenerator(.light) | CONTEXT_CLICK | |
| Long press / context menu | .medium impact | LONG_PRESS |
Rule: haptics accompany a visual change and never fire on scroll or more often than every ~100ms.
Reduced Motion
For each motion category, the Reduce Motion (iOS) / Remove animations (Android) replacement: slides → crossfades, parallax off, springs → short eased fades, autoplay off, looping animations paused on a static frame.
Performance
Target frame rate (60 / 120Hz ProMotion), animate only transform and opacity where possible, no layout thrash during transitions, budget for simultaneous animations, offload to native/UI thread (Reanimated worklets, Compose graphicsLayer).
design-guidelines.md — Accessibility, Gestures, Platform Conventions & Do's/Don'ts
# [System Name] Guidelines — Accessibility, Gestures & Do's/Don'ts
> See [design.md](design.md) for token values. See [design-motion.md](design-motion.md) for motion & haptics. See [design-components.md](design-components.md) for component specs.
Required sections:
Accessibility
- Contrast Requirements: Table Requirement | Ratio (4.5:1 body text, 3:1 large text ≥ 18pt regular / 14pt bold, 3:1 UI components & icons), then Component | 3:1 Against. Check both light and dark mode, and text on images/gradients.
- Touch Targets: 44×44pt (iOS) / 48×48dp (Android) minimum, 8pt spacing between targets, how small visual elements (icons, close buttons, chips) extend their hit area.
- Dynamic Type / Font Scaling: Behavior at largest sizes, truncation rules, layouts that switch from horizontal to vertical, which elements are exempt.
- Screen Readers (VoiceOver / TalkBack): Table Element | Label | Trait/Role | Hint. Cover grouping (cells read as one element), reading/focus order, custom actions (swipe actions exposed as actions), live regions/announcements for toasts and errors, decorative images hidden, focus moves on screen change.
- System Settings: Reduce Motion, Reduce Transparency, Increase Contrast / high-contrast text, Bold Text, Smart Invert, Differentiate Without Color, and what changes in the UI for each.
- Other Input: Hardware keyboard (Tab/Arrow/Return/Escape/⌘ shortcuts on iPad), Switch Control / Switch Access, Voice Control (visible label must match accessible name).
Gestures
| Gesture | Use | Conflicts / Notes |
|---|---|---|
| Tap | Primary activation | |
| Double tap | Like / zoom | Always provide a visible alternative |
| Long press | Context menu, reorder, preview | Haptic on recognition |
| Swipe (horizontal on row) | Row actions (delete, archive) | Expose as accessibility actions |
| Edge swipe | Back navigation (iOS), back (Android gesture nav) | Never override system edge gestures |
| Swipe down on sheet | Dismiss | Confirm if unsaved changes |
| Pull down on list | Refresh | |
| Drag | Reorder, sliders, sheets | |
| Pinch / Rotate | Zoom media, maps | Provide buttons as alternative |
Every gesture-only action needs a visible or accessible alternative.
Platform Conventions
Table Convention | iOS | Android | This System. Cover: back navigation, primary action placement, top bar title alignment, tab bar vs navigation bar, alerts vs dialogs, action sheets vs bottom sheets/menus, date/time pickers, toggles, search placement, share, settings deep links, system fonts. State where the system deliberately diverges from platform norms and why.
Content Design
Tone of voice, capitalization (Title Case on iOS buttons/titles vs sentence case on Android — state this system's choice), button label length, truncation rules for small screens, number/date/currency formatting, error message structure (what happened + how to fix), empty state copy, permission request copy, push notification copy.
Do's and Don'ts
Organize by category with H3 subsections: Color, Typography, Shape, Elevation, Layout & Safe Areas, Interaction, Motion, Haptics, Gestures, Platform, Components.
Format:
- Do use one primary button per screen for the main action
- Don't place interactive elements under the home indicator or in the status bar area
design-components.md — Component Specs & Screen Patterns
# [System Name] Components
> Full specifications for all [N] components and [M] screen patterns. Grouped by workflow.
> For tokens see [design.md](design.md). For motion & haptics see [design-motion.md](design-motion.md). For rules & accessibility see [design-guidelines.md](design-guidelines.md).
Find ALL components detectable from the provided references. Do not limit to a fixed list.
Organize by workflow category using H2 headings:
-
Actions
-
Input
-
Navigation
-
Containment
-
Data Display
-
Feedback
-
Screen Patterns
Each component as an H3 section:
### Button
**Types:** Filled (primary) > Tonal (secondary) > Outlined > Text (tertiary) > Destructive.
**Sizes:** Large 56pt (full-width CTA) · Medium 44pt · Small 32pt (target extended to 44pt).
Label: Headline 17/600. Radius: full. Horizontal padding: 20pt. Icon: 20pt, 8pt gap.
| Property | Value |
|---|---|
| Anatomy | Container, label, optional leading icon, optional loading spinner |
| Contrast | 4.5:1 label, 3:1 container vs background (outlined border) |
| States | Rest, Pressed, Focused, Disabled, Loading |
| Touch target | 44×44pt / 48×48dp min |
| Motion | Press: scale 0.97 + opacity 0.85 (instant); release: spring-snappy; loading: label crossfades to spinner (short) |
| Haptic | None (light impact for destructive confirm) |
| Accessibility | Role button; loading announces "Loading"; disabled keeps label readable |
| iOS / Android | iOS: Title Case, no ripple. Android: sentence case, ripple state layer |
**Do:** Use full-width large buttons for the primary screen action, pinned above the keyboard / safe area.
**Don't:** Stack more than two filled buttons; use vague labels like "OK" for destructive actions.
---
Every component must include Motion and Haptic rows (write "None" if none), plus iOS / Android differences when the target is cross-platform.
Typical components to cover:
- Actions: Button, Icon Button, FAB / Extended FAB, Segmented Control / Segmented Button, Bottom Toolbar, Context Menu, Action Sheet, Swipe Actions, Share Button
- Input: Text Field, Search Field, Secure Field, OTP / Code Input, Checkbox, Radio, Switch / Toggle, Slider, Stepper, Wheel Picker, Date & Time Picker, Dropdown / Menu Select, Filter Chips, Rating
- Navigation: Navigation Bar (inline & large title), Tab Bar / Bottom Navigation, Navigation Rail / Sidebar (tablet), Drawer, Top Tabs, Page Control / Dots, Back Button, Search Bar
- Containment: Card, List & Cells (plain / grouped / inset grouped), Section Header, Bottom Sheet (with detents), Modal / Full-Screen Cover, Alert / Dialog, Popover, Tooltip, Disclosure / Accordion, Divider, Carousel / Pager
- Data Display: Avatar (+ group / stack), Badge, Tag / Chip, Image / Media, Icon, Stat / Metric, Chart, Timeline, Story Ring, Skeleton
- Feedback: Progress Bar, Circular Progress, Activity Indicator, Pull to Refresh, Toast / Snackbar, Banner, In-App Notification, Empty State, Error State, Offline Indicator
Screen Patterns
Document recurring screen-level patterns detectable in the references. Each as an H3 with this table:
### Onboarding
| Aspect | Spec |
|---|---|
| Structure | 3 pages, illustration (top 55%), title + body, page dots, primary CTA pinned bottom, Skip top-right |
| Components | Pager, Page Control, Button (large), Text Button |
| Motion | Page swipe follows finger, illustration parallax 0.5×, CTA label crossfades on last page |
| Haptic | Selection on page change |
| Rules | Skippable; ≤ 3 pages; ask for permissions in context, not here |
---
Typical patterns: Launch / Splash, Onboarding, Sign In / Sign Up, Permission Priming, Home / Feed, List → Detail, Search & Results, Filters, Forms & Keyboard Handling, Settings, Profile, Checkout / Paywall, Empty / Error / Offline States, Notifications Inbox, Media Viewer.
General Rules
- Be specific: measurements in pt/dp/sp (never raw screenshot pixels), hex colors for both light and dark, shadow and spring values per platform
- If a value cannot be determined from references, make a reasonable inference based on the design language and target platform conventions and note it with "(inferred)"
- Every animated behavior must give easing (cubic-bezier) or spring (response + damping ratio), plus duration
- Respect platform conventions by default; document any deliberate divergence
- Use tables over prose; keep everything scannable
- Aim for 200–500 lines per file
- Each file must cross-reference the other three in its opening blockquote
- Separate components and patterns with horizontal rules (
---) - Use consistent markdown formatting throughout
Workflow
- Gather all reference materials from the user (read files, fetch URLs)
- Determine target platform(s) and the screenshot scale factor
- Analyze the design language: colors (light/dark), typography, spacing grid, shapes, elevation/materials, component inventory, screen patterns, and any motion sources
- Infer motion and haptics where references are static, matching platform defaults and brand personality
- Generate all 4 files
- Write each file to the specified directory
- Summarize what was generated: system name, platforms, token count, spring/easing count, component count, pattern count, and the main values marked "(inferred)" that the user should verify