| name | h5-to-swiftui |
| version | 1.0.0 |
| description | Convert an H5 / web app's source into a native SwiftUI iOS app by native rewrite (NOT a WebView shell, NOT a transpiler). Use when the user wants to port, re-implement, or migrate a web/H5 frontend to native SwiftUI with high visual fidelity, asks to "turn this web app into a real iOS app", or wants a measured render-diff convergence loop against a browser baseline. Auto-detects the web stack (v1: vanilla + React; other stacks are detected then gated, not guessed), extracts design tokens, calibrates a cross-renderer fidelity floor, rewrites per component, and drives a bounded render→diff→correct loop that reports a quantified visual residual plus an independent judge verdict. It does NOT promise literal pixel-identity: cross-renderer differences impose a measured floor it reports honestly. Triages canvas/WebGL/complex-animation/3rd-party-SDK/backend surfaces instead of silently emitting wrong code. |
| argument-hint | <path-to-h5-source> [--ios-floor 17] [--device 'iPhone 15 Pro'] [--max-iter 3] |
| disable-model-invocation | false |
| user-invocable | true |
| allowed-tools | ["read","grep","glob","bash","edit","task"] |
| model | glm-5.2 |
H5 → Native SwiftUI (perceptually-convergent, residual-quantified)
Convert a web/H5 app to a native SwiftUI iOS app by reading the source and
re-implementing UI + logic in idiomatic SwiftUI. This is a native rewrite,
not a WebView wrapper and not a mechanical transpiler — those cannot
reach native fidelity (see references/stack-detection.md for why).
Honest promise (read this first)
Literal pixel-identity is physically unreachable for any text-bearing
screen: H5 renders in WebKit/Skia, SwiftUI in CoreText/Core Animation;
per-glyph subpixel/hinting and sRGB-vs-Display-P3 differences impose a
non-zero residual even when the SwiftUI is perfectly correct. This skill
therefore does not claim "pixel-perfect". It:
- measures the achievable cross-renderer floor for the current toolchain
(Stage 2.5 calibration),
- drives a render→diff→correct loop that strictly reduces visual delta
toward that measured floor,
- stops with a quantified residual, an independent adversarial judge
verdict, and a tiered outcome:
converged / close / needs-human,
- triages anything it cannot safely convert — never silently emits
plausible-wrong code.
Never describe output as "pixel-accurate/perfect" in any report.
When to use / not use
Use for: porting a web/H5 frontend to native SwiftUI; "make this a real iOS
app (not a webview)"; measured visual migration. Not for: building a webview
wrapper (decline — out of scope); generic SwiftUI feature work (use normal
dev flow); design-mock→code with no source app (different problem).
Inputs
<path-to-h5-source> (required)
--ios-floor (default 17; changes API availability + risk tiers)
--device (default iPhone 15 Pro; sets logical viewport + safe-area)
--max-iter (default 3; Stage 5 per-component iteration cap)
--thresholds (optional override; default = calibrated, not asserted)
Environment reality (hard gate)
Stage 5 needs macOS + Xcode + iOS Simulator. If absent OR the generated
project fails to build, the affected component is needs-human/
and is . The skill must not fabricate
convergence. Stages 0–4 + triage still run and produce value.