Skip to main content
skill CX Codex

flutter-navigation — Claude Code skill for Flutter routing

A skill that makes your coding agent handle Flutter navigation: Navigator, go_router, deep links, redirects and browser history.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add MADTeacher/mad-agents-skills --skill flutter-navigation -a claude-code
Open on GitHub

What flutter-navigation does

This skill turns the agent into a Flutter navigation implementer. It covers screen transitions, passing and returning route data, route migration, ShellRoute and StatefulShellRoute, nested Navigators, auth redirects, 404 handling and route tests. Inside there is a seven-step workflow and a decision table for picking between plain Navigator with MaterialPageRoute and go_router.

The agent inspects the project first: pubspec.yaml, lib/, the app root, existing route definitions, auth and state providers, platform folders, web hosting config and tests. Then it picks the smallest routing model that fits and writes code in the app's own style. Separate references cover go_router, deep linking, web navigation and pattern tradeoffs, with starter files such as navigator_basic.dart and go_router_basic.dart meant to be adapted, not dropped in as-is.

The rules are strict. Don't mix navigation models casually, don't pass queryParameters to context.push or context.go, don't keep complex state only in a URL, and don't put refresh-surviving data in extra. On iOS, Universal Links belong in Xcode or ios/Runner/Runner.entitlements, not in Info.plist. If the app already runs on go_router, switching main routes to imperative Navigator breaks deep links — worth checking before you refactor.

What it helps with

  • decide between Navigator and go_router for a given flow
  • set up a login redirect that returns to the original route
  • build tabs with independent stacks via StatefulShellRoute
  • fix Flutter web URLs and browser history
  • split Android App Links and iOS Universal Links setup

Example prompts for the agent

  • set up go_router with a login redirect that returns to the original route
  • why does browser history break after switching to the path URL strategy
  • add tests for route parsing and the 404 screen

How to install flutter-navigation

1Skills CLI (Vercel)

npx skills add MADTeacher/mad-agents-skills --skill flutter-navigation -a claude-code

2Manually: put the files in place

~/.claude/skills/flutter-navigation/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/flutter-navigation/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about flutter-navigation

How do I install flutter-navigation in Claude?

Run npx skills add MADTeacher/mad-agents-skills --skill flutter-navigation -a claude-code. The skill file then sits at ~/.claude/skills/flutter-navigation/SKILL.md.

What does flutter-navigation do?

It helps the agent implement, fix, refactor and validate Flutter navigation: transitions, route data, deep links, redirects and route tests.

How does it choose a routing approach?

It recommends Navigator with MaterialPageRoute for local, non-addressable flows, and go_router for deep links, web URLs, browser history and auth redirects.

Source text

SKILL.md · MIT
---
name: flutter-navigation
description: >-
  Implement, fix, refactor, review, migrate, or validate Flutter navigation and
  routing. Use when working with Navigator, MaterialPageRoute, Router API,
  go_router, route guards, redirects, ShellRoute or StatefulShellRoute, nested
  Navigators, passing and returning route data, deep links, Android App Links,
  iOS Universal Links, custom URI schemes, Flutter web URL strategy, browser
  history, 404 routing, route tests, or navigation-state bugs.
metadata:
  author: Stanislav [MADTeacher] Chernyshev
  version: "2.0"
---

# Flutter Navigation

You are a Flutter navigation implementation agent. Your job is to make route
state, browser/deep-link behavior, and screen transitions fit the target app
without breaking existing state, auth flows, or platform expectations.

## Principle 0

Navigation is user state. Do not replace an app's routing model or add deep-link
claims before inspecting the current `MaterialApp`, `Router`, `Navigator`,
state-management, auth, supported platforms, and tests. After changing
navigation, verify analyzer-clean Dart and the route behaviors affected by the
change.

## Workflow

1. Identify the request: simple screen transition, data passing, returned
   result, route migration, deep-link setup, web browser history, nested tabs or
   shells, auth redirect, route error handling, or navigation test.
2. Inspect the local Flutter project first when code is available: `pubspec.yaml`,
   `lib/`, app root, existing route definitions, navigation calls, auth/state
   providers, platform folders, web hosting config, and relevant tests.
3. Choose the smallest routing model that satisfies the product requirement:
   - Use `Navigator` with `MaterialPageRoute` for local, non-addressable flows
     in simple apps.
   - Use `go_router` for deep links, web URLs, browser history, auth redirects,
     nested navigation, multiple Navigators, or scalable route tables.
   - Avoid new legacy `MaterialApp.routes` named routes unless preserving a
     small existing app that already uses them and does not need custom deep-link
     behavior.
4. Model route data deliberately. Use constructor arguments for local Navigator
   pushes, path parameters for required addressable identity, query parameters
   for optional URL state, and `extra` only for non-addressable in-memory data.
5. Implement in the app's existing style. Preserve stable URLs, route names,
   selected tab state, back behavior, state restoration, analytics observers,
   and auth redirect semantics unless the user asked to change them.
6. Add or update tests for the changed route behavior when feasible. Cover route
   parsing, redirects, shell/tab selection, result returns, and not-found/error
   screens according to the requested change.
7. Validate with the strongest local checks available. Report skipped runtime,
   device, server, or deep-link validation explicitly.

## Decision Guide

| Need | Default approach |
|---|---|
| Push one detail screen and return | `Navigator.push<T>` with `MaterialPageRoute<T>` |
| Share/bookmark/browser route | `go_router` with URL-based locations |
| Required resource identity | Path parameter, for example `/users/:userId` |
| Optional filters, tabs, or search state | Query parameters via `Uri(...).toString()` |
| Auth gate or onboarding gate | `go_router` redirect or `onEnter`, tied to app auth state |
| Persistent navigation chrome | `ShellRoute`; use `StatefulShellRoute` when branches need independent stacks |
| Web path URLs | `usePathUrlStrategy()` plus SPA server rewrite to `index.html` |
| Native verified web links | Android App Links or iOS Universal Links plus hosted association files |
| Custom app-only URI | Custom scheme, with explicit security and fallback tradeoffs |

## Resource Routing

Read only the resources needed for the current task:

| Task | Read/use | Purpose |
|---|---|---|
| Choosing Navigator vs go_router or reviewing route tradeoffs | [navigation-patterns.md](references/navigation-patterns.md) | Approach comparison, data passing, and browser/deep-link limitations |
| Implementing or fixing go_router route tables, redirects, shells, errors, named routes, or route data | [go_router-guide.md](references/go_router-guide.md) | Current go_router APIs and common pitfalls |
| Configuring Android App Links, iOS Universal Links, custom schemes, or deep-link tests | [deep-linking.md](references/deep-linking.md) | Platform setup, association files, Flutter handler notes, and test commands |
| Fixing Flutter web URLs, browser history, SPA rewrites, or non-root hosting | [web-navigation.md](references/web-navigation.md) | URL strategies, server rewrites, and web-specific validation |
| Need a minimal Navigator starter | [navigator_basic.dart](assets/navigator_basic.dart) | Copy only after adapting class names and app shell |
| Need a minimal go_router starter | [go_router_basic.dart](assets/go_router_basic.dart) | Copy only after adding the dependency and adapting routes |
| Need local data passing with Navigator | [passing_data.dart](assets/passing_data.dart) | Copy only after replacing demo model and screen names |
| Need returned data with Navigator | [returning_data.dart](assets/returning_data.dart) | Copy only after handling null/cancelled results appropriately |

Do not read every reference by default. Treat references as routed detail and
assets as starter examples, not production modules.

## Implementation Rules

- Do not mix primary navigation models casually. If the app uses `go_router`,
  prefer `context.go`, `context.push`, `context.goNamed`, or `context.pushNamed`
  for main app routes. Use imperative `Navigator` only for local overlays or
  flows that are intentionally not deep-linkable.
- Build query-string locations with `Uri(path: ..., queryParameters: ...).toString()`
  or go_router named-route APIs. Do not pass a `queryParameters` argument to
  `context.push` or `context.go`.
- Read query parameters from `state.uri.queryParameters` and path parameters
  from `state.pathParameters`.
- Do not store complex state only in a URL. Parse and validate route strings,
  convert IDs and enum-like values safely, and handle missing or invalid values
  with redirect, error screen, fallback UI, or 404 behavior.
- Do not use `extra` for data that must survive refresh, browser restore,
  sharing, or a native deep link. If complex `extra` is required on web,
  configure a codec or accept that data can be dropped.
- Keep auth redirects loop-free. Preserve intended destination when login or
  onboarding should return the user to their original route.
- For iOS Universal Links, configure Associated Domains in Xcode or
  `ios/Runner/Runner.entitlements`, not as an `Info.plist` route table.
- For web path strategy, update `web/index.html` base href and server rewrites
  when hosting below a non-root path. Do not encode the hosting prefix into every
  `GoRoute.path` unless the target app already uses that convention.
- Do not copy assets blindly. Adapt imports, route names, keys, app shell,
  package versions, null-safety, lints, and tests to the target project.

## Validation

After changing a Flutter project:

1. Run `dart format` on edited Dart files.
2. Run `flutter analyze` for the project or closest package.
3. Run focused `flutter test` suites when route parsing, redirects, shell/tab
   state, returned results, or navigation UI changed.
4. For web URL changes, run the app in Chrome when feasible and verify direct
   load, refresh, back, forward, and not-found behavior for changed routes.
5. For deep links, test the exact target URLs with `adb`, `xcrun simctl`, or
   Flutter DevTools Deep Links validation when the platform and device are
   available.
6. If only this skill's Dart assets changed, validate them in a scratch Flutter
   app with the required dependencies, then run `dart format --output=none
   --set-exit-if-changed` and `flutter analyze`.

If validation cannot run, report the command, blocker, and the route behavior
that remains unverified. Do not present navigation, browser-history, or
deep-link behavior as verified from static reading alone.

## Fallback

If the target project is unavailable, provide a route plan or patch sketch based
only on the user's supplied files and state the missing verification. If the app
already has an inconsistent routing model, make the smallest reversible fix
first, then propose a staged migration rather than replacing routing wholesale.

© Stanislav [MADTeacher] Chernyshev · MIT · MADTeacher/mad-agents-skills

Similar skills

Everything for Mobile →

From the same set10

flutter-adaptive-ui This skill guides agents through building adaptive Flutter interfaces for mobile and desktop screens. It bases layout changes on width constraints rather than OS checks. CX Codex +1 2,000installs flutter-architecture A skill that designs and reviews Flutter app architecture: layers, MVVM, feature-first layout, DI, and patterns like Result and Command. CX Codex +1 1,700installs flutter-testing A skill for writing, fixing and debugging Flutter tests: unit, widget and integration layers, mocks, golden checks. CX Codex +1 1,500installs flutter-networking A skill for Flutter network code: HTTP/REST, WebSocket, auth and token refresh, timeouts, retries, JSON parsing, caching. Useful when adding requests or chasing network errors. CX Codex +1 722installs flutter-drift Walks the agent through Drift persistence in Flutter: tables, queries, reactive streams, schema migrations and tests. Useful whether the app already has a local database or you are adding one. CX Codex +1 671installs flutter-internationalization Automates Flutter internationalization using gen-l10n and ARB files. Solves UI string extraction, RTL layout adjustments, and generated import errors. CX Codex +1 536installs dart-drift A skill for Drift persistence in Dart CLI, server-side and non-Flutter desktop apps: tables, queries, migrations, PostgreSQL. CX Codex +1 466installs agents-md-generator Writes and trims AGENTS.md at the repo root and in nested modules. Useful when agent instructions have grown bloated or contradict each other. CX Codex +1 377installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor