Skip to content

Code Reviewer

Ali Sadeghi edited this page Jan 21, 2026 · 8 revisions

Code Reviewer Agent

Reviews feature implementations against architecture rules.

Manual Invocation:

> Use code-reviewer agent to review the login feature

What It Validates

Spec Compliance (if spec.md exists)

  • Data models match spec definitions
  • Interfaces match spec contracts
  • State management matches spec structure
  • Navigation matches spec routes/callbacks
  • Reports drift between spec and implementation

10 Critical Rules

  1. Interface + Impl pairs for DataSource/Repository
  2. Either for all fallible operations
  3. setState { } for state updates (never direct assignment)
  4. 4-state UI: Uninitialized/Loading/Success/Failed
  5. X-components only (no Material3)
  6. ImmutableList for collections
  7. Callback parameters for navigation
  8. Lowercase packages (no hyphens/underscores)
  9. @Serializable on all models
  10. Type-safe navigation routes

4 Integration Points

  1. settings.gradle.kts includes module
  2. composeApp/build.gradle.kts has dependency
  3. initKoin.kt registers DI module
  4. BaseAppNavHost.kt wires navigation

Example Output

Reviewing feature: login

✓ Data Layer
  ✓ LoginRemoteDataSource: Interface + Impl found
  ✓ LoginRepository: Interface + Impl found
  ✓ Either<T> used for all suspend functions
  ✓ Models have @Serializable

✓ UI Layer
  ✓ LoginUiState: All 4 states present
  ✓ LoginViewModel: Uses setState { }
  ✓ LoginScreen: Uses X-components
  ✓ Navigation: Type-safe routes with callbacks

✓ Integration
  ✓ settings.gradle.kts: Module included
  ✓ composeApp/build.gradle.kts: Dependency added
  ✓ initKoin.kt: DI module registered
  ✓ BaseAppNavHost.kt: Navigation wired

⚠ Issues Found:
  ⚠ LoginScreen.kt:45 - Using Material3 Button instead of XButton
  ⚠ LoginViewModel.kt:32 - Direct state assignment instead of setState { }

✗ Review Failed: 2 issues found

Back to Agents

Clone this wiki locally