compose-navigation

Implement type-safe navigation with Serializable routes in Jetpack Compose apps.

915|88|Updated Feb 6, 2024
One-click install
npx skills add https://github.com/new-silvermoon/awesome-android-agent-skills --skill compose-navigation-new-silvermoon
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: compose-navigation
Source: https://github.com/new-silvermoon/awesome-android-agent-skills/tree/main/.github/skills/compose-navigation
Command: npx skills add https://github.com/new-silvermoon/awesome-android-agent-skills --skill compose-navigation-new-silvermoon

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill enables type-safe navigation in Jetpack Compose applications, reducing boilerplate and errors when wiring screens together.

Core Features & Use Cases

  • Type-safe Routes: Define routes with @Serializable data classes and objects to ensure type safety when navigating.
  • NavHost & NavController Setup: Create and configure a NavController and NavHost to manage destinations and argument passing.
  • Deep Links & Nested Graphs: Support deep links, nested navigation graphs, and adaptive navigation for different screen sizes.
  • Use Case: Build an app with Home, Profile, and Settings screens, navigating between them with strongly-typed routes and safe argument passing.

Quick Start

Set up a minimal Compose app with a NavHost and a few Serializable routes, then run the sample to navigate between Home, Profile, and Settings.

Frequently Asked Questions about compose-navigation

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

FAQPage Schema
How do I set up type-safe navigation in Jetpack Compose?

Type-safe navigation in Jetpack Compose uses @Serializable data classes and objects to define routes. This ensures type safety when navigating between screens and safely passing arguments via a configured NavController and NavHost.

Can I handle deep links with NavController in a Compose app?

Yes, deep links are fully supported. You can configure deep links alongside nested navigation graphs within your NavHost to manage destinations and direct user entry into specific Compose screens.

What is the best way to pass arguments between Compose screens?

The best way to pass arguments between Compose screens is by using strongly-typed Serializable route definitions. This approach enforces type safety, reducing boilerplate and preventing runtime errors when wiring multi-screen flows.

Does this type-safe Compose navigation approach support adaptive layouts?

Yes, this approach supports adaptive navigation for different screen sizes. You can configure your NavHost and NavController to manage destinations dynamically across various device layouts within your Compose application.

How do I create a testable navigation architecture in Compose?

To create a testable navigation architecture in Compose, use NavController patterns with type-safe Serializable routes. This decouples navigation logic from UI components, enabling robust testing of multi-screen flows and argument passing.