en un clic
framework-toothpick
// Trigger: Dependency Injection. Managing Toothpick scopes, binding modules, and implementing constructor or provider-based injection.
// Trigger: Dependency Injection. Managing Toothpick scopes, binding modules, and implementing constructor or provider-based injection.
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: Presenter Logic. Managing Moxy MVP state, Presenter lifecycle, and view delegation without @InjectPresenter.
| name | framework-toothpick |
| description | Trigger: Dependency Injection. Managing Toothpick scopes, binding modules, and implementing constructor or provider-based injection. |
Serenity uses hierarchical scopes to manage object lifecycles.
Use @InjectConstructor to allow Toothpick to automatically instantiate and inject dependencies.
@InjectConstructor
class MyRepository(private val api: MyApi) { ... }
Useful for lazy initialization or breaking circular dependencies.
@Inject
lateinit var presenterProvider: Provider<MainPresenter>
Used in components where constructor injection isn't possible (e.g., legacy classes, some base classes).
init {
Toothpick.inject(this, Toothpick.openScope(InjectionConstants.APPLICATION_SCOPE))
}
Bindings are defined in Module classes.
class MyModule : Module() {
init {
bind(MyService::class.java).to(MyServiceImpl::class.java).singleton()
bind(MyRepository::class.java).toInstance(myRepositoryInstance)
}
}
Extend InjectingActivity or InjectingMvpActivity to have scopes managed automatically.
class MyActivity : InjectingActivity() {
@Inject lateinit var myService: MyService
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Injection happens in super.onCreate()
}
}