navigation3

Migrate Android apps from Jetpack Navigation 2 to Navigation 3 with type-safe routes.

Updated Jan 11, 2025
One-click install
npx skills add https://github.com/shaharKeisarApps/MoviesAndBeyond --skill navigation3
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: navigation3
Source: https://github.com/shaharKeisarApps/MoviesAndBeyond/tree/main/.claude/skills/navigation3
Command: npx skills add https://github.com/shaharKeisarApps/MoviesAndBeyond --skill navigation3

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides patterns and guidance for implementing and migrating to Jetpack Navigation 3 in Android Compose applications. It helps teams adopt type-safe routes, manage back stacks, and integrate with ViewModels and Hilt for robust navigation flows.

Core Features & Use Cases

  • Migration guidance: from Navigation 2 to 3 with Compose-first patterns and modern back stack management.
  • Type-safe routes: use @Serializable NavKey data classes to define destinations.
  • Back stack decorators: ensure ViewModels are scoped per NavEntry and that UI state is preserved.
  • Use Case: when upgrading a large Android app to Navigation 3 to achieve predictable navigation behavior and easier maintenance.

Quick Start

Follow the included patterns and scripts to validate setup, replace NavHost with NavDisplay, define type-safe routes, and wire decorators for ViewModels and Saveable state.

Frequently Asked Questions about navigation3

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate from Jetpack Navigation 2 to Navigation 3 in Compose?

Migrate from Navigation 2 to 3 by replacing NavHost with NavDisplay, defining @Serializable NavKey data classes for type-safe routes, and wiring back stack decorators to ensure ViewModels are scoped per NavEntry. Use included scripts to validate setup.

How does type-safe navigation work in Jetpack Compose?

Type-safe navigation in Jetpack Compose uses @Serializable NavKey data classes to define destinations instead of string routes. This ensures compile-time safety for navigation arguments and integrates with NavDisplay to manage UI state preservation.

Can I integrate Hilt ViewModels with Navigation 3 back stack management?

Yes, you can integrate Hilt ViewModels with Navigation 3 by using back stack decorators. These decorators ensure ViewModels are scoped per NavEntry and that UI state is preserved during multi-stack navigation flows across your app.

What is the best way to manage multi-stack navigation in Android Compose?

The best way to manage multi-stack navigation in Compose is using Navigation 3 patterns with NavDisplay. It provides modern back stack management and decorators to scope ViewModels per NavEntry, ensuring predictable navigation behavior and easier maintenance.

Does Navigation 3 support saving UI state across configuration changes?

Navigation 3 supports saving UI state by wiring decorators for ViewModels and Saveable state. Using back stack decorators ensures that ViewModels remain scoped per NavEntry and UI state is preserved during navigation flows.

When should I upgrade my Android app to Navigation 3?

Upgrade to Navigation 3 when you need predictable navigation behavior and easier maintenance in a large Android Compose app. It is ideal for adopting type-safe routes, multi-stack navigation, and robust ViewModel integration with Hilt.