跳到正文
cccskills
免费在 GitHub 公开中文介绍

compose-ui-architecture

整理 Compose Desktop 界面中的状态和副作用,让可组合函数负责绘制,由展示器或协调器处理应用决策。了解状态归属、Effect、可复用组件接口、延迟列表键、动画和性能,适用于单项界面修改。

原文查看原文说明

Write Compose Desktop UI state, effects, and presenter boundaries.

JetBrains/intellij-community星标 20,684(GitHub 20,684 + cccskills 0)

实测评分 未实测

查看安装方法

适用场景

  • 分离界面绘制与展示器决策
  • 整理界面状态的归属
  • 检查 Effect 键和协程用法
  • 设计可复用组件与延迟列表

中文介绍

功能

修改 Compose Desktop 界面时,本技能帮助梳理可组合函数、展示器或协调器,以及状态持有层各自的职责。基本原则是界面负责绘制,展示器负责决策。悬停、焦点等只影响显示的临时状态可以留在界面中;应用状态、持久化、通信、文件操作、权限和业务判断应交给持有状态的层处理。检查内容还包括 remember 和各类 Effect 的键、可复用组件的 Modifier、不可变数据与事件回调、延迟列表的稳定键和 contentType、动画,以及重组开销。

适用场景

为 Compose 界面添加功能时,可用它检查界面是否承载了过多状态或业务逻辑。调整 Effect 的依赖关系、可复用组件接口、列表或动画实现时也适用。本技能针对单项界面修改;资料指出,针对整个代码库的系统性架构评估应使用另一项技能。

使用示例

  • “请将这个界面的状态合理地分配给可组合函数和展示器。”
  • “检查这个 LaunchedEffect 的键和处理范围。”
  • “整理这个可复用列表项的接口和稳定键。”

注意事项

如果项目有架构文档,且内容与本指引不同,应以项目文档为准。Jewel 组件选择以及 Swing/AWT 集成由相关技能负责。

本介绍由 AI(OpenAI Codex)根据公开的 SKILL.md 撰写。准确的规格请查看下方原文。

文档检查

AI 根据 SKILL.md 的内容检查了需要注意的操作和使用前提。评分只依据实际运行的结果(实测对比)。

安全性发送数据、删除文件、执行命令等是否有说明
A良好资料提供界面设计指引,没有要求外部发送或破坏性操作。
安装难易度所需工具和 API 密钥是否少且有说明
A良好资料未要求额外工具或 API 密钥。

不计入评分。 由 AI(OpenAI Codex)于 2026年10月28日 评估。仅供参考,安装前请同时查看原文。

如果您认为评估有误,请申请复核

请写明哪一项有误以及原因。无需登录。我们会对照 SKILL.md 重新评估,并在此处更新结果。

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

包含的文件(8)

  • SKILL.md5.7 KB
  • evals/evals.json6.5 KB
  • references/animation.md11.3 KB
  • references/component-api-lists-performance.md4.1 KB
  • references/desktop-seams-review-output.md1.5 KB
  • references/effects.md1.7 KB
  • references/state-boundaries.md5.4 KB
  • skill-source.json2.0 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

<!-- Generated by community/.ai/render-guides.mjs; edit community/.agents/skills/compose-ui-architecture/SKILL.md -->

Compose UI Architecture

Use this skill to keep Compose Desktop UI code architecturally correct while editing IntelliJ-style desktop surfaces. This skill provides authoring and review guardrails for individual changes. When the user asks for a systemic Compose UI architecture assessment across a codebase, use compose-ui-audit instead.

For general post-change review or cleanup, use the review subagents available in the current harness instead of stretching this skill beyond UI architecture. If subagent delegation is unavailable, run those review passes sequentially yourself.

Do not use this skill to replace project docs. If the project has architecture docs, treat them as authoritative when details conflict.

Pair With / Defer To

Pair it with:

  • Pair this skill with jewel-ui when selecting Jewel components, theme wrappers, icons, typography, and IntelliJ-style controls.
  • Pair this skill with jewel-swing-interop when configuring Swing/AWT hosting, ComposePanel, LocalComponent, popups, and bridge theme mechanics.

Defer these adjacent tasks instead of stretching this skill:

  • Use jewel-ui for component choice, label rules, icons, theme wrappers, typography, and Jewel visual style.
  • Use jewel-swing-interop for ComposePanel, AWT popup forwarding, LocalComponent, and host Swing component access.
  • Use configured review or refactoring subagents for general post-change code review or cleanup, or run those passes sequentially yourself if delegation is unavailable.
  • Use compose-ui-audit for a whole-surface systemic Compose UI architecture assessment.

Desktop Compose Terminology

Be precise with names:

  • In Android docs, ViewModel roughly maps to a desktop UI presenter/coordinator layer.
  • In desktop Compose code, a view model may also mean a view-layer data model / screen projection, such as ScreenState, RowModel, or SurfaceModel. Avoid ambiguity by naming whether you mean lifecycle owner or render model.
  • Do not introduce Android ViewModel, Hilt/Koin, Android lifecycle, or Navigation guidance into desktop Compose UI unless the project already uses those concepts.

Core Rule

Compositions render. Presenters decide.

Composables may own ephemeral visual state: hover, focus, animation progress, expansion toggles, tooltip visibility, and layout wiring. They must not own app state, persistence, RPC, file/process/network work, JSON parsing, model selection, permission policy, review workflow decisions, or workspace/config lookup.

Route those through presenters/coordinators or equivalent state-owning layers and expose ready-to-render view models to UI.

Fast Guardrail Pass

Before returning Compose UI code, silently check these questions:

  1. Boundary: does the composable render inputs, or does it decide business/app behavior?
  2. State: is local state truly ephemeral? If state mirrors app/session/project settings, move it up.
  3. Projection: should several values be combined into one presenter-owned screen state before UI sees them?
  4. Effects: does every effect stay minimal and key on the values that should restart it?
  5. Modifier: do reusable composables accept and forward modifier: Modifier = Modifier to the outermost layout?
  6. Lists: do movable and heterogeneous lazy-list items pass a stable key = parameter and a matching contentType = parameter?
  7. Performance: does composition avoid expensive transforms, object churn, and broad state reads?
  8. Animation: does the animation code use declarative APIs where possible, wrap stateful animation objects in remember, and read per-frame values in the layout or draw phase?
  9. API shape: do reusable components accept immutable data and event callbacks instead of presenter instances or mutable state objects?

If an answer is no, fix the shape before writing more code rather than documenting the violation.

Also check for false positives. Local hover state, focus requesters, text-field state, expansion toggles, scroll commands, and one-shot UI labels are usually fine in composition when they do not shadow app/session state.

Progressive Reference Files

Read only the reference files needed for the current task:

  • Read references/state-boundaries.md for rules on presenter/coordinator vs. state-holder vs. composition boundaries, desktop lifecycle, flow collection, CompositionLocal guardrails, and testing ownership.
  • Read references/effects.md for rules on remember, LaunchedEffect, DisposableEffect, snapshotFlow, coroutine scopes, and effect keys.
  • Read references/animation.md when choosing animation APIs, remembering Animatable state, launching target-driven effects, deferring animated reads, or using AnimatedContent, infinite transitions, and gesture-driven motion.
  • Read references/component-api-lists-performance.md for rules on reusable composable API shape, modifier contracts, lazy-list keys and content types, recomposition and performance smells, and healthy patterns to preserve.
  • Read references/desktop-seams-review-output.md for guidance on desktop dialogs, popups, shortcuts, clipboard and URI opening, window state, protocol and runtime seams, and the file-grounded review output format.

Review Output

When reviewing code with this skill, keep output short and file-grounded:

### path/to/File.kt
- Issue: [rule name]
- Why it matters: [one sentence]
- Fix: [specific direction or tiny before/after]

End with the top three fixes, highest impact first. Do not list clean files.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

actions

免费有简介

实现或修改 IntelliJ `AnAction`,并在 `plugin.xml` 中注册。将显示名称和说明写入消息资源文件,按需设置图标,并通过事件协程作用域启动挂起任务,避免同步处理阻塞 IDE。

  • 为 IDE 菜单添加操作
  • 修改操作注册或图标
  • 整理操作名称和说明
JetBrains/intellij-community2.1万2026年10月29日 更新

bazel-test-migration

免费有简介

将 IntelliJ JPS 测试模块迁移到 Bazel,并排查仅在 Bazel 中出现的失败。根据症状检查依赖、插件、测试数据和 runfiles,重新生成并验证目标。

  • 将 JPS 测试模块迁移到 Bazel
  • 排查仅在 Bazel 中失败的测试
  • 检查测试依赖和数据配置
JetBrains/intellij-community2.1万2026年10月29日 更新

code-style

免费有简介

按 IntelliJ 项目规范编写或审查 Kotlin 和 Java 代码,涵盖语言选择、格式、密封类型、线程注解及控制流异常处理。

  • 按 IntelliJ 规范编写 Kotlin
  • 审查 Java 代码
  • 检查异常处理和密封类型分支
JetBrains/intellij-community2.1万2026年10月29日 更新

commits

免费有简介

本指南帮助您按 IntelliJ 项目规则拆分更改并撰写提交信息:有工单时使用编号和变更说明,无工单时使用标签与子系统名,并在需要时说明原因和决定。

  • 按项目格式编写带工单号的提交信息
  • 整理测试或文档提交并选择合适标签
  • 按规则修改已有提交信息
JetBrains/intellij-community2.1万2026年10月29日 更新

使用多个 Python 类型检查器比较代码片段或文件的类型推断和报错判断,并汇总各工具的结论、耗时与诊断信息,可保存为 Markdown 报告。

  • 比较不同检查器的类型推断
  • 确认代码是否会被判为类型错误
  • 查看多个工具的诊断差异
JetBrains/intellij-community2.1万2026年10月29日 更新

compose-ui-audit

免费有简介

审查 Compose Desktop 界面代码的架构和运行时问题,检查状态管理、副作用、协程、延迟列表、动画与重组,并按优先级列出发现。

  • 审查 Compose 界面的状态管理
  • 检查副作用和协程用法
  • 调查延迟列表或重组性能
JetBrains/intellij-community2.1万2026年10月29日 更新

查看 JetBrains 的全部技能

报告此技能的问题