CLAUDE.md for cross-platform mobile (React Native / Expo / Flutter)

0 views

Prompt
# CLAUDE.md — {{app_name}}

## Project overview
{{one_line_what_this_app_does}}. Stack: {{React Native + Expo | Flutter}}.
Targets: {{iOS + Android}}. State: {{Zustand/Redux | Riverpod/Bloc}}.

## Commands (use these — do not invent)
- Start dev: `{{npx expo start}}`   {{or `flutter run`}}
- Run tests: `{{npm test}}`   {{or `flutter test`}}
- Build (cloud): `{{eas build --platform all}}`   {{or `flutter build ipa/appbundle`}}
- Lint/format: `{{eslint . && prettier --check .}}`   {{or `dart format . && flutter analyze`}}
Run tests/lint before declaring a task done.

## Strict guardrails
- PLATFORM SPLITS: Keep cross-platform code default. Isolate platform-specific logic in
  clearly named files (`Component.ios.tsx` / `Component.android.tsx`) or behind
  `Platform.OS` / `Platform.isIOS` checks. No scattered inline platform branches.
- ASSETS: Optimize and size images for the target density; do not ship full-resolution
  source images. Respect native memory limits — no giant in-memory bitmaps.
- MAIN THREAD: No heavy, un-memoized computation on the JS/UI thread. Memoize expensive
  renders ({{useMemo/useCallback}} or `const`/`select`), move heavy work off the main thread.
- LISTS: Use virtualized lists ({{FlatList | ListView.builder}}) for long data; never map a
  huge array into the tree.
- BRIDGE: Minimize bridge/native calls in hot paths; batch where possible.

## Conventions
- Shared UI in `{{src/components}}`; platform files colocated next to the shared one.
- Keep navigation config in one place ({{React Navigation | go_router}}).

## When unsure
Ask before adding a native module, changing build/EAS config, or bumping the SDK version.
Dev / CLAUDE.mdreact-nativeexpofluttermobileclaude-md