Expo Router logo

Expo Router

Organization
TheBushidoCollective
expo-router

Use when implementing file-based routing in Expo with Expo Router. Covers app directory structure, navigation, layouts, dynamic routes, and deep linking.

Overview

PublisherTheBushidoCollective
Repositoryhan
Skill nameexpo-router
Stars
195
Forks
20
Bundled files
Instructions only
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by TheBushidoCollective on GitHub. Read the source before you install it.

Installation

Install the Expo Router AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/TheBushidoCollective/han.git /tmp/han
mkdir -p .claude/skills
cp -r /tmp/han/plugins/frameworks/expo/skills/expo-router .claude/skills/expo-router
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Expo Router in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Expo Router on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Expo Router is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Expo Router

Use this skill when implementing file-based routing with Expo Router, the recommended navigation solution for Expo apps.

Key Concepts

File-Based Routing

Routes are defined by file structure:

app/
  _layout.tsx          # Root layout
  index.tsx            # / route
  about.tsx            # /about route
  (tabs)/              # Group (not in URL)
    _layout.tsx        # Tabs layout
    home.tsx           # /home
    profile.tsx        # /profile
  users/
    [id].tsx           # /users/:id dynamic route
    index.tsx          # /users route

Basic Routes

tsx
// app/index.tsx
import { View, Text } from 'react-native';
import { Link } from 'expo-router';

export default function Home() {
  return (
    <View>
      <Text>Home Screen</Text>
      <Link href="/about">Go to About</Link>
    </View>
  );
}

// app/about.tsx
export default function About() {
  return (
    <View>
      <Text>About Screen</Text>
    </View>
  );
}

Layouts

tsx
// app/_layout.tsx
import { Stack } from 'expo-router';

export default function RootLayout() {
  return (
    <Stack>
      <Stack.Screen name="index" options={{ title: 'Home' }} />
      <Stack.Screen name="about" options={{ title: 'About' }} />
    </Stack>
  );
}

Tab Navigation

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

export default function TabLayout() {
  return (
    <Tabs>
      <Tabs.Screen
        name="home"
        options={{
          title: 'Home',
          tabBarIcon: ({ color, size }) => (
            <Ionicons name="home" size={size} color={color} />
          ),
        }}
      />
      <Tabs.Screen
        name="profile"
        options={{
          title: 'Profile',
          tabBarIcon: ({ color, size }) => (
            <Ionicons name="person" size={size} color={color} />
          ),
        }}
      />
    </Tabs>
  );
}

Best Practices

Dynamic Routes

tsx
// app/users/[id].tsx
import { useLocalSearchParams } from 'expo-router';
import { View, Text } from 'react-native';

export default function UserDetails() {
  const { id } = useLocalSearchParams<{ id: string }>();

  return (
    <View>
      <Text>User ID: {id}</Text>
    </View>
  );
}

// Navigate to /users/123
<Link href="/users/123">View User</Link>
// Or
import { router } from 'expo-router';
router.push('/users/123');

Programmatic Navigation

tsx
import { router } from 'expo-router';

function MyComponent() {
  const handlePress = () => {
    // Navigate to route
    router.push('/details');

    // Navigate with params
    router.push({
      pathname: '/users/[id]',
      params: { id: '123' },
    });

    // Replace current route
    router.replace('/login');

    // Go back
    router.back();
  };

  return <Button title="Navigate" onPress={handlePress} />;
}

Type-Safe Routes

tsx
// types/navigation.ts
export type RootStackParamList = {
  '/': undefined;
  '/about': undefined;
  '/users/[id]': { id: string };
  '/posts/[id]': { id: string; title?: string };
};

// Usage with type safety
import { router } from 'expo-router';
import type { RootStackParamList } from './types/navigation';

// TypeScript will enforce correct params
router.push({
  pathname: '/users/[id]' as const,
  params: { id: '123' },
});

Route Groups

Group routes without affecting URLs:

app/
  (auth)/              # Group (not in URL)
    login.tsx          # /login
    register.tsx       # /register
    _layout.tsx        # Auth layout
  (app)/               # Group (not in URL)
    home.tsx           # /home
    profile.tsx        # /profile
    _layout.tsx        # App layout
tsx
// app/(auth)/_layout.tsx
import { Stack } from 'expo-router';

export default function AuthLayout() {
  return (
    <Stack screenOptions={{ headerShown: false }}>
      <Stack.Screen name="login" />
      <Stack.Screen name="register" />
    </Stack>
  );
}

Common Patterns

Authentication Flow

tsx
// app/_layout.tsx
import { Slot, useRouter, useSegments } from 'expo-router';
import { useEffect } from 'react';
import { useAuth } from './hooks/useAuth';

export default function RootLayout() {
  const { user, loading } = useAuth();
  const segments = useSegments();
  const router = useRouter();

  useEffect(() => {
    if (loading) return;

    const inAuthGroup = segments[0] === '(auth)';

    if (!user && !inAuthGroup) {
      router.replace('/(auth)/login');
    } else if (user && inAuthGroup) {
      router.replace('/(app)/home');
    }
  }, [user, loading, segments]);

  return <Slot />;
}

Modal Routes

tsx
// app/_layout.tsx
import { Stack } from 'expo-router';

export default function RootLayout() {
  return (
    <Stack>
      <Stack.Screen name="(tabs)" options={{ headerShown: false }} />
      <Stack.Screen
        name="modal"
        options={{
          presentation: 'modal',
          title: 'Modal',
        }}
      />
    </Stack>
  );
}

// app/modal.tsx
import { View, Text, Button } from 'react-native';
import { router } from 'expo-router';

export default function Modal() {
  return (
    <View>
      <Text>Modal Content</Text>
      <Button title="Close" onPress={() => router.back()} />
    </View>
  );
}

Deep Linking

json
// app.json
{
  "expo": {
    "scheme": "myapp",
    "plugins": ["expo-router"]
  }
}
tsx
// Deep link: myapp://users/123
// Opens app/users/[id].tsx with id="123"

// Universal link: https://myapp.com/users/123
// Requires additional iOS/Android configuration

Search Params

tsx
import { useLocalSearchParams } from 'expo-router';

function ProductScreen() {
  const { id, category, sort } = useLocalSearchParams<{
    id: string;
    category?: string;
    sort?: string;
  }>();

  return (
    <View>
      <Text>Product: {id}</Text>
      <Text>Category: {category}</Text>
      <Text>Sort: {sort}</Text>
    </View>
  );
}

// Navigate with query params
<Link href="/products/123?category=electronics&sort=price">
  View Product
</Link>

Anti-Patterns

Don't Use React Navigation Directly

tsx
// Bad - Mixing Expo Router with React Navigation
import { NavigationContainer } from '@react-navigation/native';

// Good - Use Expo Router only
import { Stack } from 'expo-router';

Don't Nest Navigators Incorrectly

tsx
// Bad - Multiple Stack navigators without layout
// app/home.tsx
<Stack>
  <Stack.Screen name="details" />
</Stack>

// Good - Use layouts for nested navigation
// app/home/_layout.tsx
<Stack>
  <Stack.Screen name="index" />
  <Stack.Screen name="details" />
</Stack>

Don't Hardcode Routes

tsx
// Bad - String literals everywhere
router.push('/users/123');
router.push('/prodcts/456'); // Typo won't be caught

// Good - Use constants or typed routes
const ROUTES = {
  USER_DETAILS: (id: string) => `/users/${id}` as const,
  PRODUCT_DETAILS: (id: string) => `/products/${id}` as const,
} as const;

router.push(ROUTES.USER_DETAILS('123'));

Related Skills

  • expo-config: Configuring deep linking
  • expo-modules: Using navigation with Expo modules

Frequently asked questions

What does the Expo Router AI skill do?

Use when implementing file-based routing in Expo with Expo Router. Covers app directory structure, navigation, layouts, dynamic routes, and deep linking.

Why use Expo Router on TypingMind?

Because you install it once and use it with any model. Expo Router is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Expo Router in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/TheBushidoCollective/han/tree/main/plugins/frameworks/expo/skills/expo-router. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Expo Router?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Expo Router?

As many as you like. As long as a model supports skills, you can use Expo Router with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Expo Router AI skill free?

It is published on GitHub by TheBushidoCollective. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇