add-screen
Add a Compose Multiplatform feature screen with its route, encoded arguments, NavGraph entry, ViewModel, Koin registration, shared UI conventions, and validation. Use when adding a screen or changing navigation and screen-level dependency wiring.
- License 许可
- BSD-3-Clause
- 最近更新
- 2026-09-17
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- add-screen
- description
- Add a Compose Multiplatform feature screen with its route, encoded arguments, NavGraph entry, ViewModel, Koin registration, shared UI conventions, and validation. Use when adding a screen or changing navigation and screen-level dependency wiring.
03 SKILL.md 正文
Add a screen
Route and navigation
Add the route to ui/navigation/Screen.kt. Encode every dynamic path segment with encodeRouteSegment when navigating and decode it through the navigation argument APIs at the destination.
Register the destination in ui/navigation/NavGraph.kt. Follow nearby destinations for transitions, argument declarations, back navigation, deep links, and scanner integration. Do not pass resource snapshots through routes; pass stable identifiers and load through the repository.
ViewModel and dependency injection
Create a ViewModel for any screen that loads or mutates data. Start work in viewModelScope, cancel or supersede stale loads where the existing feature pattern does so, and represent loading through LoadState<T>.
Register the ViewModel with viewModelOf(::X) in di/AppModule.kt. Register new dependencies in the same module. Missing Koin registrations compile and fail at runtime, so verify the complete constructor graph.
Resolve screen-scoped dependencies with koinViewModel() or koinInject(). Obtain AppPreferences through Koin instead of threading it through NavGraph.
Compose structure
- Use
AppTopBarfor a static title andCollapsingAppTopBarfor an entity-name detail title. - Use
PullToRefreshBoxwithloadState.isRefreshingNow; do not translate content withdistanceFraction. - Render initial loading, error, loaded, empty, and refresh states consistently with neighboring screens.
- Use
AppIcon(AppIcons.X),MaterialTheme.shapes,AppElevation, the stock typography ramp, and motion specs fromAppAnimations.kt. - Reuse shared components in
ui/commonbefore adding a local variant. - Use
collectAsStateWithLifecyclefor lifecycle-bound state.
Documentation and tests
- Update
dev/architecture.mdfor new routes, ViewModels, packages, or dependency injection wiring. - Update
dev/style.mdonly when introducing or changing a UI convention. - Update
dev/platform-parity.mdif either platform behaves differently. - Add an
Unreleasedchangelog entry because a new user-facing screen is visible behavior. - Test extracted deterministic logic in
commonTest; do not invent a screen test harness for a single change.
Verify
./scripts/verify-change.sh
./gradlew :composeApp:compileKotlinIosSimulatorArm64
04 同仓库更多 Skills
release
Cut, build, sign, tag, or publish a Crucible Lens release. Use only when explicitly asked to release, ship, publish, tag, bump the version, or produce signed release artifacts. Follow the ordered safeguards without improvising.
audit-docs
Audit AGENTS.md, README.md, project skills, and dev documentation against the repository, then repair factual drift and unnecessary duplication. Use only when explicitly asked to audit, refresh, migrate, or verify project documentation.
add-api-endpoint
Add or change a Crucible API endpoint, request or response model, pagination path, repository cache, or scientific metadata write. Use when touching data/api, data/repository, API serialization, or create and edit network flows.
release
Cut, build, sign, tag, or publish a Crucible Lens release when explicitly requested.
audit-docs
Audit and refresh project documentation when explicitly requested.