Expo landmines skill for Claude Code
A Claude Code skill that stops AI coding agents repeating the Expo and React Native mistakes in my error library. It has 84 rules, each saying what not to do and what to do instead.
Install
Save the file to ~/.claude/skills/expo-landmines/SKILL.md, or run this:
shell
mkdir -p ~/.claude/skills/expo-landmines
curl -o ~/.claude/skills/expo-landmines/SKILL.md https://davidewins.com/skills/expo-landmines/SKILL.mdThe raw file is at /skills/expo-landmines/SKILL.md.
What it covers
| Area | Rules |
|---|---|
| Expo Router | 13 |
| EAS build and update | 19 |
| Upgrades | 12 |
| Native modules | 16 |
| Styling | 5 |
| React and runtime | 5 |
| Stores | 14 |
| Total | 84 |
Every rule comes from the error library or from store-preflight.
SKILL.md
---
name: expo-landmines
description: Use when writing, upgrading, building or releasing an Expo or React Native app, to avoid known mistakes with Expo Router, EAS builds and updates, SDK upgrades, native modules, styling and store review.
---
# Expo landmines
Each rule is a known way to lose time on an Expo or React Native app: what not to do, then what to do instead. The tag at the end of a rule is a page on https://davidewins.com with the exact error text, the cause and the fix.
## Expo Router
- Don't compare a route param to a number. Params from the URL are always strings, so `e.id === id` fails. Convert first: `Number(id)`. [errors/expo-router-params-always-strings]
- Don't give `index.tsx` to more than one tab group. Round-bracket groups are not in the URL, so a second `(group)/index.tsx` is also `/` and the app opens on the wrong tab. Name the other screens (`exercises.tsx`). [errors/expo-router-group-index-wrong-tab]
- Don't rely on `initialRouteName` for the screen under a deep link. Export `unstable_settings = { anchor: 'name' }` from the stack layout so a deep link or notification gets a back button. [errors/expo-router-deep-link-no-back-button]
- Don't put a detail screen in one tab's folder when several tabs open it, or opening it jumps to that tab. Use an array group such as `(today,history)/session/[id].tsx`. [errors/expo-router-shared-route-array-group]
- Don't `router.navigate` from a modal to a shared route without saying which tab. Prefix the group and pass `{ withAnchor: true }`. [errors/expo-router-navigate-shared-route-from-modal]
- Don't use `router.setParams` for a screen that may not be focused: it writes onto whichever screen is focused. Use `navigation.setParams` from `useNavigation()`. [errors/expo-router-setparams-wrong-screen]
- Don't use top tabs without `react-native-tab-view` and `react-native-pager-view`. Install both with `npx expo install` and make a new dev build, because pager-view is native. [errors/expo-router-top-tabs-install-tab-view]
- Don't use `Link.Preview` or `Link.Menu` without `Link.Trigger` around the visible content. [errors/expo-router-link-preview-needs-trigger]
- Don't put `Link.AppleZoomTarget` around a View that only does layout, because React Native flattens it away. Add `collapsable={false}`. [errors/expo-router-appzoomtarget-single-native-child]
- Don't register a `formSheet` screen inside a tab's own stack: it opens with a header and a blank body. Register it in a stack above the tabs and open it by absolute path. [errors/formsheet-inside-tab-stack-opens-blank]
- Don't expect native tabs on iOS 26 to take a background colour: the bar is Liquid Glass. Use the JS `Tabs` when you need a coloured bar. [errors/expo-router-native-tabs-ignore-background]
- Don't import from `@react-navigation/*` in app code on SDK 56 and later, because expo-router forked it and Metro throws. Import from `expo-router/react-navigation`.
- Don't typecheck typed routes in CI without generating them. `.expo/types` is gitignored and there is no typegen command, so start `npx expo start --offline` in the background until `.expo/types/router.d.ts` exists, then run `tsc`. [errors/expo-typed-routes-ci-false-errors]
## EAS build and update
- Don't trust a lockfile written by npm 11 for EAS, which runs npm 10. Check with `npx -y npm@10.9.8 ci --include=dev --dry-run` and fix with `npx -y npm@10.9.8 install --package-lock-only`. Repeat after every `npx expo install`. [errors/eas-npm-ci-missing-from-lock-file]
- Don't patch a "deduped package below its peer range" install failure by hand. Delete `node_modules` and `package-lock.json`, reinstall with the builder's npm, verify with `npm ci` and commit the lockfile on its own. [errors/eas-npm-ci-nested-peer-url-polyfill]
- Don't read `$?` after a pipe. `npm ci | tail` reports `tail`'s exit code, so a failed install looks like a pass. Redirect to a file and read the real code, or use `set -o pipefail`. [errors/pipe-exit-code-hides-npm-ci-failure]
- Don't judge a typecheck by counting `error TS` lines. `npx -y typescript@x tsc` prints no errors because it never runs. Use `npx -y -p typescript@x tsc --noEmit` and read the log. [errors/npx-typescript-could-not-determine-executable]
- Don't assume `eas update` uses the `env` block in eas.json. It does not, and local `.env` files can leak into the bundle. Keep every `EXPO_PUBLIC_` value in the EAS environment, export with `--clear` and grep the bundle for each value before publishing. [errors/eas-update-ignores-eas-json-env]
- Don't keep an `EXPO_PUBLIC_` value only in a local `.env`. Any build or update made without that file ships `undefined`. Put it in the EAS environment and rebuild. [errors/google-signin-web-client-id-undefined]
- Don't expect a changed `EXPO_PUBLIC_` value to show up without clearing Metro. Run `npx expo start --dev-client --clear`, and use `--clear` when exporting an update. [errors/expo-public-env-needs-metro-clear]
- Don't write a raw `$` in a `.env` value. Expo expands `$name` locally but EAS does not, so a secret works in production and 401s in dev. Escape it as `\$`. [errors/expo-env-dollar-sign-expanded]
- Don't leave precompiled modules on for iOS dev builds on SDK 56 and later if you see "No script URL provided". Set `EXPO_USE_PRECOMPILED_MODULES` to `0` in the development profile `env` in eas.json. [errors/expo-dev-client-no-script-url-precompiled]
- Don't publish an OTA update after adding a native module without bumping the app version. With the `appVersion` runtime policy that bump is what keeps the update away from older binaries. [errors/ota-bump-version-after-native-change]
- Don't start a native build for a JS-only change. If dependencies, native config or plugins did not change, reload on the dev build you already have. Do rebuild when they did, and test native changes on a fresh dev build, not Fast Refresh.
- Don't run `eas update` without `--environment` on SDK 56 and later: it is required.
- Don't expect EAS to renew an expired provisioning profile in a non-interactive shell. Run the build once from a real terminal so EAS can log in to Apple. [errors/eas-expired-provisioning-profile-noninteractive]
- Don't run `npx expo export` for every platform in a native-only app. Export only what you ship: `--platform ios --platform android`. [errors/expo-web-bundle-mapbox-gl-css]
- Don't run an `eas update` export on a machine with little memory. The kernel kills it with SIGKILL. Publish one platform at a time with a bigger `--max-old-space-size`, or use a bigger machine. [errors/eas-update-oom-sigkill-small-box]
- Don't parse eas.json with a plain JSON parser in scripts. It can contain `//` comments and the parse fails.
- Don't forget source maps for OTA updates. `eas update` does not upload Sentry source maps, so upload them after each publish.
- Don't put a secret in eas.json `env`: the file is committed. Use `eas env:create --visibility secret`. Never commit `.env` files.
- Don't debug a "No route to host" from eas-cli with `dig`. Tailscale MagicDNS can return only IPv6 to the system resolver. Check with `curl -v` and run `tailscale set --accept-dns=false`. [errors/tailscale-magicdns-ipv6-only-eas-cli]
## Upgrades
- Don't treat `npx expo install --fix` as the whole SDK upgrade. It leaves `babel-preset-expo`, `jest-expo` and `@types/jest` on the old major and the export dies with a SyntaxError. Bump them by hand every time, then run `npx expo export --platform ios`. [errors/expo-install-fix-leaves-babel-preset-stale]
- Don't expect `expo install --fix` to edit a dynamic app.config.ts. On SDK 57 declare `expo-asset`, `expo-font`, `expo-image`, `expo-sharing` and `expo-status-bar` in `plugins` yourself, then run `npx expo-doctor`. [errors/expo-sdk57-plugins-must-be-declared]
- Don't take TypeScript 6 as part of an SDK bump. It broke typechecking on SDK 56 and 57. Stay on ~5.9 and silence doctor with `"expo": { "install": { "exclude": ["typescript"] } }`. [errors/typescript-6-explodes-typecheck-expo]
- Don't leave `@supabase/supabase-js` on a caret range on SDK 56 and 57. Newer releases fail to bundle on Hermes v1 with "Invalid expression encountered". Pin an exact version, `2.89.0` or the last one without the dynamic import. [errors/supabase-js-hermes-invalid-expression]
- Don't force through an ERESOLVE failure from `expo install --fix`. Write the versions it prints into package.json by hand, delete `node_modules` and the lockfile, run `npm install`, then `npx expo install --check`.
- Don't batch dependency edits during an upgrade. Regenerate the lockfile after each pin change so it never drifts from package.json.
- Don't spend a cloud build to find a pod clash. When a fresh upgrade fails at `pod install` but a sibling app on the same SDK builds, pin the shared packages to that app's exact versions and run `npx pod-install` locally first. [errors/mapbox-pod-install-after-fresh-expo-install]
- Don't leave `ios.deploymentTarget` below 16.4 on SDK 56. `expo-build-properties` throws at `expo config`, which blocks EAS.
- Don't keep `newArchEnabled` or `edgeToEdgeEnabled` in app config on SDK 56 and later: they were removed. Move a top-level `splash` into the `expo-splash-screen` plugin.
- Don't keep old `compileSdkVersion` or `targetSdkVersion` 34 overrides in `expo-build-properties`. React Native 0.86 needs newer.
- Don't use `scheme ?? 'light'` on `ColorSchemeName`. It can be null or `'unspecified'`. Write `scheme === 'dark' ? 'dark' : 'light'`.
- Don't call the upgrade done when tsc is green. Run `npx tsc --noEmit`, `npx expo-doctor` and `npx expo export --platform ios`: the export is the one that catches bundler failures.
## Native modules
- Don't combine `@shopify/react-native-skia` with `useFrameworks: "static"`. The build fails with `'third_party/base64.h' file not found`. Remove `useFrameworks`, then rebuild once with `--clear-cache`. [errors/skia-base64-h-not-found-use-frameworks]
- Don't call `moveTo` or `cubicTo` on a Skia path on Skia 2.14. `SkPath` is immutable and it crashes at runtime. Use `Skia.PathBuilder.Make()` and `.build()`.
- Don't use react-native-firebase with static frameworks and its default Swift Package Manager setup. Each pod embeds its own Firebase. Add `["@react-native-firebase/app", { ios: { disableSPM: true } }]` to plugins. [errors/rnfirebase-spm-static-linkage]
- Don't call a plain helper function inside a Reanimated worklet. It compiles and crashes on device. Inline the math, use `interpolateColor`, or compute the value outside and pass in the number. Tag a helper `'worklet'` only if it is pure. [errors/worklet-calls-non-worklet-helper]
- Don't pass the Apple Pay `merchantIdentifier` to the Stripe plugin for dev variants with their own bundle ID. Pass it for the production variant only, or enable Apple Pay on the dev App ID. [errors/apple-pay-entitlement-dev-bundle-id]
- Don't list a config plugin as a bare string if it reads its options. `expo config` crashes with "of undefined". Give it an object, even `{}`.
- Don't fix a "do not define modules" pod error with global `use_modular_headers!` or `useFrameworks`. Add the named pods under `ios.extraPods` in `expo-build-properties` with `modular_headers: true`. Check Skia first: it breaks under frameworks.
- Don't pair two packages that each pin the same native pod to a different exact version. CocoaPods fails at install. Move one of them to the release that pins the matching version.
- Don't run `pod install` under a non-UTF-8 locale. It can die with a Ruby `Encoding::CompatibilityError`. Set `LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8`.
- Don't install react-native-mmkv v4 without `react-native-nitro-modules` as a direct dependency.
- Don't call `reverseGeocodeAsync` on every mount. iOS rate-limits it per app. Cache the last result and look up again only after about 60 seconds or 100 metres. [errors/expo-location-geocode-rate-limit]
- Don't geocode while an Android permission dialog is open. The geocoder is paused and the call is refused. Retry once when `AppState` returns to `active`. [errors/android-geocoder-refused-during-permission-dialog]
- Don't use React Native prop names on `@expo/ui` SwiftUI components. Toggle takes `isOn` and `onIsOnChange`, Picker takes `selection` and `onSelectionChange`. [errors/expo-ui-swiftui-prop-names]
- Don't render `@expo/ui` Picker options without a `tag` modifier on each one. [errors/expo-ui-picker-missing-tag]
- Don't put a SwiftUI Slider in a `Host matchContents`: it has no intrinsic width. Give it a `frame` modifier, a Host with a real size, or put it in a `Form`. [errors/expo-ui-slider-no-width]
- Don't nest a SwiftUI component inside a React Native View inside a Host. Give the nested one its own `<Host>`. [errors/expo-ui-rn-view-inside-host]
## Styling
- Don't give the child of `<Link asChild>` a style function such as `style={({ pressed }) => ...}`. The Slot spreads it into `{}` and the row loses its height. Use a plain style object, or call `router.push()` in `onPress`. [errors/link-aschild-function-style-dropped]
- Don't wrap Pressable again with `withUniwind()`. uniwind already wraps it, and a second wrap drops the function-style background. Re-export Pressable as is. [errors/uniwind-pressable-double-wrap-drops-style]
- Don't set `headerStyle.backgroundColor` on iOS with a large title. On iOS 26 the title stays invisible until you scroll. Set the navigation theme `colors.card` and `colors.background` instead, and use `headerTransparent: true` alone for a transparent header. [errors/ios26-large-title-invisible-header-background]
- Don't debug one odd header by re-applying the shared header options. Diff the final options per screen: a single `headerBlurEffect` override changes the material. [errors/header-blur-effect-one-screen-differs]
- Don't use `StyleSheet.absoluteFillObject` on React Native 0.85 and later: the type is gone. Use `StyleSheet.absoluteFill` for a style value or inline the object for a spread.
## React and runtime
- Don't add a hook below an early return. `Rendered more hooks than during the previous render` crashes the whole app and tsc misses it. Put every hook above the returns and run `react-hooks/rules-of-hooks` before shipping. If it is already live, roll back with `eas update:roll-back-to-embedded`. [errors/rules-of-hooks-usememo-after-early-return]
- Don't read a `const` in a `.map()` callback above its declaration. An empty list never runs the callback, so tests pass and one item throws. Declare first and test with at least one item. [errors/tdz-const-used-in-map-before-declaration]
- Don't let several effects each correct the same value. They overwrite each other until "Maximum update depth exceeded". Have one place decide and only set state when the value changes. [errors/maximum-update-depth-competing-effects]
- Don't point an API base URL at an address the phone cannot reach, and don't fetch without a timeout. Requests hang until iOS gives up. Use the Mac's LAN IP and wrap every fetch with an `AbortController` timeout. [errors/phone-cannot-reach-tailscale-api-url]
- Don't create components inside a component body. `eslint-config-expo` 57 errors on it (the React Compiler rule), so hoist inline sub-components.
## Stores
- Don't submit without scanning first. Run `npx github:davidewins/store-preflight` before every `eas build` or `eas update`. It checks many of the rules in this section.
- Don't ship Expo's stock permission text ("Allow $(PRODUCT_NAME) to access your camera") or an empty string. App Review rejects it under Guideline 5.1.1. Write a specific reason in `ios.infoPlist` or the plugin option, or set the permission to `false` if the app never asks.
- Don't leave `ios.config.usesNonExemptEncryption` unset. App Store Connect then asks the export compliance question on every build. Set `false` if you only use HTTPS and standard OS crypto.
- Don't ship `NSAllowsArbitraryLoads`. Review can ask you to justify it. Use `NSExceptionDomains` for the specific hosts that need HTTP.
- Don't ignore an ITMS-91053 email about required reason APIs. Declare them in `ios.privacyManifests.NSPrivacyAccessedAPITypes`.
- Don't use an App Store icon that is not 1024x1024 or has transparent pixels. Export a solid-background PNG.
- Don't offer Google, Facebook or other social login without Sign in with Apple. Guideline 4.8 requires an equivalent option. Add `expo-apple-authentication`.
- Don't ship an app with sign-up and no in-app account deletion (Guideline 5.1.1(v)). Add a delete-account action that deletes the account, not just signs out.
- Don't rely on a green config for Android permissions. Native libraries add permissions at build time that `expo config` never shows (foreground service types, full-screen intents). Block the ones you do not use with `android.blockedPermissions` and fill in the Play Console declaration for the rest.
- Don't submit two builds with the same build number. Set `"cli": { "appVersionSource": "remote" }` and `autoIncrement: true` on the production profile.
- Don't assume app links or universal links work without checking both files. `assetlinks.json` and `apple-app-site-association` must list the package and bundle ID, or links open in the browser. The Android SHA-256 must match the signing key, which is the Play App Signing key once you are on Play. Re-check after any keystore change.
- Don't debug Android Google Sign-In "DEVELOPER_ERROR (status 10)" in code. Play App Signing re-signs the upload, so add the App signing key certificate SHA-1 from Play Console to the Android OAuth client. No rebuild needed. [errors/google-signin-play-app-signing-sha1]
- Don't guess which SHA-1 is installed. Read it off the build: `adb shell pm path <package>`, `adb pull` the APK, then `apksigner verify --print-certs`. Use `adb logcat` while tapping sign-in to see the real status code.
- Don't swallow non-cancel Google sign-in errors. Log them, or a fingerprint mismatch fails silently.