Org Skills

React Native

Always-on rules for writing React Native and Expo screens, components and hooks in TypeScript.

Raw Source
What it isAlways-on coding rules. GitHub Copilot applies them to files matching **/*.tsx,app/**/*.ts,src/features/**/*.ts,apps/mobile/**/*.ts; the Claude Code version is a path-scoped rule generated from the same file. Why use instructions →

Install

This repository (recommended)

Adds .github/instructions/react-native.instructions.md — commit it so everyone's Copilot follows the same rules.

npx -y github:AGCO-Global/org-skills add instructions react-native

Just for me, every repository

Save it in your user profile instead.

npx -y github:AGCO-Global/org-skills add instructions react-native --user

Use it

Nothing to invoke — edit a matching file and Copilot picks the rules up. Adjust applyTo if your repository layout differs.

This repository (recommended)

Adds .claude/rules/react-native.md — commit it. Claude loads it when it reads a matching file.

npx -y github:AGCO-Global/org-skills add instructions react-native --tool claude

Just for me, every repository

Save it in your user profile instead.

npx -y github:AGCO-Global/org-skills add instructions react-native --tool claude --user

Use it

Nothing to invoke. Adjust the paths globs if your repository layout differs.

Commands run in your repository folder and need Node.js 20+. They use your normal git sign-in to GitHub, so they work while the repository is private. Run npx -y github:AGCO-Global/org-skills list to see everything available.

Settings

name: "React Native"
description: "Always-on rules for writing React Native and Expo screens, components and hooks in TypeScript."
applyTo: "**/*.tsx,app/**/*.ts,src/features/**/*.ts,apps/mobile/**/*.ts"

Instructions Copilot follows

React Native rules

Scope: these rules apply when package.json depends on react-native or expo; in any other repository the web React instructions apply instead. The .ts patterns above cover mobile route, feature and app folders only — never **/*.ts, which would put mobile rules on server and shared code. In a monorepo, narrow applyTo to the mobile app (for example "apps/mobile/**/*.tsx,apps/mobile/**/*.ts").

Follow the existing project conventions first; these rules apply to new and changed code. They are the always-on minimum — for a whole screen or feature use the react-native-development skill, and react-native-architecture for structure, storage and release decisions.

Platform and structure

  • Default to Expo (managed workflow, dev client, config plugins) and prefer Expo SDK modules over community libraries: they ship config plugins and are upgraded with the SDK.
  • Never edit ios/ or android/ in a managed app; change native configuration through app.json and config plugins, or the next prebuild discards it.
  • No DOM or web APIs: no div, window, document, localStorage, no CSS files. They do not exist on device.
  • Wrap every string in <Text>; a bare string inside a View crashes at runtime.
  • Keep app/ route files thin — they render a screen from features/<feature>/. Business logic in a route or _layout.tsx cannot be tested without the router.
  • Keep components and hooks pure: the React Compiler is on by default from SDK 54 and silently skips impure ones.

Styling and layout

  • Use StyleSheet.create with values from theme tokens; no magic numbers or hard-coded colours, and light and dark both supported through the theme hook.
  • Apply safe areas as padding from useSafeAreaInsets(); SafeAreaView nested inside a navigator double-pads.
  • Assume edge-to-edge (mandatory on Android 16 / SDK 54+): never assume an opaque status or navigation bar.
  • Use useWindowDimensions(), never Dimensions.get at module scope — the module value does not update on rotation or fold.
  • Handle the keyboard with a keyboard controller or KeyboardAvoidingView, plus keyboardShouldPersistTaps="handled" so buttons stay tappable while the keyboard is up.

Lists and rendering

  • Render data lists with FlashList, never ScrollView plus .map(): only a window of rows around the viewport is rendered.
  • Do not pass estimatedItemSize — FlashList v2 measures automatically and ignores it.
  • Give every list a stable keyExtractor, an empty state, and pull-to-refresh and pagination where the data needs them; never nest same-direction scroll views.
  • Keep rows cheap: primitives as props, no inline closures capturing the row, no date or currency formatting inside renderItem.
  • Animate with Reanimated and handle gestures with Gesture Handler; never setState per frame, never PanResponder. Cross back into React with scheduleOnRN (runOnJS was renamed in Reanimated 4).
  • Use typed route params and validate them before use; make every screen deep-linkable with a designed not-found state.
  • router.push to drill down, router.replace after login or completion so back does not return to a dead screen.
  • Gate authenticated routes with <Stack.Protected guard={…}> (SDK 53+), not by conditionally rendering different stacks. Guards are client-side only — the API still authorises.

Data, storage and security

  • Fetch through the shared API client and query hooks, with timeouts and cancellation on unmount.
  • Render loading, empty, error-with-retry and offline states; persist the query cache and queue offline mutations, or say "will sync when online" — never fail silently.
  • Keep tokens and secrets in expo-secure-store. MMKV can be encrypted, but its key would itself need secure storage, so secrets go to SecureStore directly.
  • EXPO_PUBLIC_ variables and anything else in the bundle are public; no API secrets in the app.
  • Request permissions at the moment of use with an explanation, and handle a denial with a path to system settings.

Accessibility and tests

  • Use Pressable with accessibilityRole, accessibilityLabel and accessibilityState; no TouchableOpacity in new code.
  • Touch targets at least 44×44 pt (iOS) / 48×48 dp (Android) using hitSlop, and dynamic type supported up to 200 %.
  • No hard-coded user-facing strings; go through the i18n layer.
  • Keep TypeScript strict; no any, no ! to silence an error.
  • Test behaviour with React Native Testing Library and fake the network, not your hooks; avoid snapshot tests. For writing tests use the react-native-testing skill, and frontend-code-review before opening a pull request.