git clone https://github.com/Intense-Visions/harness-engineering
T=$(mktemp -d) && git clone --depth=1 https://github.com/Intense-Visions/harness-engineering "$T" && mkdir -p ~/.claude/skills && cp -r "$T/agents/skills/claude-code/harness-design-mobile" ~/.claude/skills/intense-visions-harness-engineering-harness-design-mobile && rm -rf "$T"
agents/skills/claude-code/harness-design-mobile/SKILL.mdHarness Design Mobile
Token-bound mobile component generation. Scaffold from design tokens and aesthetic intent, implement with React Native, SwiftUI, Flutter, or Compose patterns following platform-specific design rules, and verify every value references the token set with native convention compliance.
When to Use
- Generating new mobile components that must conform to the project's design system tokens
- When
triggers fire with mobile UI scope requiring token-bound component generationon_new_feature - When
triggers fire and new mobile components contain hardcoded design values that should reference tokenson_commit - Implementing design intent from
into platform-native styling (StyleSheet, SwiftUI modifiers, Flutter ThemeData, Compose MaterialTheme)design-system/DESIGN.md - Ensuring components follow platform-specific guidelines (iOS Human Interface Guidelines, Material Design 3, Flutter design patterns)
- NOT for generating design tokens themselves (use harness-design-system)
- NOT for establishing aesthetic direction or anti-patterns (use harness-design)
- NOT for accessibility auditing (use harness-accessibility)
- NOT for web platform components (use harness-design-web)
Process
Phase 1: SCAFFOLD — Read Tokens, Detect Platform, Plan Structure
-
Read design tokens. Load
(W3C DTCG format). Extract:design-system/tokens.json- Color tokens: primary, secondary, accent, neutral ramps, semantic colors
- Typography tokens: heading and body font families, font weights, font sizes, line heights
- Spacing tokens: spacing scale values
- If
does not exist, stop and instruct the user to rundesign-system/tokens.json
first.harness-design-system
-
Read design intent. Load
for:design-system/DESIGN.md- Aesthetic direction (style, tone, differentiator)
- Anti-patterns to avoid
- Platform-specific mobile notes (touch targets, native component usage, platform conventions)
- If
does not exist, warn the user and proceed with tokens only.design-system/DESIGN.md
-
Check harness configuration. Read
for:harness.config.json
— enforcement level. Default todesign.strictness
.standard
— confirmdesign.platforms
is in the platforms list.mobile
-
Detect mobile platform. Scan the project for:
- React Native:
containspackage.json
orreact-native
,expo
files with.tsx
orStyleSheet
importsreact-native - SwiftUI:
files with.swift
,import SwiftUI
orPackage.swift
exists.xcodeproj - Flutter:
exists,pubspec.yaml
files with.dartimport 'package:flutter/ - Compose:
withbuild.gradle.kts
dependencies,compose
files with.kt@Composable - If the user specified
, use that override.--platform
- React Native:
-
Load platform-specific rules. Based on detected platform, read platform design guidelines from
:agents/skills/shared/design-knowledge/platform-rules/- iOS (SwiftUI/React Native on iOS): Read
— Human Interface Guidelines, safe area insets, navigation bar patterns, tab bar conventions, dynamic type support, SF Symbols integrationios.yaml - Android (Compose/React Native on Android): Read
— Material Design 3, elevation system, shape system, dynamic color, navigation patterns, edge-to-edge layoutandroid.yaml - Flutter: Read
— Flutter design patterns, ThemeData structure, widget composition, adaptive layouts, platform channel considerationsflutter.yaml - React Native cross-platform: Read both
andios.yaml
— platform-specific overrides viaandroid.yaml
, safe area handling, navigation library patternsPlatform.select
- iOS (SwiftUI/React Native on iOS): Read
-
Load anti-pattern definitions. Read anti-pattern files from
:agents/skills/shared/design-knowledge/anti-patterns/
— typographic anti-patterns (too many fonts, inconsistent scales)typography.yaml
— color anti-patterns (hardcoded hex, insufficient contrast)color.yaml
— layout anti-patterns (magic numbers, inconsistent spacing)layout.yaml
— motion anti-patterns (excessive animation, missing reduced-motion)motion.yaml
-
Build token-to-platform mapping. Create a lookup table mapping tokens to platform-native representations:
- React Native:
maps tocolor.primary.500
value or themed constantStyleSheet - SwiftUI:
maps tocolor.primary.500
in asset catalog orColor("primary500")
extensionColor(hex:) - Flutter:
maps tocolor.primary.500
or customTheme.of(context).colorScheme.primaryAppColors.primary500 - Compose:
maps tocolor.primary.500
or customMaterialTheme.colorScheme.primaryAppTheme.colors.primary500
- React Native:
-
Plan component structure. Define:
- Component file path(s) following platform conventions
- Props/parameters interface
- Which tokens will be consumed
- Platform-specific considerations (safe areas, touch targets, dynamic type)
- Present plan to user before proceeding.
Phase 2: IMPLEMENT — Generate Token-Bound Mobile Components
-
Generate platform-specific component code. Based on detected platform:
React Native (TypeScript):
- Functional component with TypeScript props interface
- All colors via themed StyleSheet or token constants (no hardcoded hex values)
- Typography via scaled text styles referencing token font families and sizes
- Spacing via token-derived constants in StyleSheet
- Platform-specific overrides via
where iOS and Android differPlatform.select - Safe area handling via
for edge-to-edge contentuseSafeAreaInsets
SwiftUI:
- View struct with typed properties
- Colors from asset catalog or Color extension referencing tokens
- Typography via custom
extensions mapping to token valuesFont - Spacing via token-derived constants
- Dynamic Type support via
or custom scaled fonts.font(.body) - Safe area respect via
modifiers.safeAreaInset - iOS Human Interface Guidelines compliance (44pt minimum touch targets)
Flutter (Dart):
- StatelessWidget or StatefulWidget with typed constructor parameters
- Colors via
or customTheme.of(context)
class referencing tokensAppColors - Typography via
or customTheme.of(context).textThemeAppTypography - Spacing via token-derived constants class
- Material Design 3 compliance (elevation, shape, dynamic color)
- Adaptive layout via
orLayoutBuilder
for responsive behaviorMediaQuery
Compose (Kotlin):
function with typed parameters@Composable- Colors via
or custom theme referencing tokensMaterialTheme.colorScheme - Typography via
or custom type scaleMaterialTheme.typography - Spacing via token-derived
constantsDp - Material Design 3 compliance (Surface, ElevatedCard, shape system)
- Modifier chains for layout following Compose conventions
-
Apply platform-specific rules:
- Touch targets: Minimum 44x44pt (iOS) or 48x48dp (Android/Material)
- Safe areas: All platforms handle notch/status bar/navigation bar correctly
- Typography scaling: Support dynamic type (iOS), font scale (Android), and text scale factor (Flutter)
- Elevation/shadows: Platform-appropriate (iOS shadow, Material elevation, Flutter elevation)
- Navigation patterns: Platform-native navigation (UINavigationController, NavHost, Navigator)
-
Add USES_TOKEN annotations. Insert platform-appropriate comments documenting token consumption:
// @design-token color.primary.500 — primary action background // @design-token typography.heading.fontFamily — section heading // @design-token spacing.md — card internal padding
Phase 3: VERIFY — Check Token Binding and Platform Compliance
-
Scan for hardcoded values. Search generated files for:
- Hardcoded color values: hex codes,
,UIColor(red:green:blue:)
,Color(0xFF...)Color(red:green:blue:) - Hardcoded font families: string literals for font names not referencing tokens
- Hardcoded spacing: raw numeric values in padding/margin not from the token scale
- Hardcoded color values: hex codes,
-
Verify token coverage. For every design value in generated components:
- Confirm it resolves to a token in
design-system/tokens.json - Confirm the token path is valid
- Report orphan references
- Confirm it resolves to a token in
-
Check platform guideline compliance:
- iOS: Touch targets >= 44pt, safe area respected, dynamic type supported
- Android/Material: Touch targets >= 48dp, edge-to-edge layout, Material 3 components used
- Flutter: ThemeData used consistently, no hardcoded Material values
- React Native: Platform.select used for iOS/Android differences, safe area handled
-
Check anti-pattern compliance. Cross-reference against
anti-patterns and definitions indesign-system/DESIGN.md
.agents/skills/shared/design-knowledge/anti-patterns/ -
Query the knowledge graph. If available at
:.harness/graph/- Verify
nodes exist for all referenced tokensDesignToken - Verify
edges exist for the target mobile platformPLATFORM_BINDING - Check
edges viaVIOLATES_DESIGNDesignConstraintAdapter
- Verify
-
Assign severity based on
:designStrictness
— all findings arepermissiveinfo
— hardcoded values arestandard
, platform guideline violations arewarn
, accessibility violations arewarnerror
— hardcoded values arestrict
(blocks), platform violations areerror
, accessibility violations arewarnerror
-
Report verification results:
MOBILE-001 [warn] Hardcoded color Color(0xFF3B82F6) — should reference token File: lib/widgets/action_button.dart:15 Fix: Use Theme.of(context).colorScheme.primary or AppColors.primary500 MOBILE-002 [warn] Touch target 32dp below minimum 48dp (Material Design 3) File: lib/widgets/icon_action.dart:22 Fix: Set minimumSize to Size(48, 48) in ButtonStyle MOBILE-003 [info] Missing dynamic type support File: Sources/Views/ProductCard.swift:18 Fix: Use .font(.body) instead of .font(.system(size: 16)) -
Run
. Confirm new components integrate cleanly.harness validate
Harness Integration
— Run after generating components to verify project health.harness validate
— Run after component generation to update the knowledge graph withharness scan
andUSES_TOKEN
edges.PLATFORM_BINDING
(DesignIngestor
) — Verifiespackages/graph/src/ingest/DesignIngestor.ts
nodes exist for all tokens referenced by generated components.DesignToken
(DesignConstraintAdapter
) — Checks forpackages/graph/src/constraints/DesignConstraintAdapter.ts
edges during VERIFY phase. Reports constraint violations at configured strictness.VIOLATES_DESIGN
— Dependency. Providesharness-design-system
. If tokens do not exist, instruct user to run harness-design-system first.design-system/tokens.json
— Dependency. Providesharness-design
with aesthetic intent and anti-patterns.design-system/DESIGN.md
— Traces token changes to affected mobile components viaharness-impact-analysis
edges.USES_TOKEN
Graph naming convention: This skill uses PascalCase for node types (
DesignToken, DesignConstraint) and UPPER_SNAKE for edge types (USES_TOKEN, PLATFORM_BINDING, VIOLATES_DESIGN) as conceptual labels. The graph schema registers these as snake_case identifiers (design_token, design_constraint, uses_token, platform_binding, violates_design). The adapter classes (DesignIngestor, DesignConstraintAdapter) handle the mapping — always use the adapters rather than constructing graph queries with raw type names.
Success Criteria
- Generated mobile components reference design tokens exclusively — no hardcoded color, font, or spacing values
- Platform detection correctly identifies React Native, SwiftUI, Flutter, or Compose projects
- Token-to-platform mapping produces correct output for each mobile platform
- Platform-specific rules are enforced (touch targets, safe areas, dynamic type, Material 3 compliance)
annotations are present for every consumed token@design-token- Anti-pattern compliance check catches violations from
design-system/DESIGN.md - Verification report uses severity levels matching
configurationdesign.strictness
passes after component generationharness validate
Examples
Example: React Native Card Component
Context: Fitness app. React Native with Expo. Tokens from harness-design-system. Design intent: expressive, warm tone.
SCAFFOLD output:
Platform detected: React Native (Expo) Tokens loaded: 38 tokens from design-system/tokens.json Design intent: Expressive, warm (from DESIGN.md) Component plan: WorkoutCard with progress indicator Token consumption: color.primary.*, color.accent.*, typography.heading, spacing.md/lg Platform rules: iOS 44pt touch targets, Android 48dp touch targets, safe area insets
IMPLEMENT output (WorkoutCard.tsx):
// @design-token color.primary.500 — card accent // @design-token color.neutral.50 — card background // @design-token color.neutral.900 — primary text // @design-token typography.heading.fontFamily — workout title // @design-token typography.body.fontFamily — workout details // @design-token spacing.md — card padding // @design-token spacing.sm — content gap import { View, Text, StyleSheet, Platform } from 'react-native'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { tokens } from '@/theme/tokens'; interface WorkoutCardProps { title: string; duration: string; progress: number; } export function WorkoutCard({ title, duration, progress }: WorkoutCardProps) { return ( <View style={styles.card}> <Text style={styles.title}>{title}</Text> <Text style={styles.detail}>{duration}</Text> <View style={styles.progressTrack}> <View style={[styles.progressFill, { width: `${progress}%` }]} /> </View> </View> ); } const styles = StyleSheet.create({ card: { backgroundColor: tokens.color.neutral[50], borderRadius: tokens.radius.md, padding: tokens.spacing.md, gap: tokens.spacing.sm, ...Platform.select({ ios: { shadowColor: tokens.color.neutral[900], shadowOffset: { width: 0, height: 2 }, shadowOpacity: 0.08, shadowRadius: 8, }, android: { elevation: 2, }, }), }, title: { fontFamily: tokens.typography.heading.fontFamily, fontWeight: tokens.typography.heading.fontWeight, fontSize: 18, color: tokens.color.neutral[900], }, detail: { fontFamily: tokens.typography.body.fontFamily, fontSize: 14, color: tokens.color.neutral[600], }, progressTrack: { height: 6, backgroundColor: tokens.color.neutral[200], borderRadius: 3, }, progressFill: { height: 6, backgroundColor: tokens.color.primary[500], borderRadius: 3, }, });
Example: SwiftUI List Item
IMPLEMENT output (WorkoutRow.swift):
// @design-token color.primary.500 — accent color // @design-token color.neutral.900 — primary text // @design-token color.neutral.600 — secondary text // @design-token typography.heading.fontWeight — title weight // @design-token spacing.sm — content spacing import SwiftUI struct WorkoutRow: View { let title: String let duration: String let progress: Double var body: some View { VStack(alignment: .leading, spacing: AppSpacing.sm) { Text(title) .font(.headline) .foregroundColor(AppColors.neutral900) Text(duration) .font(.subheadline) .foregroundColor(AppColors.neutral600) ProgressView(value: progress) .tint(AppColors.primary500) } .padding(AppSpacing.md) .accessibilityElement(children: .combine) } }
Rationalizations to Reject
| Rationalization | Reality |
|---|---|
| "The touch target is 40pt on iOS — that's close to 44pt and the designer approved the comp, so I'll leave it." | The 44pt iOS minimum and 48dp Android minimum are non-negotiable gates, not guidelines. Touch target violations are severity regardless of strictness level. Designer comp approval does not override platform accessibility requirements. |
| "This is a cross-platform React Native component, so I only need to read the generic token mapping — platform-specific rules for iOS and Android are optional." | React Native components require both and rules. Platform-specific rules govern safe areas, elevation, navigation patterns, and touch targets that differ between platforms. Missing either set produces non-compliant native behavior. |
"The component uses a hardcoded shadow for iOS — , , etc. Those aren't design tokens, they're platform APIs." | Shadow colors must still reference token values. is the correct form. Hardcoded shadow values like or are token binding violations the VERIFY phase will flag. |
"There's no yet, but I know the aesthetic intent from our planning discussion — I'll proceed with tokens only." | Proceeding without means anti-pattern enforcement is disabled for the entire VERIFY phase. The anti-pattern check is what catches design intent violations beyond token correctness. Warn the user and recommend running harness-design first. |
| "The scaffold plan is straightforward — a simple card component. I'll skip presenting it to the user and just generate." | The scaffold plan confirmation is when the user can catch incorrect platform assumptions (wrong StyleSheet structure, wrong platform APIs) before any code is written. Mobile components are harder to refactor than web components due to platform-specific branching. |
Gates
- No component generation without reading tokens from harness-design-system. The SCAFFOLD phase requires
. Do not generate components with hardcoded values as a fallback.design-system/tokens.json - No hardcoded design values in generated output. Every color, font, and spacing value must reference a token.
- No platform-specific code without platform detection. The SCAFFOLD phase must detect or receive the target mobile platform before generating components.
- No generation without scaffold plan confirmation. Present the component plan to the user first.
- No iOS components without 44pt minimum touch targets. Touch target violations are
severity regardless of strictness level.error - No Android/Material components without 48dp minimum touch targets. Same as iOS — touch targets are non-negotiable.
- No graph mutations without validating node types. Verify edge types are registered before writing.
Escalation
- When
does not exist: Instruct the user: "Design tokens have not been generated. Rundesign-system/tokens.json
first, then re-runharness-design-system
."harness-design-mobile - When the project targets multiple mobile platforms: Generate for the primary platform first, then offer to generate platform-adapted variants. React Native projects get both iOS and Android considerations in a single pass.
- When tokens are insufficient for the requested component: Report missing tokens and instruct the user to add them via harness-design-system.
- When platform guidelines conflict with design intent: Present the conflict: "Material Design 3 recommends rounded corners for cards, but your design intent declares 'sharp edges only.' Options: (1) Follow platform guidelines for native feel, (2) Override with design intent for brand consistency."
- When the knowledge graph is unavailable: Skip graph operations. Log: "Graph not available — skipping token node verification and PLATFORM_BINDING edge creation. Run
later to populate."harness scan