name: kmp-commands description: "Essential CLI command reference for Kotlin Multiplatform development. Use when: (1) Running validation before commits, (2) Building Android/Desktop/iOS apps, (3) Running tests across modules, (4) Managing dependencies, (5) Generating changelogs with git-cliff. Keywords: gradle, build, test, validation, CLI commands, git-cliff"
KMP Commands
Essential CLI reference for KMP development.
When to Use This Skill
Use this skill when you need to execute build, test, or maintenance commands. Triggers include: "command", "build", "test", "gradle", "validation", "commit".
Mode Detection
| User Request | Reference File | Load When |
|---|---|---|
| "Commit message error" / "PTY break" / "Git issues" | troubleshooting.md | MANDATORY - Read when encountering command/git errors |
| Standard build/test commands | See Quick Reference below | N/A |
MANDATORY - READ ENTIRE FILE: When encountering CLI command or git commit errors, you MUST read troubleshooting.md (~50 lines) for common issues and solutions.
Do NOT load troubleshooting.md if commands are working correctly.
Related Skills
- @kmp-gradle: For Gradle configuration and convention plugins.
NEVER
- NEVER manually edit
CHANGELOG.md. It is auto-generated bygit cliff. - NEVER run iOS builds for routine validation. They take 5-10 minutes. Use the Primary Validation command instead.
Decision Framework
Before running commands, ask yourself:
What validation level is needed?
- Pre-commit →
./gradlew :composeApp:assembleDebug test --continue(45s, ALWAYS run) - Full build → Add iOS framework build (5-10min, only when iOS changes)
- Specific module →
./gradlew :features:<feature>:<layer>:testDebugUnitTest
- Pre-commit →
What platform am I targeting?
- Android →
:composeApp:assembleDebugor:composeApp:installDebug - Desktop →
:composeApp:run(JVM) - iOS (native SwiftUI) → Open
iosApp/in Xcode - iOS (Compose experimental) → Build framework then open
iosAppCompose/in Xcode
- Android →
What maintenance task is needed?
- Dependency updates →
./gradlew dependencyUpdates - Changelog generation →
git cliff -o CHANGELOG.md(NEVER manual edit) - Clean build →
./gradlew cleanthen rebuild
- Dependency updates →
Essential Workflows
Workflow 1: Pre-Commit Validation
- Save all files and ensure no uncommitted changes
- Run primary validation:
./gradlew :composeApp:assembleDebug test --continue - Wait for completion (~45 seconds)
- Verify: All tests pass, build succeeds
- If failures: Fix issues, repeat from step 2
- Commit with conventional format:
type(scope): description
Cross-reference: See @kmp-gradle for build configuration, @kmp-testing-patterns for test debugging
Workflow 2: Running Module-Specific Tests
- Identify target module (e.g.,
:features:pokemonlist:presentation) - Run tests:
./gradlew :features:pokemonlist:presentation:testDebugUnitTest - For all module tests:
./gradlew test --continue - Review test output for failures
- Fix and re-run until all pass
Cross-reference: See @kmp-testing-strategy for test organization, @kmp-architecture for module structure
Workflow 3: Updating Dependencies
- Check for updates:
./gradlew dependencyUpdates - Review stability policy (Stable stays stable, Unstable can upgrade within major.minor)
- Update
gradle/libs.versions.tomlwith selected versions - Refresh:
./gradlew --refresh-dependencies - Run full validation:
./gradlew :composeApp:assembleDebug test --continue - Commit changes:
build(deps): update X to Y
Cross-reference: See @kmp-gradle for version catalog management
Quick Reference (Command Reference)
Primary Validation (ALWAYS RUN FIRST)
# Android build + ALL tests (fastest feedback: ~45 seconds)
./gradlew :composeApp:assembleDebug test --continue
Dependency Management
# Check for available updates
./gradlew dependencyUpdates
# View detailed report
open build/dependencyUpdates/report.html
Stability Rules (configured in root build.gradle.kts):
- ✅ Stable versions stay stable (e.g.,
2.8.4won't upgrade to2.9.0-alpha01) - ✅ Unstable versions upgrade within same major.minor:
2.9.0-alpha01→2.9.0-alpha03✅ (same major.minor)2.9.0-alpha01→2.9.0-beta01✅ (same major.minor)2.9.0-alpha01→2.10.0-alpha01❌ (different minor)
- ✅ Unstable versions upgrade to ANY stable version:
2.9.0-alpha02→3.1.1✅ (stable release)
Platform-Specific Commands
# Desktop/JVM
./gradlew :composeApp:run
# Ktor Server (port 8080)
./gradlew :server:run
# Android build
./gradlew :composeApp:assembleDebug
# Unit tests
./gradlew :composeApp:testDebugUnitTest
# Screenshot tests
./gradlew recordRoborazziDebug # Record baselines
./gradlew verifyRoborazziDebug # Verify against baselines
./gradlew compareRoborazziDebug # Compare screenshots
Commits & Changelog
# Commit with Conventional Commits format (required)
git commit -m "type(scope): description"
# Types: feat, fix, docs, test, build, refactor, chore
# Examples:
git commit -m "feat(pokemonlist): add search functionality"
git commit -m "refactor(navigation): align package with folder structure"
git commit -m "docs(conventions): update testing requirements"
# Regenerate CHANGELOG.md from commits (using git-cliff)
git cliff -o CHANGELOG.md
# Preview changelog without writing
git cliff --dry-run
CHANGELOG Policy:
- ❌ DO NOT manually edit CHANGELOG.md — it's auto-generated by git-cliff
- ✅ Use proper Conventional Commits format — git-cliff parses these automatically
- ✅ Regenerate changelog before releases:
git cliff -o CHANGELOG.md - ✅ Commit types map to changelog sections:
feat→ ✨ Featuresfix→ 🐛 Bug Fixesdocs→ 📝 Documentationtest→ ✅ Testsbuild→ 🔧 Build Systemrefactor→ ♻️ Refactoringchore→ 🧹 Chores
iOS Build Policy ⚠️
NEVER run iOS builds during routine validation (5-10min builds).
Only execute when:
- Explicitly requested by user
- Testing iOS framework exports
- Validating iOS-specific expect/actual implementations
- Working on SwiftUI integration with shared.framework
iOS Commands (use sparingly):
# Build shared framework for iOS
./gradlew :shared:embedAndSignAppleFrameworkForXcode
# Open iOS projects in Xcode
open iosApp/iosApp.xcodeproj # Native SwiftUI app (production)
open iosAppCompose/iosAppCompose.xcodeproj # Compose iOS app (experimental)
Gradle Utility Commands
# Show module structure
./gradlew projects
# Show dependency tree
./gradlew :composeApp:dependencies
# Check for dependency conflicts
./gradlew :composeApp:dependencyInsight --dependency arrow-core
# Refresh dependencies
./gradlew --refresh-dependencies
# Clean build
./gradlew clean
Critical Guardrails
NEVER manually edit CHANGELOG.md → use
git cliff -o CHANGELOG.mdinstead (auto-generated from conventional commits, manual edits will be overwritten)NEVER run iOS builds for routine validation → use Primary Validation command (iOS builds take 5-10 minutes vs 45 seconds for Android, blocks development flow)
NEVER skip Primary Validation before committing → always run
./gradlew :composeApp:assembleDebug test --continue(catches breaking changes before they reach CI, saves time)NEVER ignore test failures with --continue → always fix failures before committing (--continue is for seeing all failures at once, not for bypassing them)
NEVER run full builds for every change → use Primary Validation (full builds including iOS are expensive, reserve for pre-release validation)
NEVER commit without conventional commit format → follow
type(scope): description(enables automatic changelog generation and semantic versioning)NEVER run dependency updates without validation → always test after updates (dependency changes can introduce breaking changes or regressions)
NEVER use stale dependencies → check
./gradlew dependencyUpdatesregularly (security patches and bug fixes require timely updates)
Cross-References
Skills (by Category)
Build & Configuration
| Skill | Purpose | Link |
|---|---|---|
| @kmp-gradle | Convention plugins, build config | SKILL.md |
| @kmp-architecture | Module structure understanding | SKILL.md |
Testing
| Skill | Purpose | Link |
|---|---|---|
| @kmp-testing-strategy | Test philosophy, when to test what | SKILL.md |
| @kmp-testing-patterns | Test implementation patterns | SKILL.md |
Development
| Skill | Purpose | Link |
|---|---|---|
| @kmp-developer | General development patterns | SKILL.md |
| @kmp-critical-patterns | Quick pattern reference | SKILL.md |
Git Operations
| Skill | Purpose | Link |
|---|---|---|
| @git-master | Git operations, commit management | (Built-in skill) |
Documents
| Document | Purpose | Link |
|---|---|---|
| @kmp-architecture | Architecture master for understanding what to build/test | Architecture skill |
| @kmp-testing-strategy skill | Testing philosophy and when to run what tests | See @kmp-testing-strategy skill |
| troubleshooting.md | Common command and git issues | troubleshooting.md |