dre-integrate

Integrates the dre-kt Dispatch-Reduce-Effects pattern into Android and Kotlin projects.

Updated May 31, 2026
One-click install
npx skills add https://github.com/decoutkhanqindev/Lich-Viet-Loc-Phat --skill dre-integrate-decoutkhanqindev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dre-integrate
Source: https://github.com/decoutkhanqindev/Lich-Viet-Loc-Phat/tree/main/.claude/skills/dre-integrate
Command: npx skills add https://github.com/decoutkhanqindev/Lich-Viet-Loc-Phat --skill dre-integrate-decoutkhanqindev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Adopting a unidirectional data flow architecture in an Android/Kotlin project requires repetitive boilerplate: adding dependencies, defining State/Action/Effect/AsyncOp contracts, writing pure reducers, and wiring ViewModels. This Skill automates the setup, scaffolding, and migration work for the dre-kt (Dispatch → Reduce → Effects) library. ## Core Features & Use Cases - Project Setup: Detects project type (Android app, Android library, or pure Kotlin), adds the correct dre-core or dre-android Maven dependency, and verifies resolution via Gradle. - Feature Scaffolding: Generates Contract, Reducer, and ViewModel files for a new feature, with variants for features that need async operations, side effects, or neither. - MVI/MVVM Migration: Analyzes an existing ViewModel, maps MutableStateFlow updates, viewModelScope.launch blocks, and side effects to DRE types, then produces a pure Reducer and a slim DreStoreViewModel. - Use Case: You have a LoginViewModel that mutates StateFlow directly and calls a repository inside viewModelScope. Run the migrate subcommand to convert it into a pure LoginReducer, a LoginAsyncOp for the repository call, and a thin DreStoreViewModel, then verify with a Gradle compile. ## Quick Start Ask the assistant to run dre-integrate setup to add the dre-kt dependency, then scaffold a new feature such as login with Contract, Reducer, and ViewModel files.

Frequently Asked Questions about dre-integrate

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

FAQPage Schema
How do I add dre-kt to an Android Kotlin project?

Add implementation("io.github.dantech0xff:dre-android:0.1.0") to your app module's build.gradle.kts dependencies block and ensure mavenCentral() is in your repositories. The dre-android artifact includes dre-core transitively. Verify with ./gradlew :app:dependencies.

How do I migrate an MVVM ViewModel to the DRE pattern?

Map MutableStateFlow state to a data class implementing DreState, public methods to a sealed DreAction interface, viewModelScope.launch blocks to a DreAsyncOp type, and navigation or toast events to DreEffect. Move all state mutation into a pure Reducer and let the ViewModel extend DreStoreViewModel.

What is the difference between dre-core and dre-android?

dre-core is platform-agnostic and provides DreStore, Reducer, ReduceResult, and marker interfaces for pure Kotlin projects. dre-android adds DreStoreViewModel, an Android ViewModel wrapper around DreStore, and includes dre-core transitively.

Can I use DRE for features without async operations?

Yes. Use SimpleReducer with SimpleReduceResult and pass Nothing as the AsyncOp type to DreStoreViewModel via asFullReducer(). The executeAsyncOp override takes a Nothing parameter and is never called.

Why must the reducer be pure in the DRE pattern?

The Reducer must be deterministic and free of I/O, coroutines, and side effects so state transitions are testable and predictable. Any suspend work belongs in executeAsyncOp, which dispatches a result action back into the store when finished.

How do I unit test a DRE reducer?

Use the assertReduce test utility to check the resulting state, sideEffects, and asyncOp for a given state and action, and assertNoChange to verify guard clauses reject invalid actions without modifying state.