skip-dev
npx skills add https://github.com/bphvz/skip-skills --skill skip-dev
Agent 安装分布
Skill 文档
Skip Multiplatform Development
Overview
Skip (https://skip.dev) enables building native iOS and Android apps from a single Swift/SwiftUI codebase. It works as an Xcode plugin that continuously generates an equivalent Android project using Jetpack Compose. iOS runs SwiftUI directly; Android uses Skip-generated Kotlin/Compose code.
Decision Tree: Skip Mode Selection
Before writing code, determine the correct Skip mode:
Is this a NEW project?
âââ YES â Does it need C/C++ code or complex Swift features?
â âââ YES â Use Skip Fuse (native)
â âââ NO â Does app size matter (Fuse adds ~60MB)?
â âââ YES â Use Skip Lite (transpiled)
â âââ NO â Use Skip Fuse (native) â preferred default
âââ NO â Check skip.yml for `mode:` setting
âââ mode: 'native' â Skip Fuse
âââ mode: 'transpiled' â Skip Lite
Skip Fuse (Native Mode)
- Compiles Swift natively for Android using the Swift SDK for Android
- Full Swift language support, faithful runtime, complete stdlib/Foundation
- Can integrate C/C++ libraries
- Trade-off: +60MB app size, requires bridging for Kotlin interop, slower builds
Skip Lite (Transpiled Mode)
- Converts Swift source code â Kotlin source code
- Direct access to Kotlin/Java APIs from
#if SKIPblocks - Smaller app size, faster builds, more transparent output
- Trade-off: limited Swift language features, limited stdlib support
Configuration in skip.yml
# For Fuse (native) mode:
mode: 'native'
bridging: true
# For Lite (transpiled) mode:
mode: 'transpiled'
Project Structure
App Projects
MyApp/
âââ Package.swift # SPM dependencies & targets
âââ Skip.env # Skip environment config
âââ Sources/
â âââ MyApp/ # Main app module (SwiftUI views)
â â âââ MyApp.swift # App entry point (@main)
â â âââ ContentView.swift
â â âââ Skip/ # Android-specific Kotlin files
â â âââ skip.yml # Skip module configuration
â âââ MyAppModel/ # Shared model module
â âââ DataModel.swift
â âââ Skip/
â âââ skip.yml
âââ Tests/
â âââ MyAppTests/
â âââ MyAppModelTests/
âââ Darwin/ # iOS-specific
â âââ MyApp.xcodeproj
â âââ MyApp.xcconfig
â âââ Assets.xcassets/
â âââ Info.plist
âââ Android/ # Android-specific
âââ settings.gradle.kts
âââ app/
âââ build.gradle.kts
âââ src/main/AndroidManifest.xml
âââ src/main/kotlin/.../Main.kt
Framework Projects (SPM Packages)
MyFramework/
âââ Package.swift
âââ Sources/
â âââ MyFramework/
â âââ MyFramework.swift
â âââ Skip/
â âââ skip.yml
âââ Tests/
âââ MyFrameworkTests/
âââ MyFrameworkTests.swift
Key point: Frameworks do NOT have Darwin/ or Android/ folders. The Android build is triggered by running unit tests, not by building an app.
Building
Apps: Build from Xcode
- Open the
.xcodeprojinDarwin/ - Select an iOS Simulator destination
- Build & Run â the Skip plugin automatically generates and builds the Android project
- Android output appears in the
SkipStone/pluginsgroup in the Xcode project navigator
Android build behavior is controlled in .xcconfig:
SKIP_ACTION = launch # Build and launch Android emulator (default)
SKIP_ACTION = build # Build Android only, don't launch
SKIP_ACTION = none # Skip Android build entirely
Apps: Build from CLI
# Build iOS project
xcodebuild -project Darwin/MyApp.xcodeproj -scheme MyApp \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro,OS=latest' build
# Export Android APK
skip export --project Darwin/MyApp.xcodeproj --appid com.example.myapp
Frameworks: Trigger Android Build via Tests
# Run against macOS destination to trigger Android build
swift test
# OR
skip test
Critical: You MUST run framework tests against a macOS destination to perform an Android build. Testing against an iOS destination will NOT run Android tests.
Debugging
iOS Debugging
- Standard Xcode debugging: breakpoints, LLDB, view hierarchy inspector
- Use
OSLog.Loggerfor logging (NOTprint()â print doesn’t work on Android)
import OSLog
let logger = Logger(subsystem: "com.example.myapp", category: "networking")
logger.info("Request started: \(url)")
logger.error("Request failed: \(error.localizedDescription)")
Android Debugging
- Logcat â primary Android debugging tool:
# Filter logs by app tag
adb logcat -s MyApp
# Filter by Skip logger output
adb logcat | grep "com.example.myapp"
-
Android Studio â open the generated Gradle project:
- For apps: find generated source under
SkipStone/pluginsin Xcode navigator â right-click â “Open in Android Studio” - For frameworks: open the
SkipLink/folder in Android Studio
- For apps: find generated source under
-
View generated Kotlin code â invaluable for debugging transpilation issues:
- In Xcode, expand
SkipStone/plugins(apps) orSkipLink(frameworks) - Find the
.ktfiles corresponding to your Swift source
- In Xcode, expand
-
Crash traces â demangle Swift symbols:
xcrun swift-demangle <mangled_symbol>
Common Build Errors
| Error | Cause | Fix |
|---|---|---|
No such module 'Skip...' |
Skip plugin not installed | Run skip checkup |
Cannot find type...in scope |
Unsupported Swift API on Android | Use #if !os(Android) guard or find Skip equivalent |
| Gradle sync failure | Android SDK issue | Run skip doctor then skip android sdk install |
Bridging error |
Missing bridge annotation | Add // SKIP @bridge or enable bridging: true in skip.yml |
SkipNotSupportedError |
Using unsupported SkipUI feature | Check SkipUI docs; provide Android-specific alternative |
Testing
Running Tests
# Swift tests only (iOS)
swift test
# Cross-platform parity tests (iOS + Android via Robolectric)
skip test
# Android emulator tests
ANDROID_SERIAL=emulator-5554 skip test
Writing Cross-Platform Tests
import XCTest
final class MyTests: XCTestCase {
func testSharedLogic() {
// Runs on both platforms
XCTAssertEqual(calculate(2, 3), 5)
}
#if !os(Android)
func testIOSOnly() {
// iOS-specific test
}
#endif
#if os(Android) || ROBOLECTRIC
func testAndroidOnly() {
// Android-specific test (runs on Robolectric too)
}
#endif
}
Robolectric Testing
Skip uses Robolectric for fast, Mac-based Android testing without an emulator. Use #if os(Android) || ROBOLECTRIC to include tests that should run on both Android emulator and Robolectric.
Conditional Compilation
Platform Directives
#if os(Android)
// Android-only code
#else
// iOS-only code
#endif
#if !os(Android)
// iOS-only code
#endif
#if SKIP
// Only in transpiled Kotlin code (Skip Lite)
// Can call Kotlin/Java APIs directly here
#endif
#if !SKIP
// Only in native Swift (iOS, or Fuse Android)
#endif
#if ROBOLECTRIC
// Only during Robolectric test execution
#endif
Skip Comments
Skip Comments control how Swift code is transpiled to Kotlin:
// SKIP INSERT: val androidSpecificVal = "only in Kotlin output"
// SKIP REPLACE: fun customKotlinImplementation() { ... }
func swiftImplementation() { ... }
// SKIP DECLARE: annotation class MyAnnotation
// SKIP DECLARE: typealias PlatformType = android.content.Context
// SKIP NOWARN
let _ = someUnsupportedPattern // Suppresses transpilation warning
// SKIP @bridge
public func bridgedFunction() { } // Exposes to Kotlin in Fuse mode
// SKIP @nobridge
public func noBridge() { } // Prevents bridging
// SKIP @nocopy
struct LargeData { } // Skip copy semantics for structs
// SKIP SYMBOLFILE
// Generates .skipmodule symbol file for the module
Skip CLI Quick Reference
skip create # Interactive project creation wizard
skip init # Non-interactive project init
skip test # Run cross-platform tests
skip export # Export Android APK/AAB
skip checkup # Verify Skip installation
skip doctor # Diagnose and fix issues
skip upgrade # Update Skip to latest version
skip verify # Verify project configuration
# Android-specific
skip android build # Build Android project
skip android test # Run Android tests
skip android emulator create # Create AVD emulator
skip android emulator launch # Launch emulator
skip android sdk install # Install Android SDK components
skip android sdk list # List available SDK packages
References
For detailed reference material, load from the references/ directory:
references/transpilation.mdâ Swift language features support table, builtin types, generics, structs, concurrency, numeric types, and transpilation-specific topicsreferences/skip-ui.mdâ Supported SwiftUI components, ComposeView integration, composeModifier, Material3 customization, animation, images, navigation, lists, gesturesreferences/cross-platform.mdâ Calling Kotlin/Java APIs, Compose integration, AnyDynamicObject, Kotlin files in Sources, Android Studio workflow, model integration patternsreferences/bridging.mdâ skip.yml configuration, @bridge/@bridgeMembers/@nobridge annotations, bridging SwiftâKotlin, kotlincompat option, AnyDynamicObject usagereferences/dependencies.mdâ Adding Skip/SwiftPM/Java/Kotlin dependencies, platform-conditional dependencies, skip.yml build blocksreferences/cli.mdâ Full Skip CLI command reference with options, examples, and common workflows
Load a reference with: read_file('<base_dir>/references/<filename>')