From knowledge-base
Drive Web-first to Tauri v2 migration with contract-first architecture, dual transport adapters, fail-fast runtime checks, and loop-based quality gates. Use when user mentions Tauri migration, dev:tauri crash, ECONNREFUSED, invoke/HTTP fallback, TDD strategy, e2e setup, or ralph loop workflows.
How this skill is triggered — by the user, by Claude, or both
Slash command
/knowledge-base:web-to-tauri-migration-loopThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
<role>
gsd:workflow
gsd:meta
web-to-tauri-migration-loop
incremental-loop
</gsd:meta>
gsd:goalShip migrated features with no silent HTTP fallback in Tauri runtime and with passing build/test gates.</gsd:goal>
<gsd:phase id="1" name="contract-and-command">Define API contract first, scaffold Rust command, and register handler before UI wiring.</gsd:phase>
<gsd:phase id="2" name="adapter-and-guard">Integrate domain client with dual transport and enforce fail-fast runtime guard in Tauri mode.</gsd:phase>
<gsd:phase id="3" name="tests-and-gates">Run layered tests and mandatory gates (cargo check + web build) before marking loop complete.</gsd:phase>
</gsd:workflow>
Use this skill to migrate a Web-first app to Tauri v2 without "last-mile explosion".
pnpm dev:tauri starts but app crashes or hangs/api works in web mode but fails in Tauri (ECONNREFUSED)Do not migrate at the end in one shot. Ship each feature in a dual-path incremental loop:
Frontend pages must never call transport directly.
UI layer: React pages/componentsDomain API layer: stable methods like listSkills(), linkSkill()Transport layer:
tauriTransport -> invoke(...)webTransport -> HTTP clientRuntime selection: one adapter entrypoint decides transport onceRust command layer: #[tauri::command] functions registered in generate_handler!Mandatory rule:
Copy this checklist each loop iteration:
Loop Progress
- [ ] L1 Contract defined (request/response/error)
- [ ] L2 Rust command exists and registered
- [ ] L3 Frontend domain API wired to adapter
- [ ] L4 Tauri runtime uses invoke path only (no silent HTTP fallback)
- [ ] L5 Unit tests added (TS + Rust as needed)
- [ ] L6 Smoke e2e for critical path passed
- [ ] L7 Build gates passed (cargo check + web build)
- [ ] L8 Docs/changelog updated for real behavior
If any gate fails, do not mark loop complete.
For each feature, write:
Keep TypeScript and Rust names aligned (recommend camelCase on JSON boundary).
Before UI usage:
tauri::generate_handler![...]Result<T, String> or serializable app error)Implement in domain API client:
if tauri => invokeelse => HTTPNever call invoke or fetch directly in pages.
In Tauri runtime:
/apiThis prevents hidden regressions and random ECONNREFUSED.
Use this test pyramid:
Do not start with full e2e matrix. Start with 2-3 smoke cases.
Always run:
cargo check --manifest-path src-tauri/Cargo.toml
pnpm --filter <web-package-name> build
And verify:
/api/* requests when running inside Tauri for migrated featuresUse this prompt in automation loops:
Apply web-to-tauri-migration-loop for feature: <feature-name>.
Follow L1-L8 gates strictly.
Constraints:
1) Contract first, then Rust command, then adapter, then UI.
2) In Tauri runtime, forbid silent HTTP fallback.
3) Add tests at contract layer and command layer before e2e.
4) Run cargo check and web build; report exact failures if any.
Output:
- Changed files
- Gate checklist status
- Remaining risks
Use the scaffold script to generate feature skeletons for Web + Tauri + tests:
npx web-to-tauri-migration-loop-scaffold --feature <feature-name>
Optional:
npx web-to-tauri-migration-loop-scaffold \
--feature <feature-name> \
--web-root packages/web/src \
--tauri-root src-tauri/src \
--dry-run
The script creates:
packages/web/src/features/<feature>/api/contract.tspackages/web/src/features/<feature>/api/transport.tauri.tspackages/web/src/features/<feature>/api/transport.http.tspackages/web/src/features/<feature>/api/client.tspackages/web/src/features/<feature>/api/__tests__/runtime-selection.test.tssrc-tauri/src/commands/<feature>.rssrc-tauri/tests/<feature>_smoke.rse2e/<feature>.tauri-smoke.spec.tsAfter scaffolding, manually:
generate_handler![]A feature is done only when:
ECONNREFUSED /api/... in Tauri:
Command not found:
generate_handler!npx claudepluginhub wangjs-jacky/jacky-skills --plugin knowledge-baseDevelops Tauri v2+ cross-platform desktop/mobile apps with Rust backend, configuring tauri.conf.json, #[tauri::command] handlers, IPC (invoke/emit/channels), capabilities/permissions, and troubleshooting builds.
Provides Tauri 2.5.0 knowledge for migration, configuration, IPC, security, plugins, mobile, and distribution tasks. Loads reference docs for window/webview, runtime, and capability management.
Configures Tauri v2 to package web frontends as native Android, Windows, macOS, and Linux apps. Handles builds, permissions, and native features like notifications and file system.