/hotwire-native:hotwire-nativefrom hotwire-native
Use when building iOS or Android apps with Hotwire Native around a Turbo web app — the server side (path configuration JSON, telling native requests apart by user agent, recede/refresh/resume redirects, modals, page titles), bridge components (the Stimulus web half and the Swift/Kotlin half), native screens, and pointing the apps at a local or deployed Void server.
Ships in hotwire-native. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Hotwire Native apps are thin iOS (Swift) and Android (Kotlin) shells. They show the Turbo web app in web views and give it native navigation: each visit is a native screen on a stack, and modals, tabs and the top bar are native. The web app stays the product. The server adds a few small things for the apps, and the apps add native pieces only where the web is not enough. Read the page before changing that part:
basic-navigation, path-configuration,
bridge-components, native-screens)/reference/path-configuration,
/reference/bridge-components, /reference/bridge-installation…/path-configuration, …/bridge-components,
…/native-screens, …/configuration)https://raw.githubusercontent.com/hotwired/hotwire-native-site/main/_source/reference/navigation.md
(and the other files under _source/{overview,reference,ios,android}/)Versions: hotwire-native-ios 1.3, hotwire-native-android 1.4, and @hotwired/hotwire-native-bridge 1.2
for the web.
| Concern | Server side | In the example (src/turbo.tsx, src/app.tsx) |
|---|---|---|
| Telling the apps apart | Their user agent contains Hotwire Native (legacy apps: Turbo Native), then iOS or Android, then bridge-components: [button form …] | isNative(c): /(Turbo|Hotwire) Native/ |
| The top bar | The apps title each screen with the page's <title> and draw their own back button. Leave out the web navbar when isNative(c) | Layout renders no <nav> for the apps |
| Navigation rules | Path configuration JSON at a versioned URL per platform: /configurations/ios_v1.json, /configurations/android_v1.json. Keep old versions served for old app builds; a breaking change is a new _v2 file | public/configurations/*.json |
| Closing a modal or going back after a form | Redirect to /recede_historical_location (pop the screen or dismiss the modal), /refresh_historical_location (pop or dismiss, then reload the screen below) or /resume_historical_location (dismiss and do nothing more). The apps (1.2+) act on the redirect and never show the page. A browser gets the ordinary redirect. The three paths answer with a few words of HTML (turbo-rails: "Going back…"): Turbo follows a form's redirect only to HTML, so an empty or text/plain answer leaves the modal open | refreshOrRedirect(c, "/"), and the three paths answer c.html("Refreshing…") and so on |
| Forms that open as a modal | A page of its own (/messages/new), with the path rule "/new$" set to "context": "modal". After it, redirect (never stream) | NewMessage, the standalone field |
{
"settings": {},
"rules": [
{ "patterns": [".*"], "properties": { "context": "default", "pull_to_refresh_enabled": true } },
{ "patterns": ["/new$", "/edit$"], "properties": { "context": "modal", "pull_to_refresh_enabled": false } }
]
}
context is default or modal. presentation is default, push, pop, replace, replace_root,
clear_all, refresh or none. The navigation reference has a table of what each combination does in
each state.uri on every rule: "hotwire://fragment/web" for web screens (with "context": "modal", a full-screen modal, as on iOS), "hotwire://fragment/web/modal/sheet" for a bottom sheet, or
the uri of a native destination (@HotwireDestinationDeepLink). A bottom sheet leaves the page behind it
on screen and in the accessibility tree, so its fields need labels of their own, and UI tests can reach
the page behind. iOS has view_controller (native screens), and modal_style
(large, medium, full, page_sheet, form_sheet).settings is free-form app configuration, such as feature flags, that the apps read.Hotwire.loadPathConfiguration(from: [.file(local), .server(remote)]) on iOS, and
Hotwire.loadPathConfiguration(context, PathConfiguration.Location(assetFilePath = …, remoteFileUrl = …))
on Android. A change on the server reaches apps that are already installed.A bridge component is a Stimulus controller on the web and a class with the same name in each app. The web
half says what it has (send("connect", data, callback)), and the native half draws it natively and replies
when it is used.
// src/controllers/bridge/button_controller.ts → data-controller="bridge--button"
import { BridgeComponent } from "@hotwired/hotwire-native-bridge";
export default class extends BridgeComponent<HTMLElement> {
static component = "button";
connect() {
super.connect();
const title = this.bridgeElement.bridgeAttribute("title");
this.send("connect", { title }, () => this.element.click());
}
}
<a href="/messages/new" data-controller="bridge--button" data-bridge-title="New">New message</a>
static component must equal the native component's name (override class var name: String { "button" } in Swift, BridgeComponentFactory("button", ::ButtonComponent) in Kotlin). Each app registers
its components: Hotwire.registerBridgeComponents([ButtonComponent.self]) on iOS, and
Hotwire.registerBridgeComponents(BridgeComponentFactory("button", ::ButtonComponent)) on Android.controllers/bridge/. They register as bridge--name.this.enabled is
false), and the element stays as it is: a working link, button or form.<html data-bridge-components="button …">, so:
[data-bridge-components~="button"] [data-controller~="bridge--button"] { display: none; }.data-bridge-title, data-bridge-disabled (true, ios, android) and any data-bridge-* are read
through this.bridgeElement. Use data-controller-optout-ios and data-controller-optout-android to turn
a component off on one platform.src/hotwire-native-bridge.d.ts.example/native/ has both apps as text,
built and run by mise tasks (the app's own example/mise.toml pins Node, Java 21, XcodeGen, Maestro and
Android's command-line tools, so an app copied from the example has them too):
| Command | Does |
|---|---|
mise install, mise run setup | The tools; then npm packages, Chromium, the https certificate (mkcert), the iOS simulator, the Android SDK packages and the hotwire emulator |
mise run dev:workspace | The dev server, the web app's own window, the emulator and the simulator (Device Hub) with the apps, tiled. Builds an app only when its native files changed (a fingerprint per device). A server-code change morphs every open page, apps included (hotwireRefresh in vite.config.ts); mise run reload:apps after a path configuration change |
mise run ios / mise run android | Start the dev server if needed, build (xcodegen generate + xcodebuild; ./gradlew installDebug), install, launch. HOTWIRE_URL=… for a deployed server |
mise run flows:ios [flow] / mise run flows:android [flow] | The fast loop: the flows (or one, send-message) on the app already running; no build. flows:watch:ios [flow] runs again on every save (maestro test --continuous) |
mise run test:ios / mise run test:android | The same, then the Maestro flows in native/flows/ (one set for both apps, appId: ${APP_ID}, passed with maestro test -e APP_ID=…) |
xcrun simctl keychain <udid> add-root-cert, Android debug builds through res/raw/dev_ca.pem and
network_security_config.xml.native/ios/project.yml (XcodeGen; no Xcode project kept), the address is the HOTWIRE_URL build setting
read from Info.plist, and the bundled path configuration is
public/configurations/ios_v1.json itself (a resource in project.yml).native/android/ (Gradle, wrapper kept), the address is -Photwire.url (a BuildConfig field), Hotwire.registerFragmentDestinations(HotwireWebFragment::class, HotwireWebBottomSheetFragment::class), and the assets directory is the server's public/.-e or a MAESTRO_ prefix.
Start each flow with extendedWaitUntil on the first screen (a cold CI device is slow), and wait for a
form's button before using it (Android's web view fills its accessibility tree after the page). Tap the
submit button rather than pressing Enter, which Android can deliver to the page under a closing modal.
The --test runs serve the production build (vp build + vp preview on 4173), not the dev server.native/ (server.watch.ignored in vite.config.ts; @source not "../native" for
Tailwind), or every native build reloads the apps' pages.Navigator(configuration: .init(name: "main", startLocation: rootURL)) on iOS,
and NavigatorConfiguration(name = "main", startLocation = …, navigatorHostId = …) in a HotwireActivity
on Android) is the deployed URL that void deploy prints, or the dev server.https://localhost:5173, the Android emulator at
https://10.0.2.2:5173 (the Mac's 127.0.0.1: the dev server listens there, not only on ::1). A phone on the
network needs vp dev --host and the computer's address. Android 1.4 opens only the start location's
origin in the app; other origins open in a browser tab unless trusted (Android "Origin Trust").curl -A 'Hotwire Native iOS; bridge-components: [button];' localhost:5173/.isNative(c) only for what the apps draw themselves (the navbar,
an install banner), never for content.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub joeblew999/hotwire-skills --plugin hotwire-native