kmp-data-layer
Kotlin data layer patterns: data classes in shared-core, repository pattern, StateFlow, CatalogService, and content wiring
Skill by giolaq
Chalk Labs
Need help deploying kmp-data-layer?
Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/giolaq-kmp-data-layer
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: data, writing
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/kmp-data-layer
What's inside
- Skill name
kmp-data-layer- Description
- Kotlin data layer patterns: data classes in shared-core, repository pattern, StateFlow, CatalogService, and content wiring
- License
- MIT-0
- Instructions
- 252 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# KMP Data Layer
> Content flows: JSON catalog -> CatalogService -> ContentRepository -> UI (Compose/SwiftUI). The shared-core module owns all data logic. Platform apps only consume repositories via ServiceLocator.
## Architecture overview
```
JSON / API
|
CatalogService (implements CatalogSource interface)
|
ContentRepository (caches + queries)
|
ServiceLocator (provides singleton instances)
|
UI Layer (MainActivity / SwiftUI views)
```
## Core data model: ContentItem
```kotlin
// shared-core/src/commonMain/kotlin/models/ContentItem.kt
data class ContentItem(
val id: String,
val title: String,
val description: String? = null,
val thumbnailUrl: String? = null,
val contentType: ContentType, // Video, Audio, Image, Mixed
val metadata: ContentMetadata = ContentMetadata(),
val isOfflineAvailable: Boolean = false,
val lastAccessed: Long? = null,
val focusable: Boolean = true,
val collections: List<String> = emptyList(),
val tags: List<String> = emptyList(),
val priority: Int = 0, // Higher = more prominent in UI
val videoUrl: String? = null,
)
```
### ContentMetadata
```kotlin
data class ContentMetadata(
val genre: String? = null,
val rating: String? = null,
val releaseDate: String? = null,
val duration: Long? = null,
val director: String? = null,
val cast: List<String> = emptyList(),
)
```
### ContentType enum
```kotlin
enum class ContentType { Video, Audio, Image, Mixed }
```
## Repository pattern
### Interface
```kotlin
// shared-core/src/commonMain/kotlin/repositories/ContentRepository.kt
interface ContentRepository {
suspend fun getContentItems(limit: Int = 50, offset: Int = 0): Result<List<ContentItem>>
suspend fun getContentItem(id: String): Result<ContentItem?>
suspend fun searchContent(query: String): Result<List<ContentItem>>
suspend fun markContentAccessed(contentId: String): Result<Unit>
}
```
### Implementation
`ContentRepositoryImpl` wraps a `CatalogSource` and adds:
- **Lazy loading:** catalog is fetched once, then cached in-memory
- **Thread safety:** `Mutex` protects the content map
- **Sorting:** items returned sorted by `priority` descending
- **Search:** filters by title, description, and tags (case-insensitive)
### Result type
```kotlin
sealed class Result<out T> {
data class Success<T>(val data: T) : Result<T>()
data class Error(val exception: Exception? = null, val message: String? = null) : Result<Nothing>()
}
```
UI code uses `onSuccess`/`onFailure` extension methods for clean handling.
## CatalogService — loading content
```kotlin
interface CatalogSource {
suspend fun fetchCatalog(): Result<List<ContentItem>>
}
```
The default `CatalogService` implementation loads content from a JSON endpoint or bundled file. To wire custom content:
### Option 1: Replace the JSON source
Implement `CatalogSource` to read from your content.json:
```kotlin
class CustomCatalogSource(private val jsonString: String) : CatalogSource {
override suspend fun fetchCatalog(): Result<List<ContentItem>> {
return try {
val items = Json.decodeFromString<List<ContentItem>>(jsonString)
Result.Success(items)
} catch (e: Exception) {
Result.Error(e, "Failed to parse catalog")
}
}
}
```From giolaq/tv-build-harness, MIT-0.
More from giolaq/tv-build-harness
- 0.563score
meta
giolaq
Meta skill loaded for all phases: project conventions, file modification rules, code quality standards
SkillBFreshness: B★ 4Claude Code +9 - 0.516score
kmp-compose-tv
giolaq
Compose for TV patterns: TvLazyRow/Column, focusable cards, FocusRequester, D-pad navigation, and 10-foot UI composables
SkillCFreshness: C★ 4Claude Code +9 - 0.516score
kmp-navigation
giolaq
Compose Navigation for TV: state-based screen switching, BackHandler, focus-aware transitions, and drawer/sidebar patterns
SkillCFreshness: C★ 4Claude Code +9 - 0.516score
kmp-template-anatomy
giolaq
KMP TV template repo structure: shared-core, androidtv-app, appletv-app modules and where screens, theme, data, and navigation live
SkillCFreshness: C★ 4Claude Code +9 - 0.516score
creative-tv-ui
giolaq
Creative visual design patterns for TV apps: typography, color depth, focus states, animations, per-content-type personalities
SkillCFreshness: C★ 4Claude Code +9 - 0.513score
rn-shared-ui-catalog
giolaq
Catalog of available shared-ui components: what exists in the template, how to reuse vs create new
SkillCFreshness: C★ 4Claude Code +9 - 0.513score
10ft-ui
giolaq
10-foot UI design guidelines: safe zones, font sizes, contrast, focus indicators for TV viewing distance
SkillCFreshness: C★ 4Claude Code +9 - 0.513score
firetv-leanback
giolaq
Fire TV leanback manifest configuration: banner icons, LEANBACK_LAUNCHER intent filter, TV-specific Android settings
SkillCFreshness: C★ 4Claude Code +9 - 0.513score
kmp-build-commands
giolaq
Gradle build commands: assembleDebug, assembleRelease, APK output paths, and emulator installation
SkillCFreshness: C★ 4Claude Code +9 - 0.513score
kmp-theming
giolaq
Compose MaterialTheme patterns: Color.kt, Typography, darkColorScheme, and TV-specific theming for KMP apps
SkillCFreshness: C★ 4Claude Code +9 - 0.513score
kmp-verify-patterns
giolaq
How to verify KMP builds: compile checks, lint, common Compose compiler errors, Gradle dependency resolution issues
SkillCFreshness: C★ 4Claude Code +9 - 0.513score
rn-manifest-wiring
giolaq
Content manifest wiring: how to connect content.json data to React Native data hooks and screen components
SkillCFreshness: C★ 4Claude Code +9
Signals
- Stars
- 4
- Forks
- 0
- Open issues
- 3
- Last commit (this folder)
- Jun 24, 2026 (4 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT-0
- Repository
- github.com/giolaq/tv-build-harness
- Website
- tv-build-harness.vercel.app
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from giolaq
- 0.563score
meta
giolaq
Meta skill loaded for all phases: project conventions, file modification rules, code quality standards
SkillBFreshness: B★ 4Claude Code +9 - 0.516score
kmp-template-anatomy
giolaq
KMP TV template repo structure: shared-core, androidtv-app, appletv-app modules and where screens, theme, data, and navigation live
SkillCFreshness: C★ 4Claude Code +9 - 0.516score
kmp-navigation
giolaq
Compose Navigation for TV: state-based screen switching, BackHandler, focus-aware transitions, and drawer/sidebar patterns
SkillCFreshness: C★ 4Claude Code +9 - 0.516score
creative-tv-ui
giolaq
Creative visual design patterns for TV apps: typography, color depth, focus states, animations, per-content-type personalities
SkillCFreshness: C★ 4Claude Code +9 - 0.516score
kmp-compose-tv
giolaq
Compose for TV patterns: TvLazyRow/Column, focusable cards, FocusRequester, D-pad navigation, and 10-foot UI composables
SkillCFreshness: C★ 4Claude Code +9 - 0.513score
kmp-verify-patterns
giolaq
How to verify KMP builds: compile checks, lint, common Compose compiler errors, Gradle dependency resolution issues
SkillCFreshness: C★ 4Claude Code +9
Done for you
Rather not set it up yourself?
Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.
See how we build AI agents →Read the case studies
Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.
- launches shipped
- 50+
- launches shipped
- media placements
- 500+
- media placements
- founders on every account
- 2
- founders on every account
Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block
Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.
Get kmp-data-layer running in your business
Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.
Cite this page
kmp-data-layer skill. Agent Mart. https://agentmart.dev/skills/giolaq-kmp-data-layer (last updated 2026-10-24)