Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/ashtanko/compose-android-template/compose-state-deferred-readsnpx skills add ashtanko/compose-android-template --skill compose-state-deferred-readsgit clone --depth 1 https://github.com/ashtanko/compose-android-templateWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/ashtanko/compose-android-template/compose-state-deferred-reads)<a href="https://agentmods.dev/skills/ashtanko/compose-android-template/compose-state-deferred-reads"><img src="https://agentmods.dev/badge/skills/ashtanko/compose-android-template/compose-state-deferred-reads.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00060 | $0.02297 |
| Opus 5 | $0.00030 | $0.01149 |
| Sonnet 5 | $0.00012 | $0.00459 |
| Haiku 4.5 | $0.00006 | $0.00230 |
Grade A, and why
compose-state-deferred-reads scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 208 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Compose state deferred reads
Core principle
State reads invalidate the phase that reads them. If a State<T> is read in a composable body, changes invalidate composition. If it is read in layout or draw, changes can invalidate only layout or draw. Frame-rate state such as scroll offsets, animations, and drag positions usually belongs in layout/draw, not composition.
Back-writing is the symmetric failure mode: writing observable state from a phase that triggers invalidation of an earlier phase. Compose phases run composition → layout → draw. Writing snapshot-backed state from layout or draw to state read in composition invalidates composition; writing during composition to state read earlier in the same composition does the same. Both schedule extra work — often cascading into sibling lazy items.
The fix is structural: keep the State<T> or a provider lambda and read the value inside a layout/draw callback; capture measurements in callbacks and apply them in the measure phase, not by reading measurement state in sibling composable bodies.
When to use this skill
val x by animate*AsState(...)is passed toModifier.offset(x = ...),Modifier.size(...),Modifier.graphicsLayer(...), or another value-form modifier.LazyListState.firstVisibleItemScrollOffset,ScrollState.value,Animatable.value, or gesture state is read in a composable body.- A composable takes
scrollOffset: Int,progress: Float,dragOffset: Offset, or similar frame-rate values. - Recomposition counters climb during scroll, animation, or gestures even when data is stable.
- A composable body calls
stateMap[key] = …,list.addAll(…), or similar on every recomposition (back-writing composition → composition). - One lazy item captures size with
onSizeChanged/onGloballyPositionedand a sibling reads that height in composition (Modifier.height(state.dp)) — back-writing layout → composition.
0. Back-writing
Back-writing = writing observable state in one phase that triggers invalidation of an earlier (or the current) phase. Compose runs composition → layout → draw, so:
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 6d ago First seen · 208 lines · 60 tokens per session scan A cd5296050e11
compose-state-deferred-reads is a skill published in the GitHub repository ashtanko/compose-android-template (10 stars, last pushed 2d ago), licensed MIT. It adds 60 tokens to every session and 2,297 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
optimizing-lazy-layouts
Use this skill to fix scroll jank, lost item state, and broken animateItem() animations in LazyColumn, LazyRow, LazyVerticalGrid, and LazyHorizontalGrid. Covers stable item keys, contentType for mixed-type feeds, Modifier.animateItem() requirements, hoisting modifier chains and painters out of the items lambda, and…
deferring-state-reads
Use this skill to push frequently-changing Jetpack Compose state reads (scroll position, animation values, drag offsets) out of the Composition phase and down into Layout or Draw using lambda-based modifiers like Modifier.offset { }, Modifier.layout { }, Modifier.graphicsLayer { }, Modifier.drawBehind { }, and…
preserving-state-across-reloads
Use this skill to keep Jetpack Compose state alive across HotSwan hot reloads by understanding the three escalating tiers Compose HotSwan uses (tier 1 targeted recomposition, tier 2 composition reset, tier 3 Activity.recreate) and choosing edits and state holders that stay inside tier 1 where scroll position, lazy…
choosing-derivedstateof
Use this skill to decide when Jetpack Compose derivedStateOf is the right tool and when it is pure overhead. Covers the "input frequency must exceed output frequency" rule, the mandatory remember { derivedStateOf { } } wrapper, the canonical pitfall of capturing non-state variables by initial value (and the…
collapsing-parallax-toolbar
Build a collapsing header from five siblings in one box — four sharing a single scroll state, one driven by a boolean instead — with artwork moved by a graphics layer at half the scroll rate, a title interpolated along a two-segment curve into the pinned bar, and a derived flip point that swaps the floating back…
expect-actual-composable-capability
Expose a device capability to shared Compose code as a @Composable expect function, with a full implementation on the platform that has it and a stub that returns the neutral value on the platform that does not. Covers the three shapes these take — a measurement, an effect with an undo, and a subscription read as…