Agent Skillschrisbanes/skills › compose-component-design

compose-component-design

GitHub

用于设计或审查可复用的 Jetpack Compose 组件 API,涵盖修饰符参数、根布局放置、调用者提供的变量内容、布尔标志及可选内容等场景。

skills/compose-component-design/SKILL.md chrisbanes/skills

触发场景

设计可复用 Compose 组件 API 审查组件修饰符与布局策略 处理调用者控制的视觉区域

安装

npx skills add chrisbanes/skills --skill compose-component-design -g -y
更多选项

不安装直接使用

npx skills use chrisbanes/skills@compose-component-design

指定 Agent (Claude Code)

npx skills add chrisbanes/skills --skill compose-component-design -a claude-code -g -y

安装 repo 全部 skill

npx skills add chrisbanes/skills --all -g -y

预览 repo 内 skill

npx skills add chrisbanes/skills --list

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

  1. State the requested API concern and keep the edit within it. A focused slot review does not authorize unrelated modifier, naming, or cleanup changes.
  2. State the component's invariant visual structure and identify every varying region, placement concern, and policy choice.
  3. 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.
  4. 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.
  5. Keep simple conditional structure inline; extract only a coherent reusable contract.
  6. Read the relevant focused reference below before editing public signatures.
  7. 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

RED/GREEN agent scenarios

  1. RED exposes title: String, icon: ImageVector?, and several display flags for a reusable card. GREEN keeps invariant chrome and gives callers the variable regions as named slots.
  2. Novel case: a component needs both a root modifier and caller-supplied trailing content. GREEN applies the modifier at the root and supplies a trailing slot without leaking the component's RowScope; reserve a scope receiver for a region whose child layout is deliberately caller-controlled.
  3. Counterexample: a private screen helper has one fixed child and no callers. GREEN keeps it simple instead of inventing slots for hypothetical reuse.
  4. Focused counterexample: a status label intentionally maps a semantic enum to fixed copy, and the task asks only whether it needs slots. GREEN leaves the workspace unchanged instead of adding an unrelated root modifier.

版本历史

  • 2026.8.16 当前 2026-08-19 19:31

    增加步骤1以明确API关注点范围;细化完成条件为无需隐藏开关。

  • 2026.8.5 2026-08-16 02:44

同 Skill 集合

skills/compose-animations/SKILL.md
skills/compose-focus-navigation/SKILL.md
skills/compose-modifier-and-layout-style/SKILL.md
skills/compose-performance/SKILL.md
skills/compose-recomposition-performance/SKILL.md
skills/compose-side-effects/SKILL.md
skills/compose-slot-api-pattern/SKILL.md
skills/compose-stability-diagnostics/SKILL.md
skills/compose-state-and-effects/SKILL.md
skills/compose-state-authoring/SKILL.md
skills/compose-state-deferred-reads/SKILL.md
skills/compose-state-hoisting/SKILL.md
skills/compose-state-holder-ui-split/SKILL.md
skills/compose-ui-testing-patterns/SKILL.md
skills/gradle-run/SKILL.md
skills/implement-issue/SKILL.md
skills/implement-with-subagents/SKILL.md
skills/kotlin-api-design/SKILL.md
skills/kotlin-concurrency-and-flow/SKILL.md
skills/kotlin-control-flow/SKILL.md
skills/kotlin-coroutines-structured-concurrency/SKILL.md
skills/kotlin-flow-state-event-modeling/SKILL.md
skills/kotlin-functions/SKILL.md
skills/kotlin-multiplatform-expect-actual/SKILL.md
skills/kotlin-types-value-class/SKILL.md
skills/run-github-project/SKILL.md
skills/shepherd/SKILL.md
skills/to-plan/SKILL.md
skills/using-chrisbanes-skills/SKILL.md

元信息

文件数
0
版本
2026.8.16
Hash
7ada42bf
收录时间
2026-08-16 02:44

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-26 16:09
浙ICP备14020137号-1 $访客地图$