agentleFS
prasad-vennamprasad-vennam/Awesome-Android-AI-Agent-Skills/skills/android-kmp-platform-channels/SKILL.md

android-kmp-platform-channels

Skill11 starsChanged 8 months agoMITView on GitHub

Bridging Native iOS and Desktop APIs back into KMP.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When the common Kotlin standard library falls short, you must write native platform bridges to access raw iOS Foundation or Android Context …

    line 17
  2. Distinctive:

    When integrating platform-specific hardware, Push Notifications, or third-party proprietary SDKs that lack a KMP wrapper.

    line 20
  3. Very specific:

    Pattern: Avoid trying to pass Context (Android) or UIViewController (iOS) around in common code via generic Any types.

    line 25
  4. Very specific:

    Trap: Do not attempt to use java.util.UUID or java.time anywhere in commonMain!

    line 33

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Kotlin Multiplatform Native Bridging 🌉

When the common Kotlin standard library falls short, you must write native platform bridges to access raw iOS Foundation or Android Context APIs.

⚡ When to Use

  • When integrating platform-specific hardware, Push Notifications, or third-party proprietary SDKs that lack a KMP wrapper.

🏗️ Core Rules / Pillars

1. The Expect/Actual Paradigm

  • Pattern: Avoid trying to pass Context (Android) or UIViewController (iOS) around in common code via generic Any types.
  • Implementation: Define an expect class or interface in commonMain, and provide actual implementations within androidMain and iosMain. Use constructor injection for dependencies if using Koin or Kotlin-Inject.

2. Bridging Coroutines to Swift (iOS)

  • Pattern: By default, Kotlin StateFlow and suspend functions compile to Swift with generic clunky Skie or CompletionHandler signatures.
  • Implementation: Rely on libraries like Touchlab's SKIE to seamlessly map Kotlin Coroutines into native Swift Async/Await to provide iOS developers a world-class API.

🚧 Critical Anti-Hallucination Guards

  • Trap: Do not attempt to use java.util.UUID or java.time anywhere in commonMain! Native Java libraries simply DO NOT compile to iOS and will immediately break the KMP build. Instead use kotlinx.datetime and uuid libraries.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.