Skip to content

Feature Development Agents

Ali Sadeghi edited this page May 18, 2026 · 5 revisions

Feature Development Agents

Three specialized sub-agents that implement Clean Architecture layers for a single feature. They run during Phase 3 of creating-kmp-feature, typically in parallel.

Overview

Agent Layer Color
Data-Layer-Agent Models, Resources, DataSource, Repository blue
UI-Layer-Agent UiState, UiModel, ViewModel, Screen + ScreenRoot, Navigation purple
Integration-Agent DI module + 4 integration points + spec.md green

All three import agents/_base/common.md for shared base instructions (build validation, error patterns, context-variable contract).

Feature Module Structure (What Gets Generated)

feature/{featurename}/
├── build.gradle.kts                         ← data-layer-agent (gradle template)
├── src/commonMain/kotlin/{pkg}/{featurename}/
│   ├── data/
│   │   ├── model/        DTOs with @Serializable
│   │   ├── remote/       Ktor Resources
│   │   ├── datasource/   Interface + Impl
│   │   └── repository/   Interface + Impl
│   ├── presentation/
│   │   ├── {Feature}ViewModel.kt           ← top-level, not nested
│   │   ├── {Feature}UiState.kt
│   │   ├── {Feature}UiModel.kt
│   │   ├── ui/
│   │   │   ├── {Feature}Screen.kt          Screen + ScreenRoot + state routing
│   │   │   └── components/                 self-contained UI units
│   │   └── navigation/                     Route + NavGraphBuilder extension
│   └── di/
│       └── {Feature}Modules.kt             object : BaseFeature

presentation/ is flat{Feature}ViewModel.kt, {Feature}UiState.kt, {Feature}UiModel.kt sit at the root of presentation/. There is no viewmodel/ or model/ subdirectory.

UI organization rule

{Feature}Screen.kt is the orchestrator and must stay lean:

  • Keep in {Feature}Screen.kt — structural glue: Screen, ScreenRoot, state routing (when (uiState)), the top-level layout scaffold, and state screens (LoadingContent, ErrorContent).
  • Move to components/{Name}.kt — self-contained UI units that have meaning on their own (cards, sections, custom inputs with internal state).

Execution Pattern

   ┌─────────────────────┐    ┌────────────────┐
   │ data-layer-agent    │    │ ui-layer-agent │
   │ (parallel)          │    │ (parallel)     │
   └─────────────────────┘    └────────────────┘
              │                       │
              └───────────┬───────────┘
                          ▼
                  ┌──────────────────┐
                  │ integration-agent│
                  │ (last)           │
                  └──────────────────┘
                          ▼
                  ./gradlew assembleDebug
                  ./gradlew ktlintFormat

Context Variables

The orchestrator passes a subset of these to each agent (see agents/_base/common.md):

Variable Data UI Integration
{featurename}
{PKG_PREFIX}
{PKG_PATH}
{CORE_COMMON_PKG}
{CORE_DATA_PKG}
{CORE_DESIGNSYSTEM_PKG}
{CORE_MODULES}
{INIT_KOIN_PATH}
{NAV_HOST_PATH}

Agent Pages


Back to Agents

Clone this wiki locally