Harness design mobile

From Intense-Visions/harness-engineering · View interactive version

Harness design mobile is an AI agent skill from the GitHub repository Intense-Visions/harness-engineering. > 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

How to use this skill

Skill file

Harness 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

Process

Phase 1: SCAFFOLD — Read Tokens, Detect Platform, Plan Structure

  1. Read design tokens. Load design-system/tokens.json (W3C DTCG format). Extract:
  1. Read design intent. Load design-system/DESIGN.md for:
  1. Check harness configuration. Read harness.config.json for:
  1. Detect mobile platform. Scan the project for:
  1. Load platform-specific rules. Based on detected platform, read platform design guidelines from agents/skills/shared/design-knowledge/platform-rules/:
  1. Load anti-pattern definitions. Read anti-pattern files from agents/skills/shared/design-knowledge/anti-patterns/:
  1. Build token-to-platform mapping. Create a lookup table mapping tokens to platform-native representations:
  1. Plan component structure. Define:

Phase 2: IMPLEMENT — Generate Token-Bound Mobile Components

  1. Generate platform-specific component code. Based on detected platform:

React Native (TypeScript):

SwiftUI:

Flutter (Dart):

Compose (Kotlin):

  1. Apply platform-specific rules:
  1. 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

  1. Scan for hardcoded values. Search generated files for:
  1. Verify token coverage. For every design value in generated components:
  1. Check platform guideline compliance:
  1. Check anti-pattern compliance. Cross-reference against design-system/DESIGN.md anti-patterns and definitions in agents/skills/shared/design-knowledge/anti-patterns/.
  1. Query the knowledge graph. If available at .harness/graph/:
  1. Assign severity based on designStrictness:
  1. 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))

```

  1. Run harness validate. Confirm new components integrate cleanly.

Harness Integration

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

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 error 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 ios.yaml and android.yaml 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 — shadowColor, shadowOffset, etc. Those aren't design tokens, they're platform APIs." | Shadow colors must still reference token values. shadowColor: tokens.color.neutral[900] is the correct form. Hardcoded shadow values like #000 or rgba(0,0,0,0.2) are token binding violations the VERIFY phase will flag. |

| "There's no design-system/DESIGN.md yet, but I know the aesthetic intent from our planning discussion — I'll proceed with tokens only." | Proceeding without DESIGN.md 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

Escalation

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.