usecase-expert

Architects domain logic with single-responsibility use cases in Kotlin Multiplatform.

Updated Jan 11, 2025
One-click install
npx skills add https://github.com/shaharKeisarApps/MoviesAndBeyond --skill usecase-expert-shaharkeisarapps
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: usecase-expert
Source: https://github.com/shaharKeisarApps/MoviesAndBeyond/tree/main/.claude/skills/usecase-expert
Command: npx skills add https://github.com/shaharKeisarApps/MoviesAndBeyond --skill usecase-expert-shaharkeisarapps

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Elite use case/interactor pattern expertise for Kotlin Multiplatform domain layers. Use when designing business logic encapsulation, orchestrating repositories, implementing domain operations, handling validation, or separating concerns. Triggers on business logic organization, use case design, domain layer architecture, or interactor patterns.

Core Features & Use Cases

  • Single-responsibility use cases: Each operation encapsulates a single business action; pure Kotlin and easily testable.
  • Operator Invoke Pattern: Use cases implement operator fun invoke(...) to expose a natural, function-like API.
  • Flow-Based Composition: Compose results with Flows for reactive, streaming scenarios.
  • Parameterized Use Cases: Support multi-parameter inputs via dedicated parameter data classes.
  • Orchestration Examples: Examples include GetUserProfileUseCase, ObserveUserUseCase, and aggregated dashboards using multiple repositories.

Quick Start

Create a simple GetUserProfileUseCase with a UserRepository and a PreferencesRepository, implement operator fun invoke(userId: String), then call it to obtain a UserProfile.

Frequently Asked Questions about usecase-expert

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure use cases in Kotlin Multiplatform to keep domain logic testable?

Use cases in Kotlin Multiplatform keep domain logic testable by encapsulating single business actions in pure Kotlin classes. They implement the operator fun invoke pattern to expose a natural API while remaining free from framework dependencies.

What is the operator invoke pattern for designing interactors in KMP?

The operator invoke pattern for interactors in KMP allows use cases to be called like functions. By implementing operator fun invoke(...) in pure Kotlin, use cases expose a natural API for executing domain operations while maintaining single-responsibility design.

How do I orchestrate multiple repositories in a KMP domain layer?

You orchestrate multiple repositories in a KMP domain layer by composing use cases that aggregate data streams. Use Flows for reactive streaming scenarios to combine results from repositories like UserRepository and PreferencesRepository into a unified output.

Can I pass multiple parameters to a single-responsibility use case in Kotlin?

Yes, you can pass multiple parameters to a single-responsibility use case in Kotlin by using dedicated parameter data classes. This approach maintains clean architecture by grouping inputs logically while keeping the use case execution API simple.

Does use case design in Kotlin Multiplatform require any specific frameworks?

Use case design in Kotlin Multiplatform does not require any specific frameworks. The architecture relies on pure Kotlin implementations and flow-based orchestration, ensuring strong testability and single-responsibility domain logic without framework dependencies.