agentsclimarketplace

Mavericks mvi

Skill ujffdi/mavericks-mvi-skills/skills/mavericks-mvi

Install
npx -y skills add ujffdi/mavericks-mvi-skills --skill mavericks-mvi

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Use when creating or modifying Mavericks 3.x State, MavericksState, MavericksViewModel, AssistedViewModelFactory, hiltMavericksViewModelFactory, ViewModelModule binding, initial args, Compose mavericksViewModel, collectAsStateWithLifecycle, Fragment MavericksView subscriptions, Async execute, setState, withState, DeliveryMode, uniqueOnly, or one-shot effects

SKILL.md

4.2 KB, as published. Nobody here has run it

Mavericks MVI Guide

Mavericks screens are rendered from immutable state. Keep state data-only, reducers pure, and side effects in ViewModel methods or UI consumers.

Quick Reference

TaskUse
Define screen statedata class XxxState(...) : MavericksState
Create Hilt VM@AssistedInject + @Assisted initialState + Factory + hiltMavericksViewModelFactory()
Register VM@Binds @IntoMap @ViewModelKey in the owning ViewModelModule
One-shot requestsuspend { repo.call() }.execute { copy(request = it) }
Long-lived Flow to normal stateflow.setOnEach { value -> copy(value = value) }
Refresh without UI flicker.execute(retainValue = State::request) { ... }
Compose VMmavericksViewModel() or mavericksViewModel(argsFactory = { args })
Compose statevm.collectAsStateWithLifecycle(State::prop)
Fragment VMby fragmentViewModel() / activityViewModel() / parentFragmentViewModel()
Fragment statevm.onEach(State::prop) { ... }
Fragment one-shotvm.onEach(State::effect, deliveryMode = uniqueOnly()) { ... }
Read current state in VMwithState { state -> ... } or suspend awaitState()

Core Rules

  • State must be immutable, public, data-only, and reducer-safe.
  • Hilt Mavericks VMs must use @AssistedInject, @Assisted initialState, @AssistedFactory, and hiltMavericksViewModelFactory().
  • Every Hilt Mavericks VM must be bound with @Binds @IntoMap @ViewModelKey.
  • Use execute for finite async work represented by Async<T>.
  • Use setOnEach for long-lived Flows that map directly to ordinary State fields.
  • Use Mavericks lifecycle-aware Compose collection: com.airbnb.mvrx.compose.collectAsStateWithLifecycle.
  • DeliveryMode is only for MavericksView subscriptions, not ViewModel onEach and not Compose.
  • Effects are a project pattern on top of State; nullable single effects are not queues.

Read Only What You Need

Common Pitfalls

PitfallFix
Missing State defaults with no args pathAdd defaults or initialize through args/initialState()
Mutable State fieldUse immutable/read-only types and copy on update
Storing derived valuesUse computed properties
Reading immediately after setStateUse reducer state, withState, or awaitState()
Heavy work inside reducerMove work before setState or into execute(dispatcher)
Long action inside VM onEach gets cancelledonEach uses collectLatest; move long work elsewhere
Flow wrapped in execute when no Async is neededUse setOnEach
UI flickers during refreshUse retainValue
Rendering state with uniqueOnly()Use default delivery mode
Compose using legacy collectAsStateUse Mavericks collectAsStateWithLifecycle
Required Compose args omittedUse mavericksViewModel(argsFactory = { args })
Effect fires twice after Fragment restartUse uniqueOnly() and clear after handling
Multiple effects lostUse a list/queue or redesign event semantics
Hilt VM creation crashesCheck @AssistedFactory, companion factory, and ViewModelModule binding

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.