cursorrules

Project rules for developing React Native and Expo mobile apps. React Native lets developers build mobile apps with JavaScript or TypeScript, while Expo provides supporting tools.

In plain words
What is it for?
Use them to guide TypeScript, functional components, hooks, mobile performance, platform-specific behavior, list rendering, and validation of React Native and Expo APIs.
Why use it?
They reduce version-related mistakes by requiring the project context and installed API versions to be checked before code is suggested.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/itamiforge/mcp-react-native-toolkit/cursorrules
Clone the repo
git clone --depth 1 https://github.com/ItamiForge/mcp-react-native-toolkit

Made for: Cursor.

Per session 959 This file is loaded in full into every session.
When invoked 959 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00959 $0.00959
Opus 5 $0.00479 $0.00479
Sonnet 5 $0.00192 $0.00192
Haiku 4.5 $0.00096 $0.00096

Measured today against content hash 1a422145b7ea, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cursorrules scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

templates/.cursorrules · 132 lines

How it starts

The opening of the file, as written. The whole thing — 132 lines — stays where its author put it; the contents beside it link to each section on GitHub.

React Native/Expo Mobile Development Project

This project uses React Native and/or Expo for cross-platform mobile development. Follow these guidelines to provide accurate and helpful assistance.

=== CORE RULES ===

  1. Always detect project context before suggesting code (check package.json for versions)
  2. Verify APIs exist for the detected React Native/Expo version before suggesting
  3. Use TypeScript with proper type annotations unless the project uses JavaScript
  4. Follow React Native performance best practices (memo, useCallback, FlatList optimization)
  5. Prefer functional components with hooks over class components
  6. Handle platform differences when necessary using Platform.OS or platform-specific files

=== API VALIDATION ===

  1. Check React Native version before using new APIs (e.g., useWindowDimensions requires RN 0.61+)
  2. Check Expo SDK version for Expo-specific APIs
  3. Verify third-party library versions (React Navigation, Reanimated, Gesture Handler, etc.)
  4. Use optional chaining and nullish coalescing for safer code
  5. Import from correct packages (react-native vs expo-* vs @react-navigation/*)

=== BEST PRACTICES ===

  1. Use FlatList/SectionList for long lists, never ScrollView with many items
  2. Implement proper loading states and error handling
  3. Use React.memo() for pure components that render often
  4. Avoid inline functions in render for frequently re-rendering components
  5. Use StyleSheet.create() instead of inline styles for performance
  6. Handle keyboard avoiding behavior for forms
  7. Test on both iOS and Android platforms
  8. Use proper accessibility labels and hints

=== NAVIGATION ===

  1. Use React Navigation for routing (@react-navigation/native)
  2. Properly type navigation props with TypeScript
  3. Use navigation.navigate() with proper screen names
  4. Handle deep linking when required
  5. Configure proper header options for screens

=== STATE MANAGEMENT ===

  1. Use React Context for simple state sharing
  2. Consider Zustand, Jotai, or Redux Toolkit for complex state
  3. Use React Query or SWR for server state
  4. Persist state with MMKV or AsyncStorage as appropriate
  5. Avoid prop drilling more than 2-3 levels deep

=== CODE EXAMPLES ===

--- Optimized FlatList ---

// Optimized FlatList with proper performance settings import React, { memo, useCallback } from 'react'; import { FlatList, Text, View, StyleSheet } from 'react-native';

interface Item { id: string; title: string; }

interface ItemProps { item: Item; }

const ListItem = memo(({ item }: ItemProps) => ( {item.title} ));

export function OptimizedList({ data }: { data: Item[] }) { const renderItem = useCallback( ({ item }: { item: Item }) => , [] );

const keyExtractor = useCallback((item: Item) => item.id, []);

return ( <FlatList data={data} renderItem={renderItem} keyExtractor={keyExtractor} removeClippedSubviews={true} maxToRenderPerBatch={10} windowSize={5} initialNumToRender={10} getItemLayout={(_, index) => ({ length: 50, offset: 50 * index, index, })} /> ); }

const styles = StyleSheet.create({ item: { height: 50, padding: 10 }, });

--- Navigation Setup ---

// Type-safe React Navigation setup import { NavigationContainer } from '@react-navigation/native'; import { createNativeStackNavigator } from '@react-navigation/native-stack'; import type { NativeStackScreenProps } from '@react-navigation/native-stack';

// Define the param list for type safety type RootStackParamList = { Home: undefined; Details: { itemId: string }; Profile: { userId: string }; };

// Export typed navigation props export type RootStackScreenProps = NativeStackScreenProps<RootStackParamList, T>;

const Stack = createNativeStackNavigator();

export function Navigation() { return ( <Stack.Navigator initialRouteName="Home">

Read the full file on GitHub · 132 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today First seen · 132 lines · 959 tokens per session scan A 1a422145b7ea

Subscribe to this mod's changes

cursorrules is a cursor rule published in the GitHub repository ItamiForge/mcp-react-native-toolkit (0 stars, last pushed 13d ago), licensed MIT. It adds 959 tokens to every session, about $0.0048 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.