$npx -y skills add clerk/skills --skill clerk-expoAdd Clerk authentication to Expo and React Native apps using @clerk/expo.
| 1 | # Clerk Expo (React Native) |
| 2 | |
| 3 | Implement Clerk in Expo / React Native projects. This skill inlines verified patterns for the stable surface (provider, token cache, flows) and requires source inspection of the installed `@clerk/expo` package for anything volatile (component props, hook signatures). |
| 4 | |
| 5 | ## Activation Rules |
| 6 | |
| 7 | Activate when either is true: |
| 8 | - The user asks for auth in an Expo or React Native app, or mentions `@clerk/expo`, `ClerkProvider`, Expo Router auth, or Clerk hooks in a native app. |
| 9 | - The project is Expo/React Native (`app.json` / `app.config.js`, `expo` in `package.json`, `metro.config.js`, `@clerk/expo` dependency). |
| 10 | |
| 11 | Route away when: |
| 12 | - Native iOS/Swift project (`.xcodeproj`, `Package.swift`) → `clerk-swift` |
| 13 | - Native Android/Kotlin project (`build.gradle` without React Native) → `clerk-android` |
| 14 | - Web-only framework (Next.js, Remix, plain React, etc.) → the matching framework skill |
| 15 | |
| 16 | ## Intent Map |
| 17 | |
| 18 | Match what the user asked for, then load the reference(s) listed. Load only what the task needs. |
| 19 | |
| 20 | | User intent (examples) | Path | Reference | |
| 21 | |------------------------|------|-----------| |
| 22 | | "Add auth to my app" / "add sign-in with Clerk" | Prebuilt native components (default) | references/setup.md + references/prebuilt-components.md | |
| 23 | | "Add auth" but Expo Go / web / custom UI required | Custom flows | references/setup.md + references/custom-flows.md | |
| 24 | | "Add phone / SMS auth", "email OTP", "passwordless" | Custom flow, `phoneCode` / `emailCode` | references/custom-flows.md | |
| 25 | | "Sign in with Google/Apple/GitHub", "social login", "SSO" | Browser SSO or native buttons | references/sso-and-native-auth.md | |
| 26 | | "MFA / 2FA / TOTP", "forgot password", "email link" | Custom flow additions | references/custom-flows.md | |
| 27 | | "Protect routes/screens", "redirect if signed out" | Expo Router guards | references/protected-routes.md | |
| 28 | | "Show user profile", "org switching", "push notifications", "sign out", "call my backend" | App recipes | references/recipes.md | |
| 29 | | "Biometric login", "Face ID", "passkeys" | Device features | references/recipes.md | |
| 30 | |
| 31 | ## Default Path Decision |
| 32 | |
| 33 | When the user says "add auth" without specifying UI: |
| 34 | |
| 35 | 1. **Default to prebuilt native components** (`AuthView` + `UserButton` from `@clerk/expo/native`). Fastest to working auth; UI is maintained by Clerk. Tell the developer they are in beta and require a development build. |
| 36 | 2. **Fall back to custom flows** when any of these hold — say why when you switch: |
| 37 | - The project must run in Expo Go (no dev build). |
| 38 | - The app targets web (native components don't render on web). |
| 39 | - The developer wants their own UI or a specific brand experience beyond theming. |
| 40 | 3. If the developer has an existing auth UI, extend what's there — don't rip out custom flows to insert `AuthView` (or vice versa) without being asked. |
| 41 | |
| 42 | Do not blend prebuilt components and custom flows for the same auth step (e.g. `AuthView` plus a custom password form). Blending is allowed only when the developer explicitly asks. |
| 43 | |
| 44 | ## Quick Workflow |
| 45 | |
| 46 | 1. Confirm project type (Expo/RN) and pick the path per the Intent Map / Default Path rules. |
| 47 | 2. Follow references/setup.md: install, env key, provider, token cache, config plugin, build type. |
| 48 | 3. Verify dashboard prerequisites (Gate 2 and Gate 3 below). |
| 49 | 4. Implement from the selected reference only. |
| 50 | 5. Verify by building, not just by writing: |
| 51 | - Run the project's typecheck (`npx tsc --noEmit` or equivalent). |
| 52 | - Build and launch: `npx expo run:ios` / `run:android` for native features, `npx expo start` for Expo Go flows. If the build fails, fix and rebuild iteratively — build errors against the installed SDK are the ground truth when this skill and the SDK disagree. After ~5 failed fix attempts, stop and ask the developer how to proceed instead of thrashing. |
| 53 | - Walk the developer through one real sign-in, then confirm the session survives an app restart (token cache working). |
| 54 | |
| 55 | ## Execution Gates (Do Not Skip) |
| 56 | |
| 57 | 1. **Publishable key** — Read from `process.env.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY` (`.env` file). Never `NEXT_PUBLIC_`, never hardcoded. If no key exists, ask the developer for one (or run `npx clerk@latest init --framework expo`, which installs the SDK and writes the env file) and wait before editing files. |
| 58 | 2. **Native API dashboard toggle** — Clerk's Native API must be enabled for the instance: Clerk |