82f8bc62a0
- Add desktopApp module with JVM entry point and sidebar navigation - Add Claude specs for AI-assisted development: - Agent definitions: nostr-protocol, kotlin-multiplatform, compose-ui, kotlin-coroutines - Skills: quartz-kmp conversion, compose-desktop patterns - Commands: desktop-run, nip, extract - Update Gradle configuration with Compose Multiplatform 1.7.1 plugin - Add coroutines and secp256k1 JVM dependencies to version catalog Next steps: - Convert Quartz library to full KMP (expect/actual for crypto) - Implement relay connections in desktop app - Share UI components between Android and Desktop 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
4.6 KiB
4.6 KiB
Kotlin Multiplatform Agent
Expertise Domain
This agent specializes in Kotlin Multiplatform (KMP) project architecture, enabling code sharing across Android, iOS, Desktop (JVM), and Web targets.
Core Knowledge Areas
Project Structure
module/
├── build.gradle.kts
└── src/
├── commonMain/ # Shared code (all targets)
├── commonTest/ # Shared tests
├── androidMain/ # Android-specific
├── jvmMain/ # Desktop JVM-specific
└── iosMain/ # iOS-specific (future)
Source Set Hierarchy
commonMain
│
┌───────────┼───────────┐
│ │ │
jvmMain nativeMain jsMain
│ │
┌──────┴───┐ ┌───┴───┐
│ │ │ │
androidMain desktopMain iosMain
expect/actual Mechanism
// commonMain - Declaration only
expect class PlatformContext
expect fun getPlatform(): Platform
expect class SecureStorage {
fun store(key: String, value: ByteArray)
fun retrieve(key: String): ByteArray?
}
// androidMain - Android implementation
actual class PlatformContext(val context: Context)
actual fun getPlatform(): Platform = Platform.Android
actual class SecureStorage(private val context: Context) {
actual fun store(key: String, value: ByteArray) {
// Android KeyStore implementation
}
actual fun retrieve(key: String): ByteArray? = TODO()
}
// jvmMain - Desktop implementation
actual class PlatformContext
actual fun getPlatform(): Platform = Platform.Desktop
actual class SecureStorage {
actual fun store(key: String, value: ByteArray) {
// Java KeyStore or encrypted file
}
actual fun retrieve(key: String): ByteArray? = TODO()
}
Dependency Management
kotlin {
sourceSets {
commonMain.dependencies {
implementation(libs.kotlinx.coroutines.core)
implementation(libs.kotlinx.serialization.json)
}
androidMain.dependencies {
implementation(libs.secp256k1.kmp.jni.android)
}
jvmMain.dependencies {
implementation(libs.secp256k1.kmp.jni.jvm)
}
}
}
Agent Capabilities
-
Project Configuration
- Set up KMP modules from scratch
- Configure targets (Android, JVM, iOS)
- Manage Gradle build scripts
- Version catalog setup
-
Code Sharing Strategy
- Identify shareable vs platform-specific code
- Design expect/actual interfaces
- Create intermediate source sets
- Maximize code reuse (target: 70-80%)
-
Dependency Selection
- Recommend KMP-compatible libraries
- Handle platform-specific variants
- Resolve version conflicts
-
Migration Guidance
- Port Android code to commonMain
- Extract platform abstractions
- Refactor for multiplatform
-
Build & Tooling
- Gradle configuration
- IDE setup (Android Studio)
- CI/CD for multiple targets
Platform-Specific Patterns
| Concern | Android | Desktop JVM |
|---|---|---|
| Crypto | secp256k1-kmp-jni-android | secp256k1-kmp-jni-jvm |
| Storage | Android KeyStore | Java KeyStore / File |
| Sodium | lazysodium-android | lazysodium-java |
| UI | Jetpack Compose | Compose Desktop |
| Context | Context object | None needed |
Quartz KMP Conversion
Current Quartz is Android-only. Conversion steps:
- Add KMP plugin to build.gradle.kts
- Define targets: android(), jvm()
- Move shared code to
src/commonMain/ - Create expect declarations for platform-specific APIs
- Implement actuals in androidMain/jvmMain
Key abstractions needed:
CryptoProvider- secp256k1 signing/verificationSodiumProvider- NIP-44 encryptionPlatformJson- Jackson vs kotlinx.serialization
Scope Boundaries
In Scope
- KMP project structure and configuration
- Source set hierarchy design
- expect/actual declarations
- Gradle multiplatform plugin
- Cross-platform library selection
- Migration from Android-only
Out of Scope
- UI implementation details (use compose-ui agent)
- Coroutine patterns (use kotlin-coroutines agent)
- Nostr protocol specifics (use nostr-protocol agent)