compose-performance — скилл для Claude Code: разбор рекомпозиции
Скилл для расследования стоимости рекомпозиции в Jetpack Compose: помогает найти фазу, из-за которой пересчитывается UI, и починить её точечно.
npx skills add chrisbanes/skills --skill compose-performance -a claude-codeЧто делает compose-performance
Скилл включается, когда вы разбираетесь, почему экран на Jetpack Compose перерисовывается чаще, чем нужно. Он ведёт по шагам: воспроизвести одну конкретную анимацию или переход, снять доказательства — счётчики рекомпозиции, отчёты компилятора, данные профайлера — и определить главную ось проблемы. Осей три: стабильность параметров и пропуск рекомпозиции, фаза чтения State, запись snapshot-состояния назад в более раннюю фазу.
Дальше скилл предлагает проверить ложный след: реальное изменение данных, дефект корректности или элемент ленивого списка, который и должен пересчитаться. Только после этого он читает профильный справочник и предлагает правку. Каждую находку он связывает с минимальным исправлением, а не останавливается на диагнозе. Менять советует по одной оси за раз и заново мерить тот же переход.
Сборку скилл гоняет через Gradle run. Если билд запустить нельзя, он разбирает объявленные типы и не лезет распаковывать jar-файлы тулчейна в обход песочницы. Для Int в mutableStateOf со стандартной структурной проверкой равенства неизменное значение уже не вызывает инвалидацию — это повод не трогать код зря.
Какие задачи решает
- найти фазу, из-за которой Compose пересчитывает экран
- разобрать отчёт компилятора о стабильности классов
- убрать чтение State на каждом кадре во время скролла или анимации
- проверить, не пишется ли snapshot-состояние назад в раннюю фазу
- отличить настоящую проблему от ожидаемой рекомпозиции
Примеры запросов агенту
- Почему этот экран рекомпозируется на каждом кадре во время скролла? Разбери через compose-performance.
- Посмотри classes.txt и composables.txt и скажи, какие параметры нестабильны.
- Есть подозрение на cross-phase snapshot write — проверь и предложи минимальную правку.
Как установить compose-performance
1Через Skills CLI (Vercel)
npx skills add chrisbanes/skills --skill compose-performance -a claude-code2Вручную: положить файлы
~/.claude/skills/compose-performance/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/compose-performance/
1Через Skills CLI (Vercel)
npx skills add chrisbanes/skills --skill compose-performance -a codex2Вручную: положить файлы
.agents/skills/compose-performance/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add chrisbanes/skills --skill compose-performance -a cursor2Вручную: положить файлы
.cursor/skills/compose-performance/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install chrisbanes/skills compose-performance2Вручную: положить файлы
.github/skills/compose-performance/SKILL.md1Через Skills CLI (Vercel)
npx skills add chrisbanes/skills --skill compose-performance -a gemini-cli2Командой платформы
gemini skills install https://github.com/chrisbanes/skills --path skills/compose-performanceВручную: положить файлы
.devin/skills/compose-performance/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add chrisbanes/skills --skill compose-performance -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о compose-performance
Как установить compose-performance в Claude?
Выполните npx skills add chrisbanes/skills --skill compose-performance -a claude-code. Скилл окажется в ~/.claude/skills/compose-performance/SKILL.md.
Что делает compose-performance?
Проводит по шагам разбор стоимости рекомпозиции: воспроизведение перехода, классификация оси проблемы, проверка ложных следов и точечная правка с повторным замером.
Что нужно, чтобы скилл заработал?
Сборка идёт через Gradle run. Если запустить её нельзя, скилл работает по объявленным типам и не распаковывает jar-файлы тулчейна.
Исходный текст
SKILL.md · Apache-2.0
--- name: compose-performance description: Use when investigating Jetpack Compose recomposition cost, compiler stability reports, skippability, unstable parameters, frame-rate State reads, cross-phase snapshot back-writing, or @ReadOnlyComposable contracts. --- # Compose performance ## Core principle Measure one user-visible transition, identify the runtime axis that causes the work, then apply the smallest correction at the phase or boundary where that axis begins. ## Procedure 1. Reproduce one concrete transition and capture the observable evidence: recomposition counts, compiler reports, profiler data, or a clear trace. Build only through [Gradle run](../gradle-run/SKILL.md). If no build can run, reason from the declared types; do not unpack toolchain jars or work around the sandbox. 2. Classify the primary axis: parameter stability and skipping, State read phase, or snapshot state written back into an earlier phase. 3. Check for a false lead: a real data change, a correctness defect, or an unchanged lazy item that is expected to recompose. 4. Read the corresponding focused reference before proposing a change. 5. For review work, pair every finding with the smallest evidence-supported repair. For a false stability promise, explicitly say to replace mutable non-snapshot properties with immutable data or snapshot-observable state, verify that contract, and only then decide whether an annotation remains needed. For a phase problem, name the layout or draw consumer where the changing read or calculation should move. A cross-phase write proves invalidation or an extra pass; do not claim oscillation or an infinite loop unless evidence shows values repeatedly changing. Do not stop at diagnosis. When only source code is available, separate the proven feedback path from its unmeasured runtime cost. Give a conditional repair direction based on the intended measurement boundary; do not prescribe a callback swap, equality guard, or content-layout rewrite as a performance fix without evidence that it changes the observed problem. For an `Int` held in `mutableStateOf` with the default structural equality policy, an unchanged value already avoids invalidation. 6. Change one axis at a time and re-measure the same transition. 7. Finish when the evidence improves at the observed boundary without hiding state changes, caching stale values, or moving work to a less correct owner. ## Topic router | Signal | Read | |---|---| | Cause is unknown, or several axes may interact | [Diagnosis](references/diagnosis.md) | | `classes.txt`, `composables.txt`, strong skipping, unstable parameters, or collection stability | [Stability](references/stability.md) | | Scroll, animation, gesture, layout, or draw State read at frame rate; measured state fed back into composition | [Deferred reads](references/deferred-reads.md) | | A composable only reads composition locals or accessor-style values | [Composition contracts](references/composition-contracts.md) | | State ownership or effect lifecycle is the root cause | [Compose state and effects](../compose-state-and-effects/SKILL.md) |
© chrisbanes · Apache-2.0 · chrisbanes/skills