Cursor rules for React Native
One codebase for iOS and Android, with release and signing guardrails.
.cursor/rules/react-native.mdc
--- description: Conventions and guardrails for the React Native app globs: src/**/*.ts,src/**/*.tsx,app/**/*.ts,app/**/*.tsx alwaysApply: false --- # React Native app ```bash npm install # install dependencies npx expo start # start the dev server (use npx react-native start for the bare CLI) npm run lint # lint npx tsc --noEmit # type-check ``` Run the tests after every code change. - TypeScript strict mode. Use StyleSheet or the project's styling approach, not inline style objects in hot lists. - Test on both platforms in mind: no web-only APIs, and check keyboard, safe area and back-button behavior for new screens. - Store tokens and sensitive values in secure storage, never in AsyncStorage or in source. Rules for every edit: - Never read, print, edit or commit .env files, credentials, API keys or private keys. - If the app has a local database (SQLite, WatermelonDB, Realm), schema changes need a versioned migration so existing installs upgrade cleanly. - Never deploy a release: no App Store or Google Play submission and no over-the-air update. I do releases myself. - Never run git push --force, git reset --hard, git clean, git checkout -- <file>, git stash or git rebase, and never use --no-verify. Ask first. - The ios/ and android/ native folders when the project is managed by Expo: do not edit by hand.
Why it says what it says
Two platforms
Agents write code that works on one platform and breaks on the other. Reminding them of both keeps changes portable.
Secure storage
Tokens saved in plain storage are a common mobile mistake. The rule points the agent at the right place.
Local migrations
Installed apps carry old data. Schema changes without a migration crash updates for existing users.
Releases are yours
A store submission or over-the-air update reaches real users immediately. That decision stays with you.
Native folders and signing
Hand edits to native projects and signing files are easy to get wrong and hard to debug.