deferring-state-reads

deferring-state-reads is a skill for Claude Code, Codex from skydoves/compose-performance-skills. It costs 167 tokens per session (3,505 once invoked), scanned A, original, Apache-2.0.

A guide to moving frequently changing Jetpack Compose state reads into a later rendering phase. Compose builds a screen in stages—composition, layout, and drawing—so a read in an earlier stage can trigger more work.

In plain words
What is it for?
Use it to diagnose and fix janky scrolling, animations, or drag gestures. It covers lambda-based modifiers such as offset, layout, graphicsLayer, and drawBehind for reading changing values later.
Why use it?
It helps reduce dropped frames and unnecessary full-screen updates during scrolling, dragging, and animation. The problem is that reading a value too early can make a large part of the screen run again on every frame.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to diagnose and fix janky scrolling, animations, or drag gestures. It covers lambda-based modifiers such as offset, layout, graphicsLayer, and drawBehind for reading changing values later.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/skydoves/compose-performance-skills/deferring-state-reads
Install

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.

Any agent
npx skills add skydoves/compose-performance-skills --skill deferring-state-reads
Clone the repo
git clone --depth 1 https://github.com/skydoves/compose-performance-skills

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for deferring-state-reads

README.md
[![agentmods](https://agentmods.dev/badge/skills/skydoves/compose-performance-skills/deferring-state-reads/github.svg)](https://agentmods.dev/skills/skydoves/compose-performance-skills/deferring-state-reads)
Your own site
<a href="https://agentmods.dev/skills/skydoves/compose-performance-skills/deferring-state-reads"><img src="https://agentmods.dev/badge/skills/skydoves/compose-performance-skills/deferring-state-reads/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for deferring-state-reads

Your own site · 80×15
<a href="https://agentmods.dev/skills/skydoves/compose-performance-skills/deferring-state-reads"><img src="https://agentmods.dev/badge/skills/skydoves/compose-performance-skills/deferring-state-reads.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 167 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,505 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00167 $0.03505
Opus 5.5 $0.00067 $0.01402
Sonnet 5.5 $0.00033 $0.00701
Haiku 4.5 $0.00017 $0.00350

Measured 3mo ago against content hash 7460331dcab2, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

deferring-state-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 3mo 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.

recomposition/deferring-state-reads/SKILL.md · 255 lines

How it starts

The opening of the file, as written. The whole thing — 255 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Deferring State Reads — Move Hot Reads from Composition to Draw

Compose runs three phases per frame — Composition → Layout → Draw. A state read at phase N invalidates phase N and every phase below it. The single biggest perf win in any animation- or scroll-driven UI is moving a state read from Composition down to Layout or Draw via a lambda-based modifier. This skill teaches Claude how to spot the wrong-phase read and migrate it.

When to use this skill

  • An animation triggers full subtree recomposition on every frame (Modifier.alpha(progress.value), Modifier.offset(x.dp), Modifier.padding(state.dp) — padding has no lambda overload, so use Modifier.layout { ... } or Modifier.offset { IntOffset(...) } instead when the inset is animated).
  • A scroll position is read directly in a composable body (val y = scrollState.value) and the parent recomposes on every pixel of scroll.
  • The developer says "every frame", "scroll jank", "animation jank", "dropped frames", or reports the whole screen recomposing on drag.
  • A @TraceRecomposition log shows the parent's recomposition counter incrementing once per animation tick.
  • The developer is passing a hot value (animation progress, scroll offset, drag delta) as a Float parameter across composables.

When NOT to use this skill

  • The state changes once per user interaction (button click, dialog open) — the lambda-modifier rewrite buys nothing and adds noise.
  • The state read genuinely needs to drive Composition (show/hide a different composable, swap a different component tree). Lambda modifiers cannot decide which composable to emit.
  • The non-skippable parent is non-skippable for a different reason (unstable parameter). Diagnose with ../../stability/diagnosing-compose-stability/SKILL.md first.
  • The developer wants to filter many high-frequency inputs into one rare boolean — that is ../choosing-derivedstateof/SKILL.md.

Prerequisites

  • Familiarity with the three-phase model. If unsure which phase a read happens in, read references/three-phases.md before doing the migration.
  • Compose UI 1.7+ for rememberGraphicsLayer() and the modern Modifier.animateItem() shape. Lambda forms of Modifier.offset { }, Modifier.graphicsLayer { }, Modifier.drawBehind { }, and Modifier.drawWithCache { } exist on every supported Compose version.
  • Ability to confirm recomposition counts in Layout Inspector or via @TraceRecomposition (see ../debugging-recompositions/SKILL.md if it exists in this repo, otherwise the skydoves compose-stability-analyzer runtime).
  • A release build for any final measurement — debug builds run interpreted and lie about cost.

Read the full file on GitHub · 255 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

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.

  1. 3mo ago First seen · 255 lines · 167 tokens per session scan A 7460331dcab2

Subscribe to this mod's changes

deferring-state-reads is a skill published in the GitHub repository skydoves/compose-performance-skills (536 stars, last pushed 5mo ago), licensed Apache-2.0. It adds 167 tokens to every session and 3,505 once invoked, about $0.0007 per session on Opus 5.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-30.

Related

deferring-state-reads compared with skills from other repositories

deferring-state-reads next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
deferring-state-readsskydoves/compose-performance-skillsSkill5365mo agoApache-2.0A167Claude Code, Codex
claude-android-ninjaDrjacky/claude-android-ninjaSkill1432mo agoApache-2.0A123Claude Code, Codex
rebrandmykola-kichatov/android-clean-templateSkill541mo agononeC89Claude Code
sceneviewsceneview/sceneviewSkill1.4ktodayApache-2.0A71Claude Code, Codex
sceneview-iossceneview/sceneviewSkill1.4ktodayApache-2.0A71Claude Code, Codex
compose-animationschrisbanes/skillsSkill1.2k2d agoApache-2.0A67Claude Code
compose-focus-navigationchrisbanes/skillsSkill1.2k2d agoApache-2.0A41Claude Code