بنقرة واحدة
add-interactor
Scaffold a new Strata interactor with interface, implementation, fake, and test
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Scaffold a new Strata interactor with interface, implementation, fake, and test
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Quick review of the current diff for bugs, logic errors, convention violations, and test gaps
Scaffold a new feature module with the appropriate layers and MESA conventions
Add a new screen to an existing feature module with StateHolder, UI, factories, and tests
Add missing test cases, targeting a specific file or all changed files on the branch
Bump library versions in gradle.properties and prepare release notes
Diagnose and fix an error from a build failure, stack trace, or error message
| name | add-interactor |
| description | Scaffold a new Strata interactor with interface, implementation, fake, and test |
| disable-model-invocation | true |
| argument-hint | <feature-name> <InteractorName> [--observe] |
Scaffold a new Strata interactor for an existing feature module, including the public interface, implementation, fake, and test.
Input: $ARGUMENTS
Extract:
summary)FetchUser, ObserveLastSavedValue)StrataInteractor (one-shot async, returns StrataResult<R>)--observe → StrataSubjectInteractor (stream, exposes Flow<T> via .flow)Verify the feature module exists at features/<feature-name>/. If it doesn't exist, stop and ask the user whether they intended a different feature name or whether they need to create the feature first with /add-feature. Do not proceed until the feature exists.
Ask the user:
Int, String, Unit)User, List<Item>, Int?)Read the feature module's existing files to understand:
build.gradle.kts dependenciesapi/Place at: features/<feature-name>/api/src/main/java/<package>/api/<InteractorName>.kt
StrataInteractor (one-shot):
abstract class <InteractorName> : StrataInteractor<P, R>()
StrataSubjectInteractor (observe):
abstract class <InteractorName> : StrataSubjectInteractor<P, T>()
domain/Place at: features/<feature-name>/domain/src/main/java/<package>/domain/<InteractorName>Impl.kt
StrataInteractor (one-shot):
@ContributesBinding(AppScope::class)
class <InteractorName>Impl @Inject constructor(
// dependencies
) : <InteractorName>() {
override suspend fun doWork(params: P): R {
TODO("Implement")
}
}
StrataSubjectInteractor (observe):
@ContributesBinding(AppScope::class)
class <InteractorName>Impl @Inject constructor(
// dependencies
) : <InteractorName>() {
override fun createObservable(params: P): Flow<T> {
TODO("Implement")
}
}
Create the Fake in both src/test/ and src/androidTest/ test subpackages where test files exist for the feature (they do not share code).
Place in the consuming module's test directory under a fakes/ subpackage (e.g., <consuming-module>/src/test/java/<package>/<layer>/fakes/Fake<InteractorName>.kt). Typically this is the presentation module's test source, but use whichever module actually depends on the interactor.
StrataInteractor Fake:
class Fake<InteractorName>(
private val shouldFail: Boolean = false
) : <InteractorName>() {
val invocations = mutableListOf<P>()
override suspend fun doWork(params: P): R {
if (shouldFail) throw IllegalStateException("<InteractorName> failed for testing")
invocations.add(params)
TODO("Return test value")
}
}
StrataSubjectInteractor Fake:
class Fake<InteractorName> : <InteractorName>() {
val valueFlow = MutableStateFlow<T>(/* initial value */)
override fun createObservable(params: P): Flow<T> = valueFlow
}
domain/Place at: features/<feature-name>/domain/src/test/java/<package>/domain/<InteractorName>ImplTest.kt
class <InteractorName>ImplTest : BehaviorSpec({
Given("a <InteractorName> that succeeds") {
When("invoked with params") {
Then("it returns the expected result") {
val subject = <InteractorName>Impl(/* faked dependencies */)
val result = subject(params)
result.shouldBeInstanceOf<StrataResult.Success<*>>()
// assert result.data
}
}
}
Given("a <InteractorName> that fails") {
When("invoked") {
Then("it returns Failure") {
// setup dependency to fail
val subject = <InteractorName>Impl(/* faked dependencies */)
val result = subject(params)
result.shouldBeInstanceOf<StrataResult.Failure>()
}
}
}
})
For StrataSubjectInteractor, test the flow output using Turbine:
class <InteractorName>ImplTest : BehaviorSpec({
Given("a <InteractorName>") {
When("observed") {
Then("it emits the expected values") {
val subject = <InteractorName>Impl(/* faked dependencies */)
subject(params)
subject.flow.test {
awaitItem() shouldBe expectedValue
}
}
}
}
})
All generated files MUST include the Apache 2.0 license header:
/*
* Copyright 2026 Jason Jamieson
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Run ./gradlew :<feature-module>:compileDebugKotlin for the affected modules (api, domain) to verify compilation.
Report: