@harness-engineering/cli 1.6.1 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/personas/planner.yaml +27 -0
- package/dist/agents/personas/verifier.yaml +30 -0
- package/dist/agents/skills/claude-code/enforce-architecture/SKILL.md +19 -0
- package/dist/agents/skills/claude-code/harness-accessibility/SKILL.md +274 -0
- package/dist/agents/skills/claude-code/harness-accessibility/skill.yaml +51 -0
- package/dist/agents/skills/claude-code/harness-autopilot/SKILL.md +111 -72
- package/dist/agents/skills/claude-code/harness-autopilot/skill.yaml +4 -2
- package/dist/agents/skills/claude-code/harness-dependency-health/skill.yaml +1 -1
- package/dist/agents/skills/claude-code/harness-design/SKILL.md +265 -0
- package/dist/agents/skills/claude-code/harness-design/skill.yaml +53 -0
- package/dist/agents/skills/claude-code/harness-design-mobile/SKILL.md +336 -0
- package/dist/agents/skills/claude-code/harness-design-mobile/skill.yaml +49 -0
- package/dist/agents/skills/claude-code/harness-design-system/SKILL.md +282 -0
- package/dist/agents/skills/claude-code/harness-design-system/skill.yaml +50 -0
- package/dist/agents/skills/claude-code/harness-design-web/SKILL.md +360 -0
- package/dist/agents/skills/claude-code/harness-design-web/skill.yaml +52 -0
- package/dist/agents/skills/claude-code/harness-hotspot-detector/skill.yaml +1 -1
- package/dist/agents/skills/claude-code/harness-impact-analysis/SKILL.md +16 -0
- package/dist/agents/skills/claude-code/harness-integrity/SKILL.md +19 -1
- package/dist/agents/skills/claude-code/harness-knowledge-mapper/skill.yaml +1 -1
- package/dist/agents/skills/claude-code/harness-onboarding/SKILL.md +19 -1
- package/dist/agents/skills/claude-code/harness-release-readiness/SKILL.md +13 -9
- package/dist/agents/skills/claude-code/harness-security-scan/skill.yaml +1 -1
- package/dist/agents/skills/claude-code/harness-verify/SKILL.md +26 -0
- package/dist/agents/skills/gemini-cli/harness-accessibility/SKILL.md +274 -0
- package/dist/agents/skills/gemini-cli/harness-accessibility/skill.yaml +51 -0
- package/dist/agents/skills/gemini-cli/harness-autopilot/SKILL.md +111 -72
- package/dist/agents/skills/gemini-cli/harness-autopilot/skill.yaml +4 -2
- package/dist/agents/skills/gemini-cli/harness-dependency-health/skill.yaml +1 -1
- package/dist/agents/skills/gemini-cli/harness-design/SKILL.md +265 -0
- package/dist/agents/skills/gemini-cli/harness-design/skill.yaml +53 -0
- package/dist/agents/skills/gemini-cli/harness-design-mobile/SKILL.md +336 -0
- package/dist/agents/skills/gemini-cli/harness-design-mobile/skill.yaml +49 -0
- package/dist/agents/skills/gemini-cli/harness-design-system/SKILL.md +282 -0
- package/dist/agents/skills/gemini-cli/harness-design-system/skill.yaml +50 -0
- package/dist/agents/skills/gemini-cli/harness-design-web/SKILL.md +360 -0
- package/dist/agents/skills/gemini-cli/harness-design-web/skill.yaml +52 -0
- package/dist/agents/skills/gemini-cli/harness-hotspot-detector/skill.yaml +1 -1
- package/dist/agents/skills/gemini-cli/harness-impact-analysis/SKILL.md +16 -0
- package/dist/agents/skills/gemini-cli/harness-knowledge-mapper/skill.yaml +1 -1
- package/dist/agents/skills/gemini-cli/harness-release-readiness/SKILL.md +13 -9
- package/dist/agents/skills/gemini-cli/harness-security-scan/skill.yaml +1 -1
- package/dist/agents/skills/node_modules/.bin/vitest +2 -2
- package/dist/agents/skills/shared/design-knowledge/anti-patterns/color.yaml +106 -0
- package/dist/agents/skills/shared/design-knowledge/anti-patterns/layout.yaml +109 -0
- package/dist/agents/skills/shared/design-knowledge/anti-patterns/motion.yaml +109 -0
- package/dist/agents/skills/shared/design-knowledge/anti-patterns/typography.yaml +112 -0
- package/dist/agents/skills/shared/design-knowledge/industries/creative.yaml +80 -0
- package/dist/agents/skills/shared/design-knowledge/industries/ecommerce.yaml +80 -0
- package/dist/agents/skills/shared/design-knowledge/industries/emerging-tech.yaml +83 -0
- package/dist/agents/skills/shared/design-knowledge/industries/fintech.yaml +80 -0
- package/dist/agents/skills/shared/design-knowledge/industries/healthcare.yaml +80 -0
- package/dist/agents/skills/shared/design-knowledge/industries/lifestyle.yaml +80 -0
- package/dist/agents/skills/shared/design-knowledge/industries/saas.yaml +80 -0
- package/dist/agents/skills/shared/design-knowledge/industries/services.yaml +80 -0
- package/dist/agents/skills/shared/design-knowledge/palettes/curated.yaml +234 -0
- package/dist/agents/skills/shared/design-knowledge/platform-rules/android.yaml +125 -0
- package/dist/agents/skills/shared/design-knowledge/platform-rules/flutter.yaml +144 -0
- package/dist/agents/skills/shared/design-knowledge/platform-rules/ios.yaml +106 -0
- package/dist/agents/skills/shared/design-knowledge/platform-rules/web.yaml +102 -0
- package/dist/agents/skills/shared/design-knowledge/typography/pairings.yaml +274 -0
- package/dist/bin/harness.js +3 -2
- package/dist/{chunk-3U5VZYR7.js → chunk-4WUGOJQ7.js} +6 -3
- package/dist/{chunk-O6NEKDYP.js → chunk-FFIX3QVG.js} +697 -349
- package/dist/chunk-GA6GN5J2.js +6150 -0
- package/dist/dist-C4J67MPP.js +242 -0
- package/dist/dist-N4D4QWFV.js +2809 -0
- package/dist/index.d.ts +79 -0
- package/dist/index.js +3 -2
- package/dist/validate-cross-check-WGXQ7K62.js +7 -0
- package/package.json +12 -8
- package/dist/validate-cross-check-LNIZ7KGZ.js +0 -6
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
name: harness-design
|
|
2
|
+
version: "1.0.0"
|
|
3
|
+
description: Aesthetic direction workflow, anti-pattern enforcement, DESIGN.md generation, and strictness configuration
|
|
4
|
+
cognitive_mode: advisory-guide
|
|
5
|
+
triggers:
|
|
6
|
+
- manual
|
|
7
|
+
- on_new_feature
|
|
8
|
+
platforms:
|
|
9
|
+
- claude-code
|
|
10
|
+
- gemini-cli
|
|
11
|
+
tools:
|
|
12
|
+
- Bash
|
|
13
|
+
- Read
|
|
14
|
+
- Write
|
|
15
|
+
- Edit
|
|
16
|
+
- Glob
|
|
17
|
+
- Grep
|
|
18
|
+
cli:
|
|
19
|
+
command: harness skill run harness-design
|
|
20
|
+
args:
|
|
21
|
+
- name: path
|
|
22
|
+
description: Project root path
|
|
23
|
+
required: false
|
|
24
|
+
- name: strictness
|
|
25
|
+
description: Override strictness level (strict, standard, permissive)
|
|
26
|
+
required: false
|
|
27
|
+
- name: industry
|
|
28
|
+
description: Industry vertical for aesthetic recommendations
|
|
29
|
+
required: false
|
|
30
|
+
mcp:
|
|
31
|
+
tool: run_skill
|
|
32
|
+
input:
|
|
33
|
+
skill: harness-design
|
|
34
|
+
path: string
|
|
35
|
+
type: flexible
|
|
36
|
+
phases:
|
|
37
|
+
- name: intent
|
|
38
|
+
description: Capture aesthetic intent, style, tone, and differentiator
|
|
39
|
+
required: true
|
|
40
|
+
- name: direction
|
|
41
|
+
description: Generate DESIGN.md with aesthetic direction, anti-patterns, and platform notes
|
|
42
|
+
required: true
|
|
43
|
+
- name: review
|
|
44
|
+
description: Review existing components against design intent and anti-patterns
|
|
45
|
+
required: false
|
|
46
|
+
- name: enforce
|
|
47
|
+
description: Enforce design constraints via graph, surface violations by strictness level
|
|
48
|
+
required: false
|
|
49
|
+
state:
|
|
50
|
+
persistent: false
|
|
51
|
+
files: []
|
|
52
|
+
depends_on:
|
|
53
|
+
- harness-design-system
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
# Harness Design Mobile
|
|
2
|
+
|
|
3
|
+
> 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.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- Generating new mobile components that must conform to the project's design system tokens
|
|
8
|
+
- When `on_new_feature` triggers fire with mobile UI scope requiring token-bound component generation
|
|
9
|
+
- When `on_commit` triggers fire and new mobile components contain hardcoded design values that should reference tokens
|
|
10
|
+
- Implementing design intent from `design-system/DESIGN.md` into platform-native styling (StyleSheet, SwiftUI modifiers, Flutter ThemeData, Compose MaterialTheme)
|
|
11
|
+
- Ensuring components follow platform-specific guidelines (iOS Human Interface Guidelines, Material Design 3, Flutter design patterns)
|
|
12
|
+
- NOT for generating design tokens themselves (use harness-design-system)
|
|
13
|
+
- NOT for establishing aesthetic direction or anti-patterns (use harness-design)
|
|
14
|
+
- NOT for accessibility auditing (use harness-accessibility)
|
|
15
|
+
- NOT for web platform components (use harness-design-web)
|
|
16
|
+
|
|
17
|
+
## Process
|
|
18
|
+
|
|
19
|
+
### Phase 1: SCAFFOLD — Read Tokens, Detect Platform, Plan Structure
|
|
20
|
+
|
|
21
|
+
1. **Read design tokens.** Load `design-system/tokens.json` (W3C DTCG format). Extract:
|
|
22
|
+
- Color tokens: primary, secondary, accent, neutral ramps, semantic colors
|
|
23
|
+
- Typography tokens: heading and body font families, font weights, font sizes, line heights
|
|
24
|
+
- Spacing tokens: spacing scale values
|
|
25
|
+
- If `design-system/tokens.json` does not exist, stop and instruct the user to run `harness-design-system` first.
|
|
26
|
+
|
|
27
|
+
2. **Read design intent.** Load `design-system/DESIGN.md` for:
|
|
28
|
+
- Aesthetic direction (style, tone, differentiator)
|
|
29
|
+
- Anti-patterns to avoid
|
|
30
|
+
- Platform-specific mobile notes (touch targets, native component usage, platform conventions)
|
|
31
|
+
- If `design-system/DESIGN.md` does not exist, warn the user and proceed with tokens only.
|
|
32
|
+
|
|
33
|
+
3. **Check harness configuration.** Read `harness.config.json` for:
|
|
34
|
+
- `design.strictness` — enforcement level. Default to `standard`.
|
|
35
|
+
- `design.platforms` — confirm `mobile` is in the platforms list.
|
|
36
|
+
|
|
37
|
+
4. **Detect mobile platform.** Scan the project for:
|
|
38
|
+
- **React Native:** `package.json` contains `react-native` or `expo`, `.tsx` files with `StyleSheet` or `react-native` imports
|
|
39
|
+
- **SwiftUI:** `.swift` files with `import SwiftUI`, `Package.swift` or `.xcodeproj` exists
|
|
40
|
+
- **Flutter:** `pubspec.yaml` exists, `.dart` files with `import 'package:flutter/`
|
|
41
|
+
- **Compose:** `build.gradle.kts` with `compose` dependencies, `.kt` files with `@Composable`
|
|
42
|
+
- If the user specified `--platform`, use that override.
|
|
43
|
+
|
|
44
|
+
5. **Load platform-specific rules.** Based on detected platform, read platform design guidelines from `agents/skills/shared/design-knowledge/platform-rules/`:
|
|
45
|
+
- **iOS (SwiftUI/React Native on iOS):** Read `ios.yaml` — Human Interface Guidelines, safe area insets, navigation bar patterns, tab bar conventions, dynamic type support, SF Symbols integration
|
|
46
|
+
- **Android (Compose/React Native on Android):** Read `android.yaml` — Material Design 3, elevation system, shape system, dynamic color, navigation patterns, edge-to-edge layout
|
|
47
|
+
- **Flutter:** Read `flutter.yaml` — Flutter design patterns, ThemeData structure, widget composition, adaptive layouts, platform channel considerations
|
|
48
|
+
- **React Native cross-platform:** Read both `ios.yaml` and `android.yaml` — platform-specific overrides via `Platform.select`, safe area handling, navigation library patterns
|
|
49
|
+
|
|
50
|
+
6. **Load anti-pattern definitions.** Read anti-pattern files from `agents/skills/shared/design-knowledge/anti-patterns/`:
|
|
51
|
+
- `typography.yaml` — typographic anti-patterns (too many fonts, inconsistent scales)
|
|
52
|
+
- `color.yaml` — color anti-patterns (hardcoded hex, insufficient contrast)
|
|
53
|
+
- `layout.yaml` — layout anti-patterns (magic numbers, inconsistent spacing)
|
|
54
|
+
- `motion.yaml` — motion anti-patterns (excessive animation, missing reduced-motion)
|
|
55
|
+
|
|
56
|
+
7. **Build token-to-platform mapping.** Create a lookup table mapping tokens to platform-native representations:
|
|
57
|
+
- **React Native:** `color.primary.500` maps to `StyleSheet` value or themed constant
|
|
58
|
+
- **SwiftUI:** `color.primary.500` maps to `Color("primary500")` in asset catalog or `Color(hex:)` extension
|
|
59
|
+
- **Flutter:** `color.primary.500` maps to `Theme.of(context).colorScheme.primary` or custom `AppColors.primary500`
|
|
60
|
+
- **Compose:** `color.primary.500` maps to `MaterialTheme.colorScheme.primary` or custom `AppTheme.colors.primary500`
|
|
61
|
+
|
|
62
|
+
8. **Plan component structure.** Define:
|
|
63
|
+
- Component file path(s) following platform conventions
|
|
64
|
+
- Props/parameters interface
|
|
65
|
+
- Which tokens will be consumed
|
|
66
|
+
- Platform-specific considerations (safe areas, touch targets, dynamic type)
|
|
67
|
+
- Present plan to user before proceeding.
|
|
68
|
+
|
|
69
|
+
### Phase 2: IMPLEMENT — Generate Token-Bound Mobile Components
|
|
70
|
+
|
|
71
|
+
1. **Generate platform-specific component code.** Based on detected platform:
|
|
72
|
+
|
|
73
|
+
**React Native (TypeScript):**
|
|
74
|
+
- Functional component with TypeScript props interface
|
|
75
|
+
- All colors via themed StyleSheet or token constants (no hardcoded hex values)
|
|
76
|
+
- Typography via scaled text styles referencing token font families and sizes
|
|
77
|
+
- Spacing via token-derived constants in StyleSheet
|
|
78
|
+
- Platform-specific overrides via `Platform.select` where iOS and Android differ
|
|
79
|
+
- Safe area handling via `useSafeAreaInsets` for edge-to-edge content
|
|
80
|
+
|
|
81
|
+
**SwiftUI:**
|
|
82
|
+
- View struct with typed properties
|
|
83
|
+
- Colors from asset catalog or Color extension referencing tokens
|
|
84
|
+
- Typography via custom `Font` extensions mapping to token values
|
|
85
|
+
- Spacing via token-derived constants
|
|
86
|
+
- Dynamic Type support via `.font(.body)` or custom scaled fonts
|
|
87
|
+
- Safe area respect via `.safeAreaInset` modifiers
|
|
88
|
+
- iOS Human Interface Guidelines compliance (44pt minimum touch targets)
|
|
89
|
+
|
|
90
|
+
**Flutter (Dart):**
|
|
91
|
+
- StatelessWidget or StatefulWidget with typed constructor parameters
|
|
92
|
+
- Colors via `Theme.of(context)` or custom `AppColors` class referencing tokens
|
|
93
|
+
- Typography via `Theme.of(context).textTheme` or custom `AppTypography`
|
|
94
|
+
- Spacing via token-derived constants class
|
|
95
|
+
- Material Design 3 compliance (elevation, shape, dynamic color)
|
|
96
|
+
- Adaptive layout via `LayoutBuilder` or `MediaQuery` for responsive behavior
|
|
97
|
+
|
|
98
|
+
**Compose (Kotlin):**
|
|
99
|
+
- `@Composable` function with typed parameters
|
|
100
|
+
- Colors via `MaterialTheme.colorScheme` or custom theme referencing tokens
|
|
101
|
+
- Typography via `MaterialTheme.typography` or custom type scale
|
|
102
|
+
- Spacing via token-derived `Dp` constants
|
|
103
|
+
- Material Design 3 compliance (Surface, ElevatedCard, shape system)
|
|
104
|
+
- Modifier chains for layout following Compose conventions
|
|
105
|
+
|
|
106
|
+
2. **Apply platform-specific rules:**
|
|
107
|
+
- **Touch targets:** Minimum 44x44pt (iOS) or 48x48dp (Android/Material)
|
|
108
|
+
- **Safe areas:** All platforms handle notch/status bar/navigation bar correctly
|
|
109
|
+
- **Typography scaling:** Support dynamic type (iOS), font scale (Android), and text scale factor (Flutter)
|
|
110
|
+
- **Elevation/shadows:** Platform-appropriate (iOS shadow, Material elevation, Flutter elevation)
|
|
111
|
+
- **Navigation patterns:** Platform-native navigation (UINavigationController, NavHost, Navigator)
|
|
112
|
+
|
|
113
|
+
3. **Add USES_TOKEN annotations.** Insert platform-appropriate comments documenting token consumption:
|
|
114
|
+
```
|
|
115
|
+
// @design-token color.primary.500 — primary action background
|
|
116
|
+
// @design-token typography.heading.fontFamily — section heading
|
|
117
|
+
// @design-token spacing.md — card internal padding
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Phase 3: VERIFY — Check Token Binding and Platform Compliance
|
|
121
|
+
|
|
122
|
+
1. **Scan for hardcoded values.** Search generated files for:
|
|
123
|
+
- Hardcoded color values: hex codes, `UIColor(red:green:blue:)`, `Color(0xFF...)`, `Color(red:green:blue:)`
|
|
124
|
+
- Hardcoded font families: string literals for font names not referencing tokens
|
|
125
|
+
- Hardcoded spacing: raw numeric values in padding/margin not from the token scale
|
|
126
|
+
|
|
127
|
+
2. **Verify token coverage.** For every design value in generated components:
|
|
128
|
+
- Confirm it resolves to a token in `design-system/tokens.json`
|
|
129
|
+
- Confirm the token path is valid
|
|
130
|
+
- Report orphan references
|
|
131
|
+
|
|
132
|
+
3. **Check platform guideline compliance:**
|
|
133
|
+
- **iOS:** Touch targets >= 44pt, safe area respected, dynamic type supported
|
|
134
|
+
- **Android/Material:** Touch targets >= 48dp, edge-to-edge layout, Material 3 components used
|
|
135
|
+
- **Flutter:** ThemeData used consistently, no hardcoded Material values
|
|
136
|
+
- **React Native:** Platform.select used for iOS/Android differences, safe area handled
|
|
137
|
+
|
|
138
|
+
4. **Check anti-pattern compliance.** Cross-reference against `design-system/DESIGN.md` anti-patterns and definitions in `agents/skills/shared/design-knowledge/anti-patterns/`.
|
|
139
|
+
|
|
140
|
+
5. **Query the knowledge graph.** If available at `.harness/graph/`:
|
|
141
|
+
- Verify `DesignToken` nodes exist for all referenced tokens
|
|
142
|
+
- Verify `PLATFORM_BINDING` edges exist for the target mobile platform
|
|
143
|
+
- Check `VIOLATES_DESIGN` edges via `DesignConstraintAdapter`
|
|
144
|
+
|
|
145
|
+
6. **Assign severity based on `designStrictness`:**
|
|
146
|
+
- `permissive` — all findings are `info`
|
|
147
|
+
- `standard` — hardcoded values are `warn`, platform guideline violations are `warn`, accessibility violations are `error`
|
|
148
|
+
- `strict` — hardcoded values are `error` (blocks), platform violations are `warn`, accessibility violations are `error`
|
|
149
|
+
|
|
150
|
+
7. **Report verification results:**
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
MOBILE-001 [warn] Hardcoded color Color(0xFF3B82F6) — should reference token
|
|
154
|
+
File: lib/widgets/action_button.dart:15
|
|
155
|
+
Fix: Use Theme.of(context).colorScheme.primary or AppColors.primary500
|
|
156
|
+
|
|
157
|
+
MOBILE-002 [warn] Touch target 32dp below minimum 48dp (Material Design 3)
|
|
158
|
+
File: lib/widgets/icon_action.dart:22
|
|
159
|
+
Fix: Set minimumSize to Size(48, 48) in ButtonStyle
|
|
160
|
+
|
|
161
|
+
MOBILE-003 [info] Missing dynamic type support
|
|
162
|
+
File: Sources/Views/ProductCard.swift:18
|
|
163
|
+
Fix: Use .font(.body) instead of .font(.system(size: 16))
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
8. **Run `harness validate`.** Confirm new components integrate cleanly.
|
|
167
|
+
|
|
168
|
+
## Harness Integration
|
|
169
|
+
|
|
170
|
+
- **`harness validate`** — Run after generating components to verify project health.
|
|
171
|
+
- **`harness scan`** — Run after component generation to update the knowledge graph with `USES_TOKEN` and `PLATFORM_BINDING` edges.
|
|
172
|
+
- **`DesignIngestor`** (`packages/graph/src/ingest/DesignIngestor.ts`) — Verifies `DesignToken` nodes exist for all tokens referenced by generated components.
|
|
173
|
+
- **`DesignConstraintAdapter`** (`packages/graph/src/constraints/DesignConstraintAdapter.ts`) — Checks for `VIOLATES_DESIGN` edges during VERIFY phase. Reports constraint violations at configured strictness.
|
|
174
|
+
- **`harness-design-system`** — Dependency. Provides `design-system/tokens.json`. If tokens do not exist, instruct user to run harness-design-system first.
|
|
175
|
+
- **`harness-design`** — Dependency. Provides `design-system/DESIGN.md` with aesthetic intent and anti-patterns.
|
|
176
|
+
- **`harness-impact-analysis`** — Traces token changes to affected mobile components via `USES_TOKEN` edges.
|
|
177
|
+
|
|
178
|
+
**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.
|
|
179
|
+
|
|
180
|
+
## Success Criteria
|
|
181
|
+
|
|
182
|
+
- Generated mobile components reference design tokens exclusively — no hardcoded color, font, or spacing values
|
|
183
|
+
- Platform detection correctly identifies React Native, SwiftUI, Flutter, or Compose projects
|
|
184
|
+
- Token-to-platform mapping produces correct output for each mobile platform
|
|
185
|
+
- Platform-specific rules are enforced (touch targets, safe areas, dynamic type, Material 3 compliance)
|
|
186
|
+
- `@design-token` annotations are present for every consumed token
|
|
187
|
+
- Anti-pattern compliance check catches violations from `design-system/DESIGN.md`
|
|
188
|
+
- Verification report uses severity levels matching `design.strictness` configuration
|
|
189
|
+
- `harness validate` passes after component generation
|
|
190
|
+
|
|
191
|
+
## Examples
|
|
192
|
+
|
|
193
|
+
### Example: React Native Card Component
|
|
194
|
+
|
|
195
|
+
**Context:** Fitness app. React Native with Expo. Tokens from harness-design-system. Design intent: expressive, warm tone.
|
|
196
|
+
|
|
197
|
+
**SCAFFOLD output:**
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
Platform detected: React Native (Expo)
|
|
201
|
+
Tokens loaded: 38 tokens from design-system/tokens.json
|
|
202
|
+
Design intent: Expressive, warm (from DESIGN.md)
|
|
203
|
+
Component plan: WorkoutCard with progress indicator
|
|
204
|
+
Token consumption: color.primary.*, color.accent.*, typography.heading, spacing.md/lg
|
|
205
|
+
Platform rules: iOS 44pt touch targets, Android 48dp touch targets, safe area insets
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
**IMPLEMENT output (WorkoutCard.tsx):**
|
|
209
|
+
|
|
210
|
+
```tsx
|
|
211
|
+
// @design-token color.primary.500 — card accent
|
|
212
|
+
// @design-token color.neutral.50 — card background
|
|
213
|
+
// @design-token color.neutral.900 — primary text
|
|
214
|
+
// @design-token typography.heading.fontFamily — workout title
|
|
215
|
+
// @design-token typography.body.fontFamily — workout details
|
|
216
|
+
// @design-token spacing.md — card padding
|
|
217
|
+
// @design-token spacing.sm — content gap
|
|
218
|
+
|
|
219
|
+
import { View, Text, StyleSheet, Platform } from 'react-native';
|
|
220
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
221
|
+
import { tokens } from '@/theme/tokens';
|
|
222
|
+
|
|
223
|
+
interface WorkoutCardProps {
|
|
224
|
+
title: string;
|
|
225
|
+
duration: string;
|
|
226
|
+
progress: number;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export function WorkoutCard({ title, duration, progress }: WorkoutCardProps) {
|
|
230
|
+
return (
|
|
231
|
+
<View style={styles.card}>
|
|
232
|
+
<Text style={styles.title}>{title}</Text>
|
|
233
|
+
<Text style={styles.detail}>{duration}</Text>
|
|
234
|
+
<View style={styles.progressTrack}>
|
|
235
|
+
<View style={[styles.progressFill, { width: `${progress}%` }]} />
|
|
236
|
+
</View>
|
|
237
|
+
</View>
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const styles = StyleSheet.create({
|
|
242
|
+
card: {
|
|
243
|
+
backgroundColor: tokens.color.neutral[50],
|
|
244
|
+
borderRadius: tokens.radius.md,
|
|
245
|
+
padding: tokens.spacing.md,
|
|
246
|
+
gap: tokens.spacing.sm,
|
|
247
|
+
...Platform.select({
|
|
248
|
+
ios: {
|
|
249
|
+
shadowColor: tokens.color.neutral[900],
|
|
250
|
+
shadowOffset: { width: 0, height: 2 },
|
|
251
|
+
shadowOpacity: 0.08,
|
|
252
|
+
shadowRadius: 8,
|
|
253
|
+
},
|
|
254
|
+
android: {
|
|
255
|
+
elevation: 2,
|
|
256
|
+
},
|
|
257
|
+
}),
|
|
258
|
+
},
|
|
259
|
+
title: {
|
|
260
|
+
fontFamily: tokens.typography.heading.fontFamily,
|
|
261
|
+
fontWeight: tokens.typography.heading.fontWeight,
|
|
262
|
+
fontSize: 18,
|
|
263
|
+
color: tokens.color.neutral[900],
|
|
264
|
+
},
|
|
265
|
+
detail: {
|
|
266
|
+
fontFamily: tokens.typography.body.fontFamily,
|
|
267
|
+
fontSize: 14,
|
|
268
|
+
color: tokens.color.neutral[600],
|
|
269
|
+
},
|
|
270
|
+
progressTrack: {
|
|
271
|
+
height: 6,
|
|
272
|
+
backgroundColor: tokens.color.neutral[200],
|
|
273
|
+
borderRadius: 3,
|
|
274
|
+
},
|
|
275
|
+
progressFill: {
|
|
276
|
+
height: 6,
|
|
277
|
+
backgroundColor: tokens.color.primary[500],
|
|
278
|
+
borderRadius: 3,
|
|
279
|
+
},
|
|
280
|
+
});
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Example: SwiftUI List Item
|
|
284
|
+
|
|
285
|
+
**IMPLEMENT output (WorkoutRow.swift):**
|
|
286
|
+
|
|
287
|
+
```swift
|
|
288
|
+
// @design-token color.primary.500 — accent color
|
|
289
|
+
// @design-token color.neutral.900 — primary text
|
|
290
|
+
// @design-token color.neutral.600 — secondary text
|
|
291
|
+
// @design-token typography.heading.fontWeight — title weight
|
|
292
|
+
// @design-token spacing.sm — content spacing
|
|
293
|
+
|
|
294
|
+
import SwiftUI
|
|
295
|
+
|
|
296
|
+
struct WorkoutRow: View {
|
|
297
|
+
let title: String
|
|
298
|
+
let duration: String
|
|
299
|
+
let progress: Double
|
|
300
|
+
|
|
301
|
+
var body: some View {
|
|
302
|
+
VStack(alignment: .leading, spacing: AppSpacing.sm) {
|
|
303
|
+
Text(title)
|
|
304
|
+
.font(.headline)
|
|
305
|
+
.foregroundColor(AppColors.neutral900)
|
|
306
|
+
|
|
307
|
+
Text(duration)
|
|
308
|
+
.font(.subheadline)
|
|
309
|
+
.foregroundColor(AppColors.neutral600)
|
|
310
|
+
|
|
311
|
+
ProgressView(value: progress)
|
|
312
|
+
.tint(AppColors.primary500)
|
|
313
|
+
}
|
|
314
|
+
.padding(AppSpacing.md)
|
|
315
|
+
.accessibilityElement(children: .combine)
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
## Gates
|
|
321
|
+
|
|
322
|
+
- **No component generation without reading tokens from harness-design-system.** The SCAFFOLD phase requires `design-system/tokens.json`. Do not generate components with hardcoded values as a fallback.
|
|
323
|
+
- **No hardcoded design values in generated output.** Every color, font, and spacing value must reference a token.
|
|
324
|
+
- **No platform-specific code without platform detection.** The SCAFFOLD phase must detect or receive the target mobile platform before generating components.
|
|
325
|
+
- **No generation without scaffold plan confirmation.** Present the component plan to the user first.
|
|
326
|
+
- **No iOS components without 44pt minimum touch targets.** Touch target violations are `error` severity regardless of strictness level.
|
|
327
|
+
- **No Android/Material components without 48dp minimum touch targets.** Same as iOS — touch targets are non-negotiable.
|
|
328
|
+
- **No graph mutations without validating node types.** Verify edge types are registered before writing.
|
|
329
|
+
|
|
330
|
+
## Escalation
|
|
331
|
+
|
|
332
|
+
- **When `design-system/tokens.json` does not exist:** Instruct the user: "Design tokens have not been generated. Run `harness-design-system` first, then re-run `harness-design-mobile`."
|
|
333
|
+
- **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.
|
|
334
|
+
- **When tokens are insufficient for the requested component:** Report missing tokens and instruct the user to add them via harness-design-system.
|
|
335
|
+
- **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."
|
|
336
|
+
- **When the knowledge graph is unavailable:** Skip graph operations. Log: "Graph not available — skipping token node verification and PLATFORM_BINDING edge creation. Run `harness scan` later to populate."
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
name: harness-design-mobile
|
|
2
|
+
version: "1.0.0"
|
|
3
|
+
description: Token-bound mobile component generation with React Native, SwiftUI, Flutter, and Compose patterns and platform-specific design rules
|
|
4
|
+
cognitive_mode: meticulous-implementer
|
|
5
|
+
triggers:
|
|
6
|
+
- manual
|
|
7
|
+
- on_new_feature
|
|
8
|
+
- on_commit
|
|
9
|
+
platforms:
|
|
10
|
+
- claude-code
|
|
11
|
+
- gemini-cli
|
|
12
|
+
tools:
|
|
13
|
+
- Bash
|
|
14
|
+
- Read
|
|
15
|
+
- Write
|
|
16
|
+
- Edit
|
|
17
|
+
- Glob
|
|
18
|
+
- Grep
|
|
19
|
+
cli:
|
|
20
|
+
command: harness skill run harness-design-mobile
|
|
21
|
+
args:
|
|
22
|
+
- name: path
|
|
23
|
+
description: Project root path
|
|
24
|
+
required: false
|
|
25
|
+
- name: platform
|
|
26
|
+
description: Target mobile platform (react-native, swiftui, flutter, compose)
|
|
27
|
+
required: false
|
|
28
|
+
mcp:
|
|
29
|
+
tool: run_skill
|
|
30
|
+
input:
|
|
31
|
+
skill: harness-design-mobile
|
|
32
|
+
path: string
|
|
33
|
+
type: rigid
|
|
34
|
+
phases:
|
|
35
|
+
- name: scaffold
|
|
36
|
+
description: Read tokens and design intent, detect mobile platform, plan component structure with platform-specific rules
|
|
37
|
+
required: true
|
|
38
|
+
- name: implement
|
|
39
|
+
description: Generate token-bound components with platform-specific patterns and native conventions
|
|
40
|
+
required: true
|
|
41
|
+
- name: verify
|
|
42
|
+
description: Verify token binding, platform guideline compliance, and design constraints
|
|
43
|
+
required: true
|
|
44
|
+
state:
|
|
45
|
+
persistent: false
|
|
46
|
+
files: []
|
|
47
|
+
depends_on:
|
|
48
|
+
- harness-design-system
|
|
49
|
+
- harness-design
|