/expo-stack:expo-stack-deep-linkingfrom expo-stack
Configures custom scheme, Universal/App Links, and deferred deep linking in an Expo + Convex stack. Use when adding share/invite links, OAuth callbacks, or debugging links that open the wrong screen or fail silently.
Ships in expo-stack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Three layers that get conflated. They have different config, different failure modes, and only the third needs a third-party service.
| Layer | URL | Works when | Config |
|---|---|---|---|
| Custom scheme | acme://invite/abc | App is installed | scheme in app.json |
| Universal / App Links | https://acme.app/invite/abc | App is installed; otherwise opens the web page | associatedDomains (iOS) + intentFilters with autoVerify (Android) + a hosted file |
| Deferred | same https link | App is not installed — intent survives the store round-trip | Layer 2 plus an attribution SDK |
Defer to expo/skills → linking for the base mechanics. This skill covers the wiring order, the rewrite hook, and the three gates in this stack that eat a link if you let them.
Already set by the scaffold; /expo-stack:rebrand moves it. It is not primarily for user-facing links — it is what Better Auth's OAuth and magic-link callbacks come back on. If trustedOrigins in convex/auth.ts does not contain <scheme>://, the callback is rejected and sign-in fails with a message that blames the provider. /expo-stack:doctor checks this.
Changing the scheme is a native change: rebuild, never OTA.
// app.config.ts
ios: {
...config.ios,
associatedDomains: ['applinks:acme.app'],
},
android: {
...config.android,
intentFilters: [
{
action: 'VIEW',
autoVerify: true,
data: [{ scheme: 'https', host: 'acme.app' }],
category: ['BROWSABLE', 'DEFAULT'],
},
],
},
Both halves are native config — they take effect on the next build, not on an OTA. Each also requires a file served from the domain over HTTPS with no redirects: /.well-known/apple-app-site-association (no extension, application/json) and /.well-known/assetlinks.json (the SHA-256 of the signing cert that actually shipped — the EAS-managed one, not your local debug key). A wrong fingerprint fails silently: the link just opens the browser.
Verify before assuming: npx uri-scheme open https://acme.app/invite/abc --ios, and on device check iOS Settings → Developer → Universal Links diagnostics, or adb shell pm get-app-links <package> on Android.
+native-intent.tsx — the one rewrite pointsrc/app/+native-intent.tsx is not a route. It is the hook Expo Router calls with every incoming URL before the first screen mounts, and it is the only place a link can be rewritten without racing the navigation tree.
// src/app/+native-intent.tsx
export async function redirectSystemPath({
path,
initial,
}: {
path: string
initial: boolean
}) {
// Let auth callbacks through untouched — Better Auth owns these.
if (path.startsWith('/api/auth')) return path
try {
return await rewrite(path, initial)
} catch {
return '/' // never throw out of here: a throw here is a launch crash
}
}
Two rules:
This is the documented exception to src/app holds routes only — +native-intent.tsx is router configuration, not a screen. Keep the actual logic in src/lib/, and let the file stay a thin handler like every route file.
A user taps an invite link, does not have the app, goes through the store, and launches. Both stores drop the URL at that boundary, so the app opens blind to the intent that caused the install. That is the Installation Gap, and it is where invite flows, referral credit and campaign attribution quietly die.
Fixing it means capturing the URL at click time and replaying it on first launch. The matching is not symmetric:
click_id rides to Play via the Install Referrer API and comes back on first launch. 1:1, exact.Detour (Software Mansion) resolves the link through +native-intent.tsx rather than in a detached listener, which is why it is the fit here — it hands the router a path before the first render instead of pushing a navigation after mount.
// src/app/+native-intent.tsx
import { createDetourNativeIntentHandler } from '@swmansion/react-native-detour/expo-router'
export const redirectSystemPath = createDetourNativeIntentHandler({
fallbackPath: '/',
hosts: [/\.godetour\.link$/i],
})
Attribution-first SDKs (AppsFlyer, Branch, Adjust) solve the same problem and are the right call if you need their analytics side. The cost is that they hand you a raw URL string in a callback that knows nothing about your router, so you write the lifecycle glue yourself. Pick on whether you need attribution reporting or just the link.
Either way this is a native module: development build required, Expo Go cannot run it.
This is the part every deep-linking guide underplays, and this stack has three guards stacked in the root layout (see expo-stack-onboarding): hasSeenIntro, session, and onboardingCompletedAt. A resolved link that arrives before all three settle gets replaced by a redirect to (onboarding) or (auth) and is gone.
Hold the intent until the app is actually ready to honour it:
// src/app/_layout.tsx
function AuthProtectedStack() {
const { link, clearLink, isLinkProcessed } = useDetourContext()
const { data: session, isPending } = authClient.useSession()
const user = useQuery(api.users.current)
const router = useRouter()
const ready =
isLinkProcessed && !isPending && !!session && user?.onboardingCompletedAt != null
useEffect(() => {
if (!ready || !link) return
clearLink() // clear first — this must fire exactly once
router.replace(link.route)
}, [ready, link])
return <Stack>{/* guards as in expo-stack-onboarding */}</Stack>
}
Three things this gets right and hand-rolled versions usually do not:
clearLink() before router.replace(). Clearing after means a re-render between the two replays the navigation.isSignedIn. Waiting on the session alone still loses the link to the post-sign-up setup redirect.replace, not push. The deferred target is where the user meant to land, not a screen stacked on top of a launch screen they never saw.A deferred link that arrives for a signed-out user is an argument for making the destination previewable signed-out, with the sign-in prompt at the point of action. Bouncing someone to /sign-in on their first launch, when they arrived expecting a specific invite, is the same friction expo-stack-monetization describes as Day-0 churn.
npx uri-scheme open "acme://invite/abc" --ios
xcrun simctl openurl booted "https://acme.app/invite/abc"
adb shell am start -a android.intent.action.VIEW -d "https://acme.app/invite/abc" <package>
Cover all four states, because they take different code paths: cold launch (initial: true), warm/backgrounded, already on the target screen, and not installed (the deferred path — needs a real store or TestFlight install, and is the one people ship untested).
Verify on device with argent: launch-app → open-url → describe to confirm the screen that actually mounted. A link that logs the right path but lands on the tab bar is not working.
useEffect in the root layout. That is the race +native-intent.tsx exists to remove.src/lib/, called from +native-intent.tsx.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
14 skills in this plugin
/expo-stackScaffold, configure, diagnose, polish, and ship production Expo applications with the Expo Stack workflow in Codex./expo-stack-architectureFolder layout, the routes-only rule, platform file extensions, and monorepo/workspace wiring for an Expo Router app in this stack. Use when scaffolding a project, deciding where a new file belongs, adding a shared package, or fixing Metro resolution in a bun/pnpm/yarn workspace./expo-stack-asoApp Store Optimization as part of the build loop — the indexed metadata fields, keyword strategy, screenshots that rank as well as convert, review-prompt timing, and store localization matched to the app's locales. Use when preparing a store listing, choosing a title/subtitle/keywords, planning screenshots, adding a rating prompt, or asked why an app is not being found.npx claudepluginhub flyingwebie/skills --plugin expo-stackOther plugins' skills for the same job