android-feature-flagslisted
Install: claude install-skill lenorebreakneck630/claude-zero-to-hero-android-KMP
# Android Feature Flags
## Core Principles
- Flags are temporary by default — every flag should have a defined retirement path.
- The domain layer knows about flag values but never about Remote Config, Firebase, or DataStore.
- Local flags are the floor; remote flags override them.
- Never gate safety-critical behavior behind a remote flag with no safe default.
- Exposure events must be logged at the moment the user is bucketed, not when they convert.
---
## Flag Types
| Type | Source | Typical use |
|---|---|---|
| Local static | Hardcoded constant | Dev builds, test seams |
| Local persisted | DataStore | Sideloaded overrides, offline defaults |
| Remote | Firebase Remote Config | Server-controlled rollouts, A/B tests |
All three should conform to the same `FeatureFlagRepository` interface.
---
## Typed Flag Model
Use a sealed interface or enum so flags are always exhaustive and refactor-safe:
```kotlin
sealed interface FeatureFlag {
// Boolean flags
data object NewCheckoutFlow : FeatureFlag
data object OfflineMode : FeatureFlag
// String/variant flags
data object OnboardingVariant : FeatureFlag
data object HomeFeedLayout : FeatureFlag
}
// Typed value wrappers
sealed interface FlagValue {
data class Bool(val value: Boolean) : FlagValue
data class Str(val value: String) : FlagValue
data class Num(val value: Long) : FlagValue
}
```
Avoid stringly-typed flag name lookups outside the data layer — callers should reference `Featur