choosing-derivedstateof

choosing-derivedstateof is a skill for Claude Code, Codex from skydoves/compose-performance-skills. It costs 144 tokens per session (2,775 once invoked), scanned A, original, Apache-2.0.

Guidance for deciding when Jetpack Compose's derivedStateOf should filter rapidly changing state into a less frequently changing result. State is information that can change and update the user interface; recomposition is Compose rebuilding affected interface code.

In plain words
What is it for?
Use it for scroll thresholds, drag or animation values, and other cases where frequent input produces a simpler result such as a boolean or bucketed number.
Why use it?
It prevents unnecessary complexity when the tool will not reduce updates and helps avoid values that stop updating because they were captured too early.

Skill for Claude CodeCodex

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

Good fit Use it for scroll thresholds, drag or animation values, and other cases where frequent input produces a simpler result such as a boolean or bucketed number.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/skydoves/compose-performance-skills/choosing-derivedstateof
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 choosing-derivedstateof
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 choosing-derivedstateof

README.md
[![agentmods](https://agentmods.dev/badge/skills/skydoves/compose-performance-skills/choosing-derivedstateof.svg)](https://agentmods.dev/skills/skydoves/compose-performance-skills/choosing-derivedstateof)
Your own site
<a href="https://agentmods.dev/skills/skydoves/compose-performance-skills/choosing-derivedstateof"><img src="https://agentmods.dev/badge/skills/skydoves/compose-performance-skills/choosing-derivedstateof.svg" alt="Measured on agentmods" height="20"></a>
Per session 144 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,775 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.00144 $0.02775
Opus 5 $0.00072 $0.01388
Sonnet 5 $0.00029 $0.00555
Haiku 4.5 $0.00014 $0.00278

Measured 8d ago against content hash 9c54c81c0e1e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

choosing-derivedstateof 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 8d 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/choosing-derivedstateof/SKILL.md · 194 lines

How it starts

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

Choosing derivedStateOf — Filter Hot Inputs into Cold Outputs

derivedStateOf produces a State whose readers only invalidate when the derived result changes, even if the input states change far more often. Use it when input frequency exceeds output frequency. Use it for any other shape and it is pure overhead — an extra snapshot subscription with no filtering benefit. This skill teaches Claude when to reach for it, when to refuse, and how to avoid the canonical capture-by-initial-value pitfall.

When to use this skill

  • The developer asks whether a value should be wrapped in derivedStateOf.
  • A scroll position drives a boolean (firstVisibleItemIndex == 0, scrollState.value > threshold, "show FAB on scroll").
  • A high-frequency input (drag delta, animation progress) feeds a low-frequency output (boolean threshold, bucketed integer).
  • A derivedStateOf exists in the code but recomposition counts didn't drop, or the value never updates after the first composition (the capture-by-initial-value bug).
  • The developer wants a one-shot side effect (analytics, logging, snackbar) when a derived value flips.

When NOT to use this skill

  • The state read is in the wrong phase (e.g. Modifier.alpha(state.value)). Fix that with ../deferring-state-reads/SKILL.md first — derivedStateOf does not address phase issues.
  • Diagnosing whether a parameter is unstable. That is ../../stability/diagnosing-compose-stability/SKILL.md.
  • Input frequency equals output frequency (e.g. "$first $last" from two name states). derivedStateOf is pure overhead in that case — use a direct read or a plain remember.

Prerequisites

  • Familiarity with state-read-driven recomposition: a snapshot read inside a restartable composable subscribes that composable's restart scope to the state.
  • Compose runtime ≥ 1.0 (the API is foundational; behavior described here is stable).
  • Ability to confirm recomposition counts via Layout Inspector or @TraceRecomposition from skydoves/compose-stability-analyzer.

Read the full file on GitHub · 194 lines

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. 8d ago First seen · 194 lines · 144 tokens per session scan A 9c54c81c0e1e

Subscribe to this mod's changes

choosing-derivedstateof is a skill published in the GitHub repository skydoves/compose-performance-skills (499 stars, last pushed 2mo ago), licensed Apache-2.0. It adds 144 tokens to every session and 2,775 once invoked, about $0.0007 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-30.

Related

Other skills, from other repositories

claude-android-ninja

Build and migrate Android apps with Kotlin, Jetpack Compose, MVVM, Hilt, Room 3 (KSP, SQLiteDriver, Flow/suspend DAOs), Navigation3, and multi-module Gradle. Use for new projects or modules, Compose screens and ViewModels, Room 3 and RemoteMediator, API 37 / targetSdk migration, Play Integrity client wiring…

Drjacky/claude-android-ninja · 123 tokens

compose-slot-api-pattern

Use when designing or reviewing a reusable Jetpack Compose component whose visual regions vary by caller, or when primitive content parameters and boolean shape flags are accumulating.

ashtanko/compose-android-template · 35 tokens

compose-state-deferred-reads

Use when Jetpack Compose code reads scroll, animation, gesture, or other frame-rate State in composition, passes changing values across composable boundaries, uses value-form layout/draw modifiers, or back-writes observable state from a later phase into one that's already run.

ashtanko/compose-android-template · 60 tokens

compose-state-hoisting

Use when deciding where Jetpack Compose UI element state or UI logic should live: local remember state, hoisted composable parameters, a plain state holder class, or a screen-level ViewModel/component.

ashtanko/compose-android-template · 45 tokens

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…

maxrave-dev/kotlin-footguns · 119 tokens

empty-state-must-keep-its-navigation

Replace a populated header with an empty-state message without deleting the controls that header owned — re-supply them only in the branch that owned them, order the loading branch above the empty one, and stop reserving the artwork's height for a line of text. Use when a user reaches an empty period, filter or search…

maxrave-dev/kotlin-footguns · 98 tokens