Skip to content

Commit 3f2245f

Browse files
committed
chore: improve agent rules
1 parent 36bce2d commit 3f2245f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

AGENTS.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ suspend fun getData(): Result<Data> = withContext(Dispatchers.IO) {
174174
- ALWAYS pass the TAG as context to `Logger` calls, e.g. `Logger.debug("message", context = TAG)`
175175
- ALWAYS use the Result API instead of try-catch
176176
- NEVER wrap methods returning `Result<T>` in try-catch
177-
- PREFER to use `it` instead of explicit parameters in lambdas e.g. `fn().onSuccess { log(it) }.onFailure { log(it) }`
177+
- PREFER to use `it` instead of explicit named parameters in lambdas e.g. `fn().onSuccess { log(it) }.onFailure { log(it) }`
178178
- NEVER inject ViewModels as dependencies - Only android activities and composable functions can use viewmodels
179179
- NEVER hardcode strings and always preserve string resources
180180
- ALWAYS localize in ViewModels using injected `@ApplicationContext`, e.g. `context.getString()`
@@ -193,15 +193,16 @@ suspend fun getData(): Result<Data> = withContext(Dispatchers.IO) {
193193
- ALWAYS split screen composables into parent accepting viewmodel + inner private child accepting state and callbacks `Content()`
194194
- ALWAYS name lambda parameters in a composable function using present tense, NEVER use past tense
195195
- ALWAYS list 3 suggested commit messages after implementation work
196-
- NEVER use `wheneverBlocking` when in an unit test where you're using expression body and already wrapping the test with a `= test {}` lambda.
196+
- NEVER use `wheneverBlocking` in unit test expression body functions wrapped in a `= test {}` lambda
197+
- ALWAYS wrap unit tests `setUp` methods mocking suspending calls with `runBlocking`, e.g `setUp() = runBlocking { }`
197198
- ALWAYS add business logic to Repository layer via methods returning `Result<T>` and use it in ViewModels
198199
- ALWAYS use services to wrap RUST code exposed via bindings
199200
- ALWAYS order upstream architectural data flow this way: `UI -> ViewModel -> Repository -> RUST` and vice-versa for downstream
200201
- ALWAYS add new localizable string string resources in alphabetical order in `strings.xml`
201202
- NEVER add string resources for strings used only in dev settings screens and previews and never localize acronyms
202203
- ALWAYS use template in `.github/pull_request_template.md` for PR descriptions
203204
- ALWAYS wrap `ULong` numbers with `USat` in arithmetic operations, to guard against overflows
204-
- PREFER to use one-liners with `run {}` when applicable, e.g. `override fun someCall(value: String) = run { this.value = value}`
205+
- PREFER to use one-liners with `run { }` when applicable, e.g. `override fun someCall(value: String) = run { this.value = value }`
205206

206207
### Architecture Guidelines
207208

0 commit comments

Comments
 (0)