Agent Skills
› chrisbanes/skills
› compose-component-design
compose-component-design
GitHub指导 Jetpack Compose 组件 API 设计,涵盖 Modifier、根布局、Slot 及内容参数处理,确保组件可复用且 caller 可控。
触发场景
设计或审查 Jetpack Compose 组件 API
处理 Modifier 参数与根布局放置
决定使用 Slot 还是原始内容参数
安装
npx skills add chrisbanes/skills --skill compose-component-design -g -y
SKILL.md
Frontmatter
{
"name": "compose-component-design",
"description": "Use when designing or reviewing reusable Jetpack Compose component APIs with modifier parameters, root layout placement, caller-provided variable content, primitive content parameters, optional content, or boolean shape flags."
}
Compose component design
Core principle
Make reusable components caller-placeable and caller-composable: the component owns its invariant structure while callers retain placement, content, and policy choices that vary by use.
Procedure
- State the requested API concern and keep the edit within it. A focused slot review does not authorize unrelated modifier, naming, or cleanup changes.
- State the component's invariant visual structure and identify every varying region, placement concern, and policy choice. In a broad API review, inventory all rendered regions, including hard-coded text or icons, before deciding which are fixed semantic content and which vary by caller. When the request names more than one concern, report each one; do not stop after the first valid modifier or slot finding.
- When root placement is part of the requested work or a broad component API design, accept and apply a caller modifier at the component root unless a concrete API boundary makes another placement correct. With conditional roots, apply it to every branch root rather than merging branches into one wrapper.
- Represent caller-controlled, unconstrained visual regions with slots rather than proliferating primitive content parameters or Boolean shape flags. Keep semantic and design-system constraints as primitive parameters.
- Keep simple conditional structure inline; extract only a coherent reusable contract.
- Read the relevant focused reference below before editing public signatures.
- In a review, decide explicitly whether each requested variable visual region should remain a semantic primitive or become a caller slot; naming a content limitation alone does not make that API decision. Finish with no edit when the existing API already satisfies the requested concern. Otherwise finish when callers can position the component, supply variable content, and understand ownership without hidden switches.
Topic router
| Signal | Read |
|---|---|
| Modifier parameter, root layout placement, modifier ordering, or conditional layout wrappers | Modifier and layout |
| Caller-controlled variable visual regions, optional content, primitive content parameters, or Boolean shape flags | Slot APIs |
| Animation belongs to the public component contract | Compose animations |
| State ownership changes while designing the component | Compose state and effects |
| Semantics or screenshot coverage is needed | Compose UI testing patterns |
版本历史
-
2026.10.18
当前 2026-10-19 03:04
修复由 Claude Code evals 发现的能力缺口并强化 Claude harness。
- 2026.9.25 2026-09-27 20:22
- 2026.8.27 2026-08-28 05:51
-
2026.8.24
2026-08-27 17:15
减少技能指令的冗余度
-
2026.8.16
2026-08-19 19:31
增加步骤1以明确API关注点范围;细化完成条件为无需隐藏开关。
- 2026.8.5 2026-08-16 02:44


