preserving-state-across-reloads

preserving-state-across-reloads is a skill for Claude Code, Codex from skydoves/compose-performance-skills. It costs 189 tokens per session (2,627 once invoked), scanned A, original, Apache-2.0.

Guidance for keeping Jetpack Compose interface state during HotSwan hot reloads. Jetpack Compose is Android’s system for describing app screens, while hot reload updates code without a full app restart.

In plain words
What is it for?
It helps choose edits and state holders that stay within the least disruptive reload level, and explains what survives when a reload must recreate more of the screen or app.
Why use it?
It helps prevent scroll positions, navigation, dialogs, selections, and other temporary state from resetting while editing code.

Skill for Claude CodeCodex

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

Good fit It helps choose edits and state holders that stay within the least disruptive reload level, and explains what survives when a reload must recreate more of the screen or app.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/skydoves/compose-performance-skills/preserving-state-across-reloads/github.svg)](https://agentmods.dev/skills/skydoves/compose-performance-skills/preserving-state-across-reloads)
Your own site
<a href="https://agentmods.dev/skills/skydoves/compose-performance-skills/preserving-state-across-reloads"><img src="https://agentmods.dev/badge/skills/skydoves/compose-performance-skills/preserving-state-across-reloads/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 preserving-state-across-reloads

Your own site · 80×15
<a href="https://agentmods.dev/skills/skydoves/compose-performance-skills/preserving-state-across-reloads"><img src="https://agentmods.dev/badge/skills/skydoves/compose-performance-skills/preserving-state-across-reloads.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 189 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,627 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.00189 $0.02627
Opus 5 $0.00095 $0.01314
Sonnet 5 $0.00038 $0.00525
Haiku 4.5 $0.00019 $0.00263

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

Security

Grade A, and why

preserving-state-across-reloads 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 11d 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.

hot-reload/preserving-state-across-reloads/SKILL.md · 193 lines

How it starts

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

Preserving State Across Reloads: keep edits inside HotSwan tier 1

Compose HotSwan applies every hot reload through three escalating tiers. Tier 1 (targeted recomposition) preserves the most: scroll position, navigation back stack, remember and rememberSaveable values, ViewModel state, lazy layout items, dialog and bottom sheet state. Tier 2 (composition reset) disposes and recreates compositions, dropping per-composable remember. Tier 3 (Activity.recreate()) restarts the Activity and only state held by ViewModel or SavedInstanceState survives.

The iteration loop is fastest and least surprising when every reload stays inside tier 1. This skill covers which edits trigger which tier, which state holders survive each tier, and how to hoist transient UI state when an edit must escalate.

When to use this skill

  • The developer reports "scroll jumped to top after a hot reload", "lost dialog state", "lazy column re-fetched", or "tab selection reset to zero".
  • The developer is about to refactor a composable and wants to know which recomposition scope the change touches.
  • The HotSwan tool window status shows a tier 2 or tier 3 reload and the developer wants to understand why it escalated.
  • The developer asks which state holders survive Activity.recreate() versus a composition reset.
  • The user mentions "tier 1", "tier 2", "tier 3", "composition reset", "HotSwan state preservation", or "rememberSaveable across reload".

When NOT to use this skill

  • The change was rejected as a schema violation entirely (added a parameter, changed a constructor, added a new resource ID) and HotSwan fell back to a full incremental build. See ../understanding-hot-reload-limits/SKILL.md.
  • HotSwan is not installed or the watcher is not running. See ../setting-up-compose-hotswan/SKILL.md.
  • The developer wants an AI agent to drive the loop autonomously. See ../iterating-with-ai-and-mcp/SKILL.md.
  • The recomposition itself is too wide independent of hot reload (a parent invalidating a whole subtree on every state tick). Diagnose with ../../recomposition/debugging-recompositions/SKILL.md first.

Read the full file on GitHub · 193 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. 11d ago First seen · 193 lines · 189 tokens per session scan A be2f8009a07f

Subscribe to this mod's changes

preserving-state-across-reloads is a skill published in the GitHub repository skydoves/compose-performance-skills (502 stars, last pushed 2mo ago), licensed Apache-2.0. It adds 189 tokens to every session and 2,627 once invoked, about $0.0009 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