Communitygithub.com

reference-design-system

Generate a complete mobile app design system (design.md, design-motion.md, design-guidelines.md, design-components.md) from any reference materials — app screenshots, mockups, PDFs, links, descriptions, or existing iOS/Android/React Native/Flutter code. Covers tokens, light/dark themes, Dynamic Type, safe areas, animations, springs, transitions, haptics, gestures, platform conventions, components and screen patterns.

reference-design-system 是什么?

reference-design-system is a Claude Code agent skill that generate a complete mobile app design system (design.md, design-motion.md, design-guidelines.md, design-components.md) from any reference materials — app screenshots, mockups, PDFs, links, descriptions, or existing iOS/Android/React Native/Flutter code. Covers tokens, light/dark themes, Dynamic Type, safe areas, animations, springs, transitions, haptics, gestures, platform conventions, components and screen patterns.

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/adrianmanea/reference-design-system-skill/tree/HEAD

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

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, Flutter ThemeData, 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):

  1. design.md — Token Reference (color, type, spacing, shape, elevation, layout, icons)
  2. design-motion.md — Motion, Animation & Haptics
  3. design-guidelines.md — Accessibility, Gestures, Platform Conventions & Do's/Don'ts
  4. 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.

SignaliOSAndroid
Status barClock left, Dynamic Island / notch centeredClock left, icons right, punch-hole camera
BottomHome indicator bar, tab bar with labelsGesture pill or 3-button nav, navigation bar with active indicator pill
TypefaceSF Pro / New YorkRoboto / Google Sans / Product font
Top barLarge title that collapses, centered inline titleLeft-aligned title, top app bar
ControlsSegmented control, iOS switch, wheel picker, action sheetM3 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 classLogical widthScale
750iPhone SE375pt@2x
1170 / 1179iPhone 13–16390 / 393pt@3x
1206iPhone 16 Pro402pt@3x
1284 / 1290iPhone Plus / Pro Max428 / 430pt@3x
1320iPhone 16 Pro Max440pt@3x
1080Typical Android phone~411dp (420dpi) or 360dp (480dpi)~2.625–3x
1440High-density Android~411dp3.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:

  1. Explicit sources: Lottie JSON (fr = frame rate, op − ip = frames → duration; keyframe o/i handles = bezier easing), Figma prototype settings (Smart Animate easing + duration), code (withAnimation, .spring(…), animate*AsState, withSpring, Curves.*), motion spec PDFs.
  2. Platform defaults for the detected platform (see design-motion.md spec below).
  3. 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)".

RoleLightDarkUsage
primary#6442D6#CFBCFFPrimary buttons, active tab, links
on-primary#FFFFFF#381E72Text/icons on primary
background#FFFFFF#000000Screen background
background-grouped#F2F2F7#000000Grouped list / settings background
surface#FFFFFF#1C1C1ECards, sheets, grouped cells
surface-elevated#FFFFFF#2C2C2ESheets/popovers over surface (dark mode lifts)
label-primary#000000#FFFFFFPrimary 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.

StyleSizeWeightLine HeightTrackingiOS Text StyleAndroid (M3)
Large Title34700410.4.largeTitleDisplay Small
Title 128700340.38.titleHeadline Medium
Headline1760022-0.43.headlineTitle Medium
Body1740022-0.43.bodyBody Large
Caption12400160.captionLabel 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.

TokenValueUsage
space-14Icon-to-label gap
space-416Screen horizontal margin, card padding
space-624Section spacing

Also give: screen margins (compact phone / large phone / tablet), list row insets, section header spacing, and inter-component gaps.

Shape

TokenRadiusComponents
xs4Badges, tags
sm8Text fields, small buttons
md12Cards, list groups
lg20Bottom sheets (top corners), large cards
full50%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

LeveliOS ShadowAndroid ElevationTonal Overlay (dark)Usage
0none0dp0%Base surface
1y 1, blur 3, #000 @ 10%1dp5%Cards
3y 8, blur 24, #000 @ 15%6dp11%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

StateTreatmentNotes
Enabled100%Resting
Pressed8–12% state layer / ripple (Android); opacity 0.7 or scale 0.97 (iOS)Show within 1 frame of touch-down
Focused2–3pt focus ring, primary colorHardware keyboard / switch control
SelectedFill or checkmark, + selected accessibility trait
Disabled38% content, 12% containerNot focusable by touch
Dragged16% state layer + elevation raiseReorder, drag & drop

Layout

ClassWidthColumnsMarginsNavigation
Compact phone< 400416Tab bar / bottom nav
Large phone400–599420Tab bar / bottom nav
Tablet / foldable (medium)600–839824Nav rail or sidebar
Tablet (expanded)≥ 8401224–32Sidebar / 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:

TokenSwiftUIJetpack ComposeReact Native / Flutter
color.primaryColor.brandPrimaryMaterialTheme.colorScheme.primarytheme.colors.primary
type.body.font(.body)MaterialTheme.typography.bodyLargetheme.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

Tokencubic-bezieriOSAndroid / ComposeUsage
standard0.2, 0, 0, 1.timingCurve(0.2, 0, 0, 1)CubicBezierEasing(0.2f, 0f, 0f, 1f)On-screen movement
decelerate0, 0, 0, 1.easeOut (approx.)EaseOut / emphasized decelerateEntering elements
accelerate0.3, 0, 1, 1.easeIn (approx.)EaseIn / emphasized accelerateExiting elements
linear0, 0, 1, 1.linearLinearEasingProgress, shimmer, rotation

Duration

TokenmsUsage
instant100Press feedback, color change
short150–200Small toggles, fades, icon swaps
medium250–350Component expand, sheet, push
long400–500Full-screen, shared element
extra-long600–1000Onboarding, 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 · ω.

TokenResponse (s)Damping RatioSwiftUIComposeReanimated / FlutterUsage
spring-snappy0.350.85.spring(response: 0.35, dampingFraction: 0.85)spring(0.85f, 322f){stiffness: 322, damping: 30.5}Toggles, chips, small moves
spring-smooth0.51.0.smoothspring(1f, 158f){stiffness: 158, damping: 25.1}Sheets, layout changes
spring-bouncy0.50.7.bouncyspring(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).

TransitionTriggerChoreographyEasing / SpringDurationPlatform Notes
PushDrill into detailNew screen slides in from trailing edge; previous moves 30% with dimiOS default / M3 shared axis X350msInteractive edge-swipe back on iOS; predictive back on Android
Modal / SheetCreate, composeSlides up from bottom, scrim fades to 40%spring-smooth~400msSwipe down to dismiss; detents
Tab switchTab tapCrossfade content, no slidestandard150msPreserve scroll position per tab
Shared element / HeroThumbnail → detailImage morphs bounds + corner radius, rest fades throughspring-smooth400–500msmatchedGeometryEffect / SharedTransitionLayout
Fade throughUnrelated content swapOut 90ms, in 210ms with 0.92→1 scalestandard300ms

Micro-interactions

ElementTriggerAnimationTimingHaptic
ButtonPressScale 0.97 + opacity 0.85, release springs backinstant / spring-snappynone or light
SwitchToggleThumb slides, track color crossfadesspring-snappyselection
Like / FavoriteTapIcon scales 1 → 1.25 → 1, fill, optional particlesspring-bouncylight impact
Pull to refreshDrag past thresholdIndicator follows finger with resistance, then spinslinear looplight impact at threshold
Swipe actionSwipe rowAction reveals proportionally, snaps at thresholdspring-snappymedium impact at commit
ErrorInvalid submitHorizontal shake 3 × 6pt300mserror 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

EventiOSAndroidNotes
Selection change (picker, segmented, toggle)UISelectionFeedbackGenerator / .sensoryFeedback(.selection)CLOCK_TICK / TOGGLE_ON/OFF (API 34+)
Success.notificationOccurred(.success)CONFIRM
Warning / Error.warning / .errorREJECT
Light impact (snap, threshold)UIImpactFeedbackGenerator(.light)CONTEXT_CLICK
Long press / context menu.medium impactLONG_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

GestureUseConflicts / Notes
TapPrimary activation
Double tapLike / zoomAlways provide a visible alternative
Long pressContext menu, reorder, previewHaptic on recognition
Swipe (horizontal on row)Row actions (delete, archive)Expose as accessibility actions
Edge swipeBack navigation (iOS), back (Android gesture nav)Never override system edge gestures
Swipe down on sheetDismissConfirm if unsaved changes
Pull down on listRefresh
DragReorder, sliders, sheets
Pinch / RotateZoom media, mapsProvide 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

  1. Gather all reference materials from the user (read files, fetch URLs)
  2. Determine target platform(s) and the screenshot scale factor
  3. Analyze the design language: colors (light/dark), typography, spacing grid, shapes, elevation/materials, component inventory, screen patterns, and any motion sources
  4. Infer motion and haptics where references are static, matching platform defaults and brand personality
  5. Generate all 4 files
  6. Write each file to the specified directory
  7. 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

相关技能