Logo di Understanding Hot Reload Limits

Understanding Hot Reload Limits

Community
skydoves
understanding-hot-reload-limits

Usa questa skill per spiegare a Claude esattamente quali modifiche a Kotlin e Compose supportano l’hot reload con Compose HotSwan e quali invece attivano la ricompilazione incrementale completa di fallback. La causa principale è l’immutabilità dello schema delle classi in Android Runtime (ART): solo i corpi dei metodi possono essere modificati in fase di esecuzione, quindi qualsiasi modifica a campi, firme, costruttori o interfacce, così come l’aggiunta di funzioni inline o di nuovi ID di risorse, richiede una ricompilazione. Illustra la tabella delle modifiche supportate, l’elenco di quelle che richiedono una ricompilazione, il flusso di lavoro basato su diff e raggruppamento delle modifiche, che mantiene la sessione di hot reload nel percorso rapido, e i problemi legati alle funzioni inline e ai nuovi ID di risorse. Attivala se l’utente chiede «perché è stata avviata una ricompilazione?» o «perché non funziona l’hot reload?», vuole conoscere i limiti di HotSwan prima di adottarlo oppure sta esaminando un refactoring che rischia di far passare la sessione di hot reload a una ricompilazione completa.

Add to TypingMind

Panoramica

Pubblicato daskydoves
Repositorycompose-performance-skills
Nome della skillunderstanding-hot-reload-limits
Stelle
515
Fork
19
File inclusi
Solo istruzioni
LicenzaApache-2.0
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • Tutto nelle istruzioni

    Tutto ciò che serve al modello è nelle istruzioni: nessun file aggiuntivo da sincronizzare.

  • Open source

    Pubblicata da skydoves su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Understanding Hot Reload Limits in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/skydoves/compose-performance-skills/tree/main/hot-reload/understanding-hot-reload-limits
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Aggiungi skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella della skill nella directory delle skill di quell'agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/skydoves/compose-performance-skills.git /tmp/compose-performance-skills
mkdir -p .claude/skills
cp -r /tmp/compose-performance-skills/hot-reload/understanding-hot-reload-limits .claude/skills/understanding-hot-reload-limits
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Understanding Hot Reload Limits in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Understanding Hot Reload Limits non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Understanding Hot Reload Limits non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

Understanding Hot Reload Limits: stay inside the fast path

Android Runtime (ART) enforces strict rules for class redefinition: a redefined class must have an identical schema (fields, method signatures, interfaces) as the previous version. Only method bodies are mutable at runtime. HotSwan automatically detects schema changes and falls back to a full incremental build, so failures are not silent. Knowing the boundary in advance is what keeps an iteration loop sub-second instead of multi-second.

When to use this skill

  • The developer asks "why did this trigger a full rebuild?", "why isn't this hot reloading?", or "what does HotSwan support?".
  • A PR review surfaces a refactor (parameter change, constructor change, interface extraction, new resource id) that would push a hot-reload session into a rebuild.
  • The developer is planning a session and wants to order edits so the slow ones happen at the end.
  • The developer reports an inline fun change that "didn't reload" and is debugging.

When NOT to use this skill

  • Setup or first-run troubleshooting. See ../setting-up-compose-hotswan/SKILL.md.
  • Pure state-preservation question (the reload happened but state was lost). See the state-preservation sibling skill.
  • Configuration of the AI iteration loop or MCP server. See the AI-loop sibling skill.

Prerequisites

  • HotSwan installed and verified per ../setting-up-compose-hotswan/SKILL.md (tool window status WATCHING, body-only edit reloads in under one second).
  • Familiarity with the Kotlin compiler's distinction between method-body changes and class-schema changes.

Boundary tables

Hot-reloadable (no rebuild)

ChangeNotes
Composable function bodytext, colors, modifiers, layout, control flow inside the function
Non-composable function bodyViewModel methods, mappers, utilities, repositories
Adding a new composablesame file or new file
Reordering composablesHotSwan 1.2.0+
Resource value changesstrings.xml value, colors.xml value, dimens.xml value
Extension functionsincluding suspend, including vararg
Adding data class propertiesAPI 30+ only
Numeric, string, float literal patchescompiled separately for fastest reload

Forces full rebuild (fallback)

ChangeReason
Adding or removing function parametersmethod signature changes
Constructor changesparameter list, default values, init blocks affecting fields
Interface or superclass changesclass hierarchy is part of the schema
Adding new resource idsnew R.string, R.drawable, R.id entries require generated R class regeneration
Inline functionsexpanded at every call site; no discrete unit to swap
Lambda count change inside a functioninternal lambda class renumbering
Removing a previously defined functionmethod table shrinks; schema changes
Adding data class properties below API 30constructor schema change without ART support

Workflow when a change does not hot-reload

  1. Watch the HotSwan tool window status at the moment of save. A schema change surfaces as a "falling back to incremental build" status. That is the explicit signal, not a silent failure.
  2. Read the change diff. Decide: is this a body-only change, or a schema change (signature, constructor, interface, field, new resource id, inline body, lambda count)?
  3. If a refactor must change a signature, batch it. First make the body-only changes that get the screen to a working visual state and hot-reload them. Then, in a separate save, change the signature and accept the rebuild as the last step of the session.
  4. For inline functions, drop inline for the duration of iteration. Refactor the function out of inline while iterating, hot-reload as needed, and restore inline before commit. If iteration is rare or the perf characteristic must be preserved, accept the rebuild.
  5. For new resource ids, batch all id additions first, accept one rebuild, then iterate on values. Editing <string name="title">Updated Title</string> (existing id) hot-reloads; adding <string name="brand_new_id">...</string> does not.

Patterns

Pattern: function-body change (fast path) vs signature change (rebuild)

kotlin
// RIGHT (body-only change, hot-reloads)
@Composable
fun Greeting() {
    Text("Hello, World", color = Color.Blue)
}
kotlin
// WRONG for the fast path (signature change, forces rebuild)
@Composable
fun Greeting(name: String) {
    Text("Hello, $name")
}
// WRONG because: adding a parameter changes the method signature, which violates ART's class
// schema constraint. To stay inside the fast path, introduce the parameter with a default value
// in one save (still a rebuild; accept it once), then iterate on the body across subsequent saves.

Pattern: adding a new composable (fast path) vs changing a constructor (rebuild)

kotlin
// RIGHT (new composable in the same file, hot-reloads on HotSwan 1.2.0+)
@Composable
fun SecondaryAction() {
    Text("New")
}
kotlin
// WRONG for the fast path (constructor change)
data class User(val id: Long, val name: String, val age: Int)
// WRONG because: adding `age` extends the constructor. On API 30+ HotSwan supports adding
// data class properties; below API 30 the schema change forces a rebuild. When targeting older
// minSdk, batch property additions and accept a rebuild for each.

Pattern: inline function body change (rebuild)

kotlin
// WRONG for the fast path
inline fun <T> Modifier.observer(value: T, body: (T) -> Modifier): Modifier = body(value)
// WRONG because: inline functions are expanded at every call site at compile time. There is no
// discrete unit to swap, so editing the inline body forces a full rebuild of every call site.
// Drop `inline` for the duration of iteration, or accept the rebuild.
kotlin
// RIGHT for the fast path (non-inline variant during iteration)
fun <T> Modifier.observer(value: T, body: (T) -> Modifier): Modifier = body(value)

Pattern: resource value change (fast path) vs new resource id (rebuild)

xml
<!-- RIGHT: value change on an existing id, hot-reloads -->
<string name="title">Updated Title</string>
xml
<!-- WRONG for the fast path: new id, forces rebuild -->
<string name="brand_new_id">Hello</string>
<!-- WRONG because: adding a new string id grows the generated R class. R class regeneration
     is a schema change that ART cannot redefine in place. -->

Pattern: lambda count change (rebuild)

kotlin
// RIGHT (body change inside the existing lambda, hot-reloads)
@Composable
fun Row() {
    Button(onClick = { log("tapped") }) { Text("Tap") }
}
kotlin
// WRONG for the fast path (adds a second lambda, renumbers inner lambda classes)
@Composable
fun Row() {
    Button(onClick = { log("tapped") }) { Text("Tap") }
    Button(onClick = { log("second") }) { Text("Second") }
}
// WRONG because: a Kotlin function's compiled lambdas are anonymous classes named like
// Row$lambda$1, Row$lambda$2. Adding a lambda renumbers them and changes the class table,
// which is a schema change. The fix is to add the second composable as a separate top-level
// function (which is supported), then call it from Row once the structural change has rebuilt.

Mandatory rules

  • MUST consult the boundary tables before suggesting a change to a composable that the developer is iterating on. Suggesting a parameter add when the developer wanted speed wastes the iteration loop.
  • MUST NOT claim a change will hot-reload without checking it against the supported-changes table above.
  • MUST NOT disable HotSwan to "force a clean rebuild". Use Gradle's :app:clean for a clean build; HotSwan auto-falls-back when needed and turning it off costs the next round-trip.
  • MUST treat new resource ids and inline-function body changes as rebuild-forcing on every Android API level. The data-class-property exception is API 30+ only.
  • PREFERRED: order an iteration session so body-only edits come first and signature, constructor, interface, or new-resource-id changes are batched at the end.
  • PREFERRED: when a refactor needs a parameter add, introduce it once with a default value (accept the rebuild), then iterate on the body across subsequent saves.

Verification

  • A body-only change to a composable hot-reloads on save with the tool window status remaining WATCHING.
  • Adding a parameter to a composable triggers the fallback status in the tool window.
  • Adding a new <string> resource triggers the fallback; editing an existing <string> value does not.
  • Editing the body of an inline function triggers the fallback; converting it to a non-inline function and editing the body hot-reloads.
  • Adding a property to a data class hot-reloads on a device running API 30+; on API 29 and below it triggers the fallback.

References

Domande frequenti

Cosa fa la skill IA Understanding Hot Reload Limits?

Usa questa skill per spiegare a Claude esattamente quali modifiche a Kotlin e Compose supportano l’hot reload con Compose HotSwan e quali invece attivano la ricompilazione incrementale completa di fallback. La causa principale è l’immutabilità dello schema delle classi in Android Runtime (ART): solo i corpi dei metodi possono essere modificati in fase di esecuzione, quindi qualsiasi modifica a campi, firme, costruttori o interfacce, così come l’aggiunta di funzioni inline o di nuovi ID di risorse, richiede una ricompilazione. Illustra la tabella delle modifiche supportate, l’elenco di quell...

Perché usare Understanding Hot Reload Limits su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Understanding Hot Reload Limits è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che la skill smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Understanding Hot Reload Limits in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/skydoves/compose-performance-skills/tree/main/hot-reload/understanding-hot-reload-limits. TypingMind legge il file SKILL.md e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Understanding Hot Reload Limits?

Qualsiasi modello che colleghi a TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Understanding Hot Reload Limits?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Understanding Hot Reload Limits: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Understanding Hot Reload Limits è gratuita?

Sì. È pubblicata su GitHub da skydoves con licenza Apache-2.0. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, template o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Elenco completo

Crea subito il tuo spazio di lavoro AI

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇