com um clique
framework-moxy
// Trigger: Presenter Logic. Managing Moxy MVP state, Presenter lifecycle, and view delegation without @InjectPresenter.
// Trigger: Presenter Logic. Managing Moxy MVP state, Presenter lifecycle, and view delegation without @InjectPresenter.
Test-driven development with red-green-refactor loop. MUST be triggered during ANY coding session involving feature implementation or bug fixes or specifications.
Evaluates skills based on discoverability, agent-friendliness, and consumption efficiency. Returns a Letter Grade (A+ to F) and actionable coaching.
Validating agent skills against the agentskills.io specification and generating compliance reports.
Trigger: Data Flow & Modules. Implementing Repositories, managing cross-module boundaries, and handling async work with Coroutines.
Trigger: Pre-Commit/Final Review. Validating code against Serenity’s 'Golden Standards' for architecture, security, performance, and testing before merging.
Trigger: Dependency Injection. Managing Toothpick scopes, binding modules, and implementing constructor or provider-based injection.
| name | framework-moxy |
| description | Trigger: Presenter Logic. Managing Moxy MVP state, Presenter lifecycle, and view delegation without @InjectPresenter. |
Serenity uses Kotlin delegation for Moxy presenters to maintain a clean lifecycle and support Dependency Injection.
DO NOT use @InjectPresenter. Instead, inject a Provider and use the moxyPresenter delegate.
@Inject
lateinit var presenterProvider: Provider<MainPresenter>
internal val presenter by moxyPresenter { presenterProvider.get() }
Define a view interface that extends MvpView. Use Moxy strategy annotations to control how commands are queued.
@StateStrategyType(AddToEndSingleStrategy::class)
interface MainView : MvpView {
fun displayData(items: List<VideoContent>)
fun showLoading()
fun hideLoading()
}
Presenters should extend MvpPresenter<ViewInterface>.
class MainPresenter @InjectConstructor(
private val repository: VideoRepository
) : MvpPresenter<MainView>() {
override fun onFirstViewAttach() {
super.onFirstViewAttach()
loadData()
}
private fun loadData() {
// logic using repository and updating viewState
viewState.showLoading()
// ...
}
}
Ensure the presenter is available in the Toothpick scope, usually via @InjectConstructor.
For Activities, the injection usually happens in super.onCreate() when extending InjectingMvpActivity.