dimitriremoiville/cc-mobile/kotlin-style
Claude Code and agent skill by dimitriremoiville/cc-mobile
- community
Checking that the SKILL.md file is still in the repository.
Project-specific Kotlin conventions — the rules that aren't already in the official Kotlin style guide. Covers the `Outcome<T>` / `DomainError` boundary contract, the `runCatching → toOutcome` rule, naming conventions for this codebase, and where idioms diverge from defaults. Load whenever writing or reviewing Kotlin in this project.
Install
npx vskill@latest install dimitriremoiville/cc-mobile/kotlin-styleSKILL.md
The same SKILL.md was published earlier as dimitriremoiville/cc-mobile/kotlin-style.
Kotlin style (project delta)
For everything not below, the official Kotlin style guide applies. This file only documents where this project's conventions add to or override the defaults.
When this applies
The error-handling contract below is opinionated for this project's scaffold (Outcome<T> + DomainError from /init-android-app). On an existing app:
- Codebase already uses
kotlin.Resulteverywhere → don't refactor toOutcomeunless the user asks; apply only theCancellationException-rethrow rule. - Codebase throws across boundaries → flag it, but don't pretend
Outcomeis universal Kotlin practice. - The naming and immutability sections apply regardless of stack.
Naming (project-specific)
- Use cases: verb-based, suffixed
UseCase—GetUserProfileUseCase,SubmitOrderUseCase. One class per business action. - Repository implementations: interface in
domain/, implementation indata/suffixedImpl(OrderRepository⇄OrderRepositoryImpl). - Composables: noun-based, named after what they render (
OrderRoutevsOrderScreen— seecompose-uifor the Route/Screen split). - UiState / UiEvent: sealed types per screen, named
<Feature>UiState,<Feature>UiEvent. - DTOs: suffix
Dto(OrderDto), kept in<feature>/data/remote/next to theirtoDomain()mapper.
The rest of naming follows Kotlin defaults — PascalCase types, camelCase functions/values, UPPER_SNAKE_CASE for const val.
Typed IDs
Use @JvmInline value class for IDs that would otherwise be raw String / Long:
Catches getOrder(userId) mix-ups at compile time, costs nothing at runtime.
Error-handling contract
Domain-facing signatures return `Outcome<T>`, never `Result<T>` and never raw `throw`. The two types are defined once in core/domain/Outcome.kt and core/domain/DomainError.kt (see android-app-skeleton); every use case, repository method, and ViewModel that needs a typed failure goes through them.
`runCatching` only inside the data layer, only piped through `toOutcome`:
The canonical adapter lives in core/data/network/Outcomes.kt. It rethrows CancellationException — open-coded `runCatching { ... }.fold(...)` silently swallows cancellation and is the single most common bug this rule prevents. The reviewer flags any open-coded runCatching.fold(...) and any Result<T> return on a domain/ interface.
Map exceptions to DomainError at the repository boundary. The domain layer must not know about IOException or HttpException.
Coroutines (project rules)
Standard Kotlin coroutine rules apply; this project adds:
- No `GlobalScope` anywhere. The reviewer flags it.
- Dispatcher boundary in the repository, not the ViewModel.
viewModelScope.launch { repository.fetch() }— the repository'swithContext(Dispatchers.IO)is where the switch happens. - `StateFlow` for UI state, `Channel` for one-shot effects.
SharedFlowonly when you genuinely need replay semantics.LiveDatais forbidden in new code. - Collect with
collectAsStateWithLifecycle(), nevercollectAsState()— seecompose-ui.
Sealed hierarchies in this project
The three sealed types the codebase relies on (don't reinvent them):
Outcome<T>— every domain-facing result.DomainError— every domain-facing failure.<Feature>UiState— every screen's state machine. Branches areLoading/Error/Successby convention; add more only when the screen genuinely has them.
Prefer sealed interface over sealed class when there's no shared state.
Immutability and copy
State updates copy, never mutate:
MutableStateFlow.update { } is preferred over value = value.copy(...) — the lambda runs atomically.
Visibility
privatefor file-/class-internal helpers.internalfor module-internal APIs once:feature:*/:core:*modules exist (seeandroid-architecture→ "Module or package?"). In a single:appmodule,internalis equivalent topublic— don't over-rely on it.publicshould be deliberate.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingandroid/.claude/skills/kotlin-style/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/dimitriremoiville/cc-mobile/kotlin-style)