Skip to content

project rulesMobilereact-nativeexpotypescript

React Native Expo Rules

Project rules for Expo and React Native apps: Expo Router, typed navigation, safe storage, list performance and builds through EAS.

npx workspacetemplates add react-native-expo-rules --tool claude-code

Writes 1 file to your project root

CLAUDE.mdadd to your file21 lines · 1.4 KBFile
# Project rules: React Native with Expo

## Structure
- Expo Router with the `app/` directory for screens. Shared UI in `components/`, hooks in `hooks/`, API code in `lib/`. TypeScript strict, no `any`; use typed routes.
- Prefer Expo SDK packages (`expo-image`, `expo-secure-store`, `expo-file-system`) over community modules. Install with `npx expo install` so versions match the SDK. Do not add a library that needs native code without asking.

## UI
- Use `StyleSheet.create` or the project's styling library, never inline style objects in hot paths. Wrap screens in `SafeAreaView`, handle the keyboard, and respect dark mode through `useColorScheme`.
- Every touch target is at least 44 by 44 points, with `accessibilityLabel` and `accessibilityRole`.
- Check both iOS and Android; use `Platform.select` only when behavior truly differs.

## Performance
- Long lists use `FlatList` or FlashList with stable `keyExtractor`, memoized row components and no anonymous functions in `renderItem`. Never map a long array inside a `ScrollView`.
- Use `expo-image` with sizes; avoid re-renders by keeping state local.

## Data and secrets
- Tokens go in `expo-secure-store`, never AsyncStorage. Anything in `EXPO_PUBLIC_` variables ships in the app, so never put secrets there.
- Fetch with TanStack Query; show loading, error and offline states.

## Done means
`npx tsc --noEmit`, `npx expo lint` and `npx expo-doctor` pass. Builds use EAS profiles from eas.json.

What it does

Mobile code has constraints that web habits miss: small screens, slow lists, flaky networks and secrets that must not ship in the bundle. These rules give the agent the defaults a mobile team would apply by hand.

They fix file-based routing, state and data handling, and the checks to run, so each screen the agent adds is consistent and works on both iOS and Android.

Example

you › Add a screen that shows saved articles and works offline

agent › The agent creates app/saved.tsx with a FlatList, caches the query with TanStack Query persistence, stores the token in SecureStore, adds an offline banner and checks tsc and expo-doctor.

Questions

Does it work for bare React Native?
Some parts do, but the rules assume Expo Router and the Expo SDK, so a bare project needs edits.
Why ban secrets in EXPO_PUBLIC variables?
Those values are bundled into the app, so anyone can extract them from the downloaded package.
  • Flutter Rules

    Project rulesflutter

    Free
  • Kotlin Android Rules

    Project ruleskotlin

    Free
  • SwiftUI iOS Rules

    Project rulesswift

    Free
  • Flutter State Management

    Skillflutter

    Free