一键导入
decompose-components
Rules for structuring and connecting Decompose components - regular components, routers, Outputs, factories, navigation, and embedded children
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Rules for structuring and connecting Decompose components - regular components, routers, Outputs, factories, navigation, and embedded children
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Implement provided test blueprints following the project guidelines.
Create compact, reviewable high-level designs for test suites before implementation or structural review.
Compose Multiplatform UI patterns for this project - Scaffold screens, AppToolbar, decomposition, CustomTheme, LCE widgets, insets, system bars, messages, core widgets, and previews.
Guidelines for organizing feature module structure using package-by-feature principle
Guidelines for API/DTO boundaries, repository-owned Replica data loading, loaded data observation in components, LCE state, data mutations, cache invalidation, ReplicaAction, ReplicaTag
Compact guide for using the project StringDesc wrapper over Compose Resources
基于 SOC 职业分类
| name | decompose-components |
| description | Rules for structuring and connecting Decompose components - regular components, routers, Outputs, factories, navigation, and embedded children |
Every component uses four files:
XxxComponent — public contract: state flows, user actions, optional Output.RealXxxComponent — implementation: ComponentContext by componentContext, business logic,
dependencies.FakeXxxComponent — preview/testing stub that uses fake data from domain/ui-state companion
objects and has no-op user actions.XxxUi — pure UI that reads component state and calls component methods.Keep the public API on the interface. Keep business logic in RealXxxComponent. Keep XxxUi free
of business logic.
ChildStack.Output only when the parent must react to something.ChildStack and StackNavigation.PredictiveBackComponent.Output.Output only when the component must communicate upward.ItemSaved, LoggedOut.<Something>Requested only when the child action has one clear meaning and a completed event would feel
artificial: ItemDetailsRequested, FilterRequested.Output has to accept an output callback with a no-op default and expose
emitOutput(output) for tests.ComponentFactory.createXxxComponent(...) extension functions.RealXxxComponent directly.RealXxxComponent must not depend on ComponentFactory directly.XxxChildComponentFactory and inject that factory into the component.createXxxComponent(...) functions accept a childComponentFactory parameter with
a production default RealXxxChildComponentFactory(this).XxxChildComponentFactory, not on the general
ComponentFactory.XxxChildComponentFactory methods are named like regular component factory methods:
createYyyComponent(...).XxxChildComponentFactory methods return component interfaces directly, never
XxxComponent.Child.*.createChild(...) implementations wrap child components into
XxxComponent.Child.*.safePush() over push().pop(), replaceCurrent(), and replaceAll() for standard router transitions.getChild() to pass data back to an existing requester in the stack.Output for default back navigation: routers use childStack(handleBackButton = true),
and UI uses LocalBackAction.current.Output only when the child must run custom logic before requesting back.childContext(key = "...").ComponentContext.ComponentContext directly to multiple children.itemsState, profileState, detailsState; never use generic
state.MutableStateFlow.MessageService.componentScope.safeLaunch(errorHandler).safeRun(errorHandler) only for synchronous component code that can throw.ErrorHandler do it.onErrorHandled only for local cleanup or state rollback after the error was handled.Use only when you need specific details:
getChild().childContext(key).MessageService usage.