agentleFS
fatihkanfatihkan/badi/.claude/skills-vault/expo-router/SKILL.md

expo-router

Skill8 starsChanged 3 months agoMITView on GitHub

File-based routing with Expo Router, dynamic routes, layout hierarchy, deep linking, and navigation patterns. Triggers on expo-router, file-based routing, app dizini, _layout.tsx, [id].tsx, deep linking, expo-linking, tab navigation, stack navigation, drawer, prefetch, parallel routes, redirects, navigation, useRouter, useLocalSearchParams.

12 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use expo-project-structure, expo-overview and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • arcboxlabsSkill

    expo-project-structure

    Framework (OSS). Folder structure for a new Expo app. Use when scaffolding or laying out a new Expo project with Expo Router, or deciding where a file should live in one. For new projects only — never restructure an existing app to match.

    Also in 7 projects that use this

  • deonmenezesSkill

    expo-overview

    Entry point and router for every Expo or EAS task. Load this skill first — before writing code and before choosing another expo-* / eas-* skill — when the request, PRD, or spec mentions Expo, EAS, Expo Go, or an expo-* package, or the project has an `expo` dependency in `package.json`. Within that gate it also covers app specs and designs to implement (tabs, stacks, maps, lists, navigation, building from a screenshot), and phrasings like 'implement a mobile app', 'make my app look native', 'add navigation', 'fetch some data', 'upgrade my SDK', 'add Expo to my existing native app', 'ship to the App Store', or 'I'm new to Expo, where do I start'. A fully specified request (SDK pinned, libraries named, layout given) still routes through here — the shared setup rules still apply. Do NOT load it when neither signal is present: a bare React Native project with no `expo` dependency is not Expo work. Detects the real goal, routes to the right expo-* / eas-* skill, and owns the shared setup rules.

    Also in 5 projects that use this

  • CaiZongyuanSkill

    expo-ui

    This skill should be used when users need to work with Expo UI (@expo/ui) for integrating SwiftUI components into React Native applications. It provides comprehensive guidance on installation, Host component, SwiftUI primitives, layouts, modifiers, native tabs navigation, and v10 preview features.

    Also in 5 projects that use this

  • NoyaraAISkill

    expo-upgrade

    Framework (OSS). Guidelines for upgrading Expo SDK versions and fixing dependency issues

    Also in 4 projects that use this

  • NoyaraAISkill

    eas-hosting

    EAS service (paid). Deploy Expo websites and Expo Router API routes to EAS Hosting - export the web bundle, run eas deploy for production and PR preview URLs, manage environment secrets and custom domains, and work within the Cloudflare Workers runtime. Also covers authoring API routes (+api.ts handlers, HTTP methods, request handling, CORS). Use when deploying an Expo web app or API routes, setting up EAS Hosting, or configuring hosting environments and domains. Not for native builds or store releases - use the eas-app-stores skill for those.

    Also in 3 projects that use this

  • jsmastery-proSkill

    expo-design-system

    Build and maintain a design system inside an Expo app - a reusable theme of design tokens (color, spacing, typography, radius, shadow, motion), reusable component structure with variant/size/state prop conventions, and rules for when to extract a repeated view into a shared component. Use when creating or organizing theme files and design tokens (theme.ts / theme/), extending an existing theme or styling library (NativeWind, Tamagui, Restyle, Unistyles) in its own idiom, standardizing styles so screens (including AI-generated ones) look consistent and polished, fixing an app that looks AI-generated or generic instead of native (the named native-slop tells), building an in-app component library, or auditing an app for design-system drift (hardcoded colors, spacing, fonts). For platform styling specifics (semantic colors, HIG rules, native controls) use expo-native-ui; for folder layout of a new app use expo-project-structure.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 12 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    +not-found.tsx: always define it

    line 166
  2. Very specific:

    Use the <Redirect href="/login" /> component for redirects

    line 167
  3. Very specific:

    Error boundary: put <ErrorBoundary> in the layout

    line 170
  4. Distinctive:

    Test command (uri-scheme / adb)

    line 191

“Common” is measured: kept by at least 6 in 10 of the 12 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

expo-router

File-based routing discipline for Expo Router (v3+). Guides the app/ directory structure, dynamic routes, layout chains, deep linking, and navigation patterns. Stays out of build/release or native config.

What It Does

  • app/ directory structure recommendation (tabs, stack, drawer, modal)
  • Configures dynamic and catch-all route patterns
  • _layout.tsx chains and nested-layout discipline
  • Deep linking (expo-linking) + scheme + universal links configuration
  • Prefetch, redirects, error boundaries, not-found handling
  • Typed routes and useLocalSearchParams type discipline

Basic Setup

npx expo install expo-router react-native-safe-area-context react-native-screens \
  expo-linking expo-constants expo-status-bar

package.json:

{ "main": "expo-router/entry" }

app.json:

{
  "expo": {
    "scheme": "myapp",
    "plugins": ["expo-router"],
    "experiments": { "typedRoutes": true }
  }
}

Directory Structure (recommended)

app/
  _layout.tsx              # Root layout (providers, theme, fonts)
  index.tsx                # / route
  +not-found.tsx           # 404
  (auth)/                  # group — not reflected in the URL
    _layout.tsx
    login.tsx
    register.tsx
  (tabs)/                  # tab navigator
    _layout.tsx            # Tabs definition
    index.tsx              # /
    profile.tsx            # /profile
    settings.tsx
  posts/
    index.tsx              # /posts
    [id].tsx               # /posts/:id  (dynamic)
    [...slug].tsx          # /posts/* (catch-all)
  modal.tsx                # presentation: modal

Layout Examples

Root Layout

// app/_layout.tsx
import { Stack } from "expo-router";
import { SafeAreaProvider } from "react-native-safe-area-context";

export default function RootLayout() {
  return (
    <SafeAreaProvider>
      <Stack screenOptions={{ headerShown: false }}>
        <Stack.Screen name="(tabs)" />
        <Stack.Screen name="modal" options={{ presentation: "modal" }} />
        <Stack.Screen name="+not-found" />
      </Stack>
    </SafeAreaProvider>
  );
}

Tabs Layout

// app/(tabs)/_layout.tsx
import { Tabs } from "expo-router";
import { Ionicons } from "@expo/vector-icons";

export default function TabsLayout() {
  return (
    <Tabs screenOptions={{ tabBarActiveTintColor: "#007aff" }}>
      <Tabs.Screen
        name="index"
        options={{ title: "Home", tabBarIcon: ({ color }) => <Ionicons name="home" color={color} /> }}
      />
      <Tabs.Screen name="profile" options={{ title: "Profile" }} />
    </Tabs>
  );
}

Dynamic Routes & Params

// app/posts/[id].tsx
import { useLocalSearchParams, Link } from "expo-router";

export default function PostDetail() {
  const { id } = useLocalSearchParams<{ id: string }>();
  return <Text>Post {id}</Text>;
}

Navigation:

import { router, Link } from "expo-router";

<Link href={`/posts/${post.id}`}>View</Link>
router.push({ pathname: "/posts/[id]", params: { id: post.id } });
router.replace("/(tabs)");
router.back();

Deep Linking

app.json:

{
  "expo": {
    "scheme": "myapp",
    "ios": { "associatedDomains": ["applinks:myapp.com"] },
    "android": {
      "intentFilters": [{
        "action": "VIEW",
        "autoVerify": true,
        "data": [{ "scheme": "https", "host": "myapp.com" }],
        "category": ["BROWSABLE", "DEFAULT"]
      }]
    }
  }
}

Test:

npx uri-scheme open myapp://posts/42 --ios
adb shell am start -W -a android.intent.action.VIEW -d "myapp://posts/42"

Best Practices

  • Group folders (name) to organize without polluting the URL
  • Enable typed routes (experiments.typedRoutes: true) — compile-time check
  • +not-found.tsx always define it
  • Use the <Redirect href="/login" /> component for redirects
  • Modal vs page: present a native modal with presentation: "modal"
  • Prefetch: preload with <Link href="/heavy" prefetch>
  • Error boundary: put <ErrorBoundary> in the layout

Common Failure Patterns

  • main is not expo-router/entry → the app won't launch
  • scheme missing → deep link doesn't work
  • No _layout.tsx inside (group) → the group's children don't render
  • useLocalSearchParams untyped → you get undefined instead of a string
  • Wrong nested Stack/Tabs order → header clash

Hard Refusal

  • Impersonating (hijacking) an unauthorized app's URL scheme
  • Bypassing universal link verification
  • Generating fake deep links for phishing

Output Format

  1. Directory tree (app/ structure)
  2. _layout.tsx examples
  3. app.json scheme/plugins block
  4. Test command (uri-scheme / adb)
  5. Next step (deep link test, enable typed routes)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.