Individual skill
migrating-to-modifier-node
Use this skill to author new custom Jetpack Compose modifiers and migrate legacy ones from Modifier.composed { } to Modifier.Node + ModifierNodeElement<T>. Covers the persistent-node lifecycle (onAttach, onDetach, onReset, coroutineScope), the specialized node interfaces (DrawModifierNode, LayoutModifierNode, SemanticsModifierNode, PointerInputModifierNode, CompositionLocalConsumerModifierNode, LayoutAwareModifierNode, GlobalPositionAwareModifierNode, ObserverModifierNode, DelegatingNode, TraversableNode), why ModifierNodeElement MUST be a data class for diffing, and the manual-invalidation knobs (invalidateDraw, invalidateMeasurement, invalidatePlacement, shouldAutoInvalidate). Use when the developer mentions Modifier.composed, custom modifier, ModifierNodeElement, Modifier.Node, "rewriting our drawBehind helper", node lifecycle, or sees Modifier.composed { } in a code review.
modifiers/migrating-to-modifier-node/SKILL.md
Source commit 1b32f81724c0d71fe9ef093ca44697f559fdab6e
What was checked
- Matches the observed repository HEAD
- Yes
- Scanner rules are current
- Yes
- Repository scan complete
- No
- Skill scan complete
- No
- Observed behavior
- Instructions only
- Last checked
- Nov 6, 2026
These are observations at the recorded commit, not a guarantee of safety. Review the source before running it.
Install this skill
Choose an agent in your Stack or copy a command below. Commands fetch the pinned commit and copy only this skill directory. Existing destinations are refused. Copying a command does not install anything.
An install command is unavailable: current rules, complete repository and skill scans, an eligible behavior level and a permitted license are required.
Repository context
- Repository stars (not skill ratings)
- 526
- Repository last updated
- Jun 16, 2026
- License
- Apache-2.0
Observed agent integration: No specific integration evidence. Standard SKILL.md installation does not imply verified compatibility.
- agent-skills Repository topic
- android Repository topic
- claude Repository topic
- claude-code Repository topic
- compose Repository topic
- jetpack-compose Repository topic
- kotlin Repository topic
- llm-tools Repository topic
- recomposition Repository topic
- skydoves Repository topic
- engineering Derived category
- data Derived category
Declared tags are partial or unavailable.
Files and excerpt
File metadata and permitted, redacted excerpts come from the recorded scan. Source links are pinned to that commit.
Browse files
SKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesSKILL.mdcore · 19,907 bytesreferences/modifier-node-anatomy.mddoc · 14,107 bytes
Read excerpt
# Migrating to Modifier.Node — Persistent Nodes Over `composed { }`
`Modifier.composed { }` allocates a fresh composable scope per modifier per composition: it cannot be skipped, cannot be hoisted, and forces the parent to run on every recomposition. `Modifier.Node` is a persistent node diffed by `ModifierNodeElement.equals()` — created once on first apply, updated in place on subsequent applies. There is **no per-recomposition allocation, no fresh composable scope, and no parent invalidation chain**, which is why Android Developers describes the system as "designed from the ground up to be far more performant" than the legacy `composed { }` factory (see `developer.android.com/develop/ui/compose/custom-modifiers`). This skill teaches Claude how to author new modifiers as `Modifier.Node` and migrate legacy `composed { }` factories.
## When to use this skill
- A custom modifier currently uses `Modifier.composed { }` (search the module for `Modifier.composed`).
- Authoring a new custom modifier from scratch — never start with `composed { }`.
- A code review surfaces a `composed { }` factory.
- The custom modifier needs a `CoroutineScope` (animation loop, debouncer), reads a `CompositionLocal`, participates in layout / drawing / pointer input, or tracks layout coordinates.
- A `@TraceRecomposition` log shows the parent composable recomposing on every frame because a `composed { }` modifier is in the chain.
## When NOT to use this skill