|
| 1 | +--- |
| 2 | +apply: always |
| 3 | +--- |
| 4 | + |
| 5 | +Kotlin Multiplatform Project - AI Instructions |
| 6 | + |
| 7 | +## Tech Stack |
| 8 | + |
| 9 | +- **Kotlin**: 2.3.0-Beta2 (use latest features) |
| 10 | +- **Build System**: Amper (latest dev version) |
| 11 | +- **Java Target**: 25 |
| 12 | +- **Platform**: Kotlin Multiplatform |
| 13 | + |
| 14 | +## Core Libraries |
| 15 | + |
| 16 | +- `kotlinx-coroutines` - Asynchronous programming |
| 17 | +- `kotlinx-serialization` - JSON/XML serialization |
| 18 | +- `kotlinx-datetime` - Date/time handling |
| 19 | +- `kotlinx-io` - I/O operations |
| 20 | +- `ktor-client` - HTTP client |
| 21 | +- `io.github.oshai:kotlin-logging` - Logging |
| 22 | +- `dev.whyoleg.cryptography:cryptography-core` - Cryptography |
| 23 | + |
| 24 | +**Important**: |
| 25 | + |
| 26 | +- Always check `libs.versions.toml` for existing library versions before adding or updating dependencies. |
| 27 | +- Use the latest stable versions of core libraries when adding new dependencies. |
| 28 | + |
| 29 | +## Code Standards |
| 30 | + |
| 31 | +### Style & Quality |
| 32 | + |
| 33 | +- Write simple, clean, **idiomatic, and concise** Kotlin code |
| 34 | +- Avoid verbose or overly complex solutions |
| 35 | +- Use Kotlin stdlib functions before third-party libraries |
| 36 | +- Follow official Kotlin coding conventions |
| 37 | +- Prefer functional style where appropriate |
| 38 | +- Avoid excessive scope function nesting (`.let{}`, `.apply{}`, etc.) |
| 39 | + |
| 40 | +### Kotlin Multiplatform |
| 41 | + |
| 42 | +- Write common code compatible with all JVM and Native targets |
| 43 | +- Use `expect`/`actual` declarations only when platform-specific code is required |
| 44 | +- Prefer common Kotlin libraries over platform-specific ones |
| 45 | + |
| 46 | +### Code Conversion from Other Languages |
| 47 | + |
| 48 | +- **Never** translate code line-by-line from other languages |
| 49 | +- Rewrite code idiomatically using Kotlin's features and conventions |
| 50 | +- Replace loops with stdlib functions (`map`, `filter`, `fold`, etc.) |
| 51 | +- Use Kotlin's null safety, data classes, and extension functions |
| 52 | +- Simplify verbose patterns with concise Kotlin equivalents |
| 53 | +- Leverage stdlib before adding dependencies |
| 54 | + |
| 55 | +### Requirements |
| 56 | + |
| 57 | +- Production-ready code only (no bugs, placeholders, or TODOs) |
| 58 | +- Do not introduce bugs to existing code |
| 59 | +- Use modern Kotlin features from the latest available version |
| 60 | +- Add **concise, clean, idiomatic** error handling |
| 61 | +- Include KDoc comments for public APIs |
| 62 | +- Use meaningful, **concise** variable names |
| 63 | + |
| 64 | +### Research & References |
| 65 | + |
| 66 | +- Check well-maintained GitHub projects for implementation patterns |
| 67 | +- Verify library usage against official documentation |
| 68 | + |
| 69 | +## Documentation Links |
| 70 | + |
| 71 | +- [Kotlin Docs](https://kotlinlang.org/docs/home.html) |
| 72 | +- [Kotlinx Coroutines](https://github.com/Kotlin/kotlinx.coroutines) |
| 73 | +- [Kotlinx I/O](https://github.com/Kotlin/kotlinx-io) |
| 74 | +- [Amper Build System](https://github.com/JetBrains/amper) |
| 75 | +- [Gradle User Guide](https://docs.gradle.org/current/userguide/userguide.html) |
| 76 | +- [Java 25 API](https://docs.oracle.com/en/java/javase/25/docs/api/index.html) |
0 commit comments