react-native

A set of coding rules for React Native, a framework for building mobile apps with JavaScript or TypeScript. It covers project setup, folder structure, components, navigation, testing, and performance.

In plain words
What is it for?
Use it when creating or reviewing React Native screens, components, hooks, services, styles, configuration, and tests.
Why use it?
It gives the agent consistent guidance for organizing and maintaining React Native code instead of leaving these choices to chance.

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/jimmypocock/cursor-rules/react-native
Clone the repo
git clone --depth 1 https://github.com/jimmypocock/cursor-rules

Made for: Cursor.

Per session 4 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,159 The whole file, excluding the scripts and references it only reads on demand.
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.00004 $0.01159
Opus 5 $0.00002 $0.00580
Sonnet 5 $0.00001 $0.00232
Haiku 4.5 $0.00000 $0.00116

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

Security

Grade A, and why

react-native 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 yesterday.

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.

.cursor/rules/react-native.mdc · 193 lines

How it starts

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


Description: React Native Development Standards Globs: **/.tsx, **/.ts, /screens//, /components//, **/App.tsx

React Native Development Standards

@base.mdc @typescript.mdc

Project Setup

  • Use TypeScript for type safety
  • Implement ESLint and Prettier for code quality
  • Set up proper directory structure for scalability
  • Use Expo for simpler projects and React Native CLI for complex requirements
  • Configure proper module resolution
  • Implement proper environment configuration
  • Set up proper testing infrastructure
  • Use React Native New Architecture where applicable

Directory Structure

  • Organize by feature or domain
  • Separate UI components from business logic
  • Create reusable hooks for shared logic
  • Implement services for API interactions
  • Use proper navigation structure
  • Create dedicated styles directory
  • Organize assets efficiently
  • Implement proper type definitions

Component Architecture

  • Use functional components with hooks
  • Create small, reusable UI components
  • Implement proper component composition
  • Use proper prop validation with TypeScript
  • Create presentational vs container components
  • Implement pure components for performance
  • Use memo for expensive renders
  • Create proper component documentation
  • Use React Navigation as the primary navigation library
  • Implement type-safe navigation
  • Create logical navigation hierarchy
  • Handle deep linking properly
  • Implement proper screen transitions
  • Create reusable navigation patterns
  • Handle authentication flows in navigation
  • Implement proper error boundaries

Styling

  • Use StyleSheet.create for styles
  • Implement consistent theming
  • Create responsive layouts with flexbox
  • Use dimension-aware styling
  • Implement proper dark mode support
  • Create accessibility-friendly styles
  • Use style composition for complex UIs
  • Implement proper RTL support

State Management

  • Use React Context for shared state
  • Implement Redux or Zustand for complex state
  • Use local state for component-specific state
  • Leverage React Query for server state
  • Implement proper persistence for offline support
  • Create middleware for side effects
  • Use proper state normalization
  • Implement performance-optimized selectors

Read the full file on GitHub · 193 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. yesterday First seen · 193 lines · 4 tokens per session scan A 38cdcdaf86ec

Subscribe to this mod's changes

react-native is a cursor rule published in the GitHub repository jimmypocock/cursor-rules (8 stars, last pushed 1y ago), licensed MIT. It adds 4 tokens to every session and 1,159 once invoked, about $0.0000 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.