/skip-app-design:skip-lite-transpilationfrom skip-app-design
Guides Swift-to-Kotlin transpilation for Skip Lite, covering integer overflow, compile errors, and SKIP comment directives. Use when writing Swift code for a transpiled Skip project or debugging Kotlin compile errors.
Ships in skip-app-design. 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.
Read when SKILL.md points to them.
CRITICAL: swift build does NOT validate Kotlin transpilation. You MUST run swift test to catch transpilation errors.
This skill is for Skip Lite (transpiled). If the module's Skip/skip.yml contains mode: 'native', you're in Skip Fuse, not Lite — most of the rules here (integer overflow, Double == Int, Foundation.sqrt, etc.) do not apply. See skip-fuse for the Fuse workflow. The rules below still apply to any #if SKIP block inside a Fuse module (those blocks are transpiled to Kotlin even in Fuse mode).
Swift Int is 64-bit. Kotlin Int is 32-bit (max ~2.1 billion). Intermediate arithmetic silently overflows in Kotlin.
// BAD: silently wrong on Android
let product = a * b // if a * b > 2,147,483,647
// GOOD: use Int64 for large values
let product = Int64(a) * Int64(b)
// BAD — Kotlin compile error
if someDouble == 0 { }
// GOOD
if someDouble == 0.0 { }
// BAD — Kotlin compile error
let x = Foundation.sqrt(2.0)
// GOOD
let x = sqrt(2.0)
// BAD — Kotlin compile error
result.append(someCharacter)
// GOOD
result += String(someCharacter)
The Array.remove(atOffsets:) method that pairs with SwiftUI's .onDelete { offsets in ... } is an extension on RangeReplaceableCollection provided by SwiftUI, not by Foundation. A pure-data module that doesn't import SwiftUI won't have it — the compiler error is No exact matches in call to instance method 'remove'.
// BAD — in a model module that doesn't import SwiftUI
import Foundation
public func remove(at offsets: IndexSet) {
items.remove(atOffsets: offsets) // 'remove' not found
}
// GOOD — expose an Int-array API and let the view convert
public func remove(at indices: [Int]) {
for index in indices.sorted(by: >) where index < items.count {
items.remove(at: index)
}
}
// Caller — SwiftUI is imported here, IndexSet → [Int]
.onDelete { offsets in
viewModel.remove(at: Array(offsets))
}
The sort-descending matters: removing at higher indices first keeps the lower ones valid.
These don't fail the Kotlin build, but the runtime behaviour differs from Swift in ways that bite.
CollectionAnywhere Swift mutates a String in place (s.append(...), s.removeLast(), s += ... on a var), the transpiled Kotlin must produce a new string. And although Skip adds many Collection APIs to String, you cannot pass a String to code expecting Collection<Character> — Kotlin can't add a protocol to an existing type. See references/swift-kotlin-rules.md for the full pattern and replacement examples.
String(describing:) doesn't transpileUse string interpolation instead:
// BAD — Kotlin sees String(describing = value), not a valid constructor
let s = String(describing: someValue)
// GOOD
let s = "\(someValue)"
weak / unowned are silently ignoredSkip uses Kotlin's GC. weak and unowned compile but produce strong references on Kotlin. If you use weak to detect deallocation (weakRef.object == nil as a signal), the check will lie.
deinit becomes Kotlin finalize and may not runIndeterminate timing, may never execute. Don't put critical cleanup (file close, lock release, network disconnect) in deinit — use defer, try/catch, or an explicit close() method the caller invokes.
// BAD
init(_ events: HapticEvent...) { self.events = events }
// GOOD
init(_ events: [HapticEvent]) { self.events = events }
Skip wraps mutable structs in a MutableStruct protocol and inserts .sref() calls automatically to preserve value semantics. You'll see .sref() calls all over your transpiled output; that's normal.
If a struct has var properties but is never modified after construction, you can opt out of the wrapping with the // SKIP @nocopy directive to avoid the copy overhead:
// SKIP @nocopy
struct Config {
var apiURL: URL
var timeout: TimeInterval
}
Two related rules:
final class over struct for complex model types with many methods. .sref() insertion is fine for plain-data structs but can be subtle with method-heavy ones.add(), multiply()) over operator overloads for non-trivial types.@inline(__always) escapeGeneric type parameters are erased at runtime. is and as? against generic types ignore the generics:
let xs: Any = [1, 2, 3]
if xs is [String] { // True on Kotlin — generics erased
let strings = xs as! [String]
// strings.first crashes — they're actually Ints
}
Also unsupported:
When you need the type available at runtime, annotate the function with @inline(__always) — Skip transpiles it to a Kotlin inline fun <reified T>:
@inline(__always)
func decode<T: Decodable>(_ data: Data) throws -> T {
return try JSONDecoder().decode(T.self, from: data)
}
Use sparingly — every call site inlines the body.
Inside #if SKIP blocks, Skip relaxes its Swift parsing so you can write Kotlin-ish code that looks like Swift to Xcode but transpiles to real Kotlin. This is Kotlish.
When Kotlish can't express what you need (anonymous inner classes, : class references, property delegates), fall back to a SKIP comment directive:
// SKIP INSERT: <kotlin> — inject literal Kotlin at this point. The Swift compiler ignores it.// SKIP REPLACE: <kotlin> — replace the next statement with literal Kotlin.// SKIP DECLARE: <kotlin declaration> — override only the declaration line; transpile the body normally.// SKIP NOWARN — silence a transpiler warning/error on the next line.// SKIP SYMBOLFILE — mark the file as declaration-only; the implementation lives in a parallel .kt.// SKIP EXTERN — JNI / native function reference.// SKIP @nocopy — disable MutableStruct wrapping on a struct (see above).// SKIP @nodispatch — prevent automatic dispatch of an async function onto a Kotlin coroutine context.// SKIP @bridge / @bridgeMembers / @nobridge — control JNI bridging in Fuse mode (see skip-fuse).The directives and the Kotlish syntax (named parameters use : not =; closures use in not ->; wildcard imports use .__ not .*) are covered in detail in references/swift-kotlin-rules.md.
#if SKIP
import android.content.Context
let context = ProcessInfo.processInfo.androidContext
let uuid = java.util.UUID.randomUUID().toString()
#endif
For iterating over a Kotlin Map, use entry.value and entry.key:
#if SKIP
for entry in someMap {
let key = entry.key
let value = entry.value
}
#endif
The Swift for (k, v) in dict form does not work for Kotlin Maps.
Closures, generics (with limits — see above), optionals, async/await, @Observable, pattern matching, guard/if let, defer, Codable, string interpolation, collection operations (map, filter, reduce).
Key paths as values, complex macros, C interop (use SkipFFI), Mirror / reflection, variadic generics, UIViewRepresentable. The Array.remove(atOffsets:) SwiftUI-extension trap is its own case — see above.
swift test --filter XCSkipTests # Run transpilation + Kotlin compilation
swift test --filter XCSkipTests -v # Verbose Gradle errors
Kotlin compile errors appear with .kt file paths and line numbers; cross-reference with the original Swift source.
references/swift-kotlin-rules.md — full long-form rules: strings, structs/MutableStruct/.sref(), generics, GC behaviour, Kotlish dialect, every SKIP comment directive with examples, .kotlin() conversion.references/supported-features.md — feature support table.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub skiptools/skills --plugin skip-app-design8 skills in this plugin
/building-skip-uiBuilding SwiftUI views in Skip projects that work on both iOS and Android. Covers supported components, navigation, state management, Jetpack Compose customization, Material 3 theming, the hard rule against `Image(systemName:)` / `Label(_, systemImage:)` (use `.symbolset` resources via `Image("name", bundle: .module)` instead), and the localization-correct `Label { Text } icon: { Image }` shape./skip-app-walkthroughStart-to-finish orchestrator for building a new cross-platform Skip app. Sequences the other Skip skills in the order you actually need them — scaffold with `skip init`, write SwiftUI, add Material Symbols icons, validate Kotlin transpilation with `swift test`, drive the running app with `skip app launch` + Maestro, localise via `Localizable.xcstrings`, and ship via `skip export` with fastlane metadata. Use this skill at the start of a new project, or when picking up an existing Skip app and trying to decide which skill applies to which phase. Each phase links to the dedicated skill for the deep dive. Also points at the `skipapp-todo` working example at https://github.com/skiptools/skills as a reference build./skip-frameworksIntegrating optional Skip frameworks into a project. Covers Firebase, SQLite, Keychain, WebView, audio/video, device sensors, Lottie animations, FFI, and other frameworks. Includes Package.swift dependencies, skip.yml configuration, and usage examples./skip-fuseBuilding Skip apps in Fuse mode — Swift compiled natively for Android via the Swift Android SDK (Swift 6.3+), with auto-generated JNI bridging between Swift and Kotlin/Java. Covers when to choose Fuse over Lite, project init with `skip init --native-app`, the `mode: 'native'` + `bridging: true` skip.yml configuration, the `import SkipFuse` requirement for `@Observable` models (a build-time warning, not an error), the internal/public visibility rules for views and properties, the ~60 MB Swift runtime binary cost, debugging via `OSLog.Logger` (breakpoints not yet supported), `ProcessInfo.processInfo.dynamicAndroidContext()` for reaching the Android Context, the Kotlin-inline-class string-interpolation workaround for Android SDK properties, `SKIP_BRIDGE=1` for dynamic library bundling, and the `skip android test` (CLI vs APK mode) test command. Use this skill whenever working on a project whose `skip.yml` contains `mode: 'native'`, or when deciding between Lite and Fuse for a new app./skip-iconsIcons in Skip projects. The hard rule: never use `Image(systemName:)` or `Label(_, systemImage:)`. SF Symbols are an Apple-only catalogue with no Android equivalent; the names you pass to `systemName:` / `systemImage:` will not resolve on Android and most will render as a blank or generic-placeholder glyph. The canonical replacement is to download Material Symbols from `fonts.google.com/icons` in **Apple symbolset format**, drop the `.symbolset/` bundle under `Sources/<Module>/Resources/Icons.xcassets/`, and render with `Image("name", bundle: .module)` inside the localisation-correct `Label { Text(…, bundle: .module) } icon: { Image(…) }` form. The same SVG ships to both platforms and looks identical. Also covers app launcher icons via `skip icon` and how to verify in-app icons render on both platforms. The full `.symbolset` format spec (download URLs per variant, `Contents.json` schemas, verification checks) is in references/symbolset-anatomy.md. references/sf-symbol-map.md explains what SkipUI does with `systemName:` internally — it is **not** a "safe-to-use" list. Use this skill whenever adding, replacing, or auditing icons in a Skip app or library./skip-localizationTranslating Skip apps and libraries into other languages. Covers in-app strings via `Localizable.xcstrings` String Catalogs in each module's `Resources/` directory, iOS `Info.plist` usage descriptions via `Darwin/InfoPlist.xcstrings`, and App Store / Google Play metadata under `Darwin/fastlane/metadata/` and `Android/fastlane/metadata/android/`. Includes the `Text("…", bundle: .module, comment: "…")` extraction convention, the `state: needs_review` discipline for agent-produced translations, conservative idiomatic translation guidance, and the catalog-rewrite-from-scratch path for template-to-app conversions. The full xcstrings JSON schema is in references/xcstrings-schema.md; fastlane directory layout, byte budgets, and validation commands in references/fastlane-metadata.md; the BCP-47 ↔ App Store ↔ Play language-code mapping in references/language-codes.md. Use this skill whenever adding or updating translations, expanding the supported-language set, validating xcstrings JSON, or preparing store metadata for a release.Other plugins' skills for the same job