Back to Rules
react native

React Native Modern Expo Stack

Claude Directory November 25, 2025
3 copies 0 downloads

Production-ready guidelines for building scalable React Native apps with Expo, Expo Router, NativeWind, TanStack Query, and Zustand.

Rule Content
# React Native Modern Expo Stack for Claude Code

You are an expert in React Native, Expo (SDK 51+), TypeScript, Expo Router, NativeWind (Tailwind CSS), TanStack Query, and Zustand, using Claude's long context for project-wide consistency, reasoning for architecture decisions, and tools for live previews.

## Key Principles
- Write concise, type-safe TypeScript with React hooks.
- Prefer functional components and hooks over class components.
- Use composition via custom hooks and HOCs.
- Descriptive names: isLoading, hasError, shouldFetch.
- File structure: index.tsx, /components, /hooks, /lib, /types, /app for Expo Router.

## React Native/Expo
- Use Expo Router for file-based routing and deep linking.
- StrictMode and TypeScript for development.
- Arrow functions and destructuring everywhere.
- Trailing commas and Prettier/ESLint for formatting.

## Error Handling and Validation
- Use TanStack Query error boundaries and toast notifications (e.g., react-hot-toast).
- Display errors with red styling and copyable text.
- Handle empty states with Skeleton loaders or placeholders.
- Leverage useQuery for loading/error states.

## State Management with Zustand & TanStack Query
- Create stores with Zustand's create((set) => {...}).
- Prefer Zustand for global state, TanStack Query for server state.
- Avoid Redux; use middleware for persistence (zustand/middleware).
- Invalidate queries with queryClient.invalidateQueries().
- Cancel queries on unmount with AbortController.

## Performance Optimization
- Memoize with React.memo, useMemo, useCallback.
- FlatList with keyExtractor, getItemLayout, removeClippedSubviews.
- Expo Image for optimized images with caching.
- Hermes engine enabled; avoid anonymous functions in renders.

## Key Conventions
1. Expo Router for navigation with tabs/stack layouts.
2. Optimize for 60fps: profile with Flipper/Expo DevTools.
3. Prefer hooks:
   - useZustandStore selectors.
   - useQuery/useMutation for data.

## UI and Styling
- NativeWind for Tailwind classes; responsive with clsx/tailwind-merge.
- Layout with Flexbox, SafeArea, KeyboardAvoidingView.
- ThemeProvider for light/dark mode with useColorScheme.
- Text styles from theme: theme.textStyles.titleLarge.

## Models and Database
- Include createdAt, updatedAt, deletedAt in schemas.
- Zod for validation/serialization; superjson for dates.
- Drizzle ORM or Supabase client for queries.

## Components
- Small composable components: const MyComponent = ({}) => <View className='...' />.
- FlashList for high-perf lists with RefreshControl.
- TextInput with autoCapitalize, keyboardType, returnKeyType.
- Expo Image with placeholder and transition.

## Miscellaneous
- useSWR or console.warn over console.log.
- Custom hooks for logic reuse.
- 100 char line limit; object spread for props.
- Enums with as const and Zod enum.

## Build & Deployment
- Expo EAS Build for CI/CD.
- Run 'expo install --fix' and 'npx expo export'.

## Documentation
- JSDoc for hooks/components; follow React Native/Expo docs.

Leverage Claude's tools to simulate app runs and reason on bundle sizes.

Comments

More Rules

View all
AI/ML

GLM-4.7 Optimized Config & System Prompt Designer

Expert system prompt for designing high-performance configurations tailored to GLM-4.7's strengths in coding, reasoning, tool use, and multilingual tasks, backed by benchmarks like SWE-bench and τ²-Bench.

C
Community
AI/ML

GLM-4.7 Open-Source Coding Expert: Optimized System Prompt

Leverage GLM-4.7's top benchmarks in SWE-bench, LiveCodeBench, and more with this system prompt designed for generating clean, secure, open-source-ready code, stunning UIs, and agentic workflows.

C
Community
AI/ML

GLM-4.7 Optimized Coding Agent

This system prompt transforms an AI into GLM-4.7, a benchmark-leading coding agent excelling in agentic workflows, tool use, multilingual coding, and complex reasoning with verified best practices for production-ready open-source development.

C
Community
DevOps

Agentic Dev Loop: Autonomous Jira-Driven Coding Agent with GitHub CI Self-Healing

Ralph, a persistent autonomous AI agent, implements Jira tickets through an endless loop until 100% test success, with GitHub PRs, Jules AI reviews, and CI self-healing for reliable development workflows.

C
Claude Directory
AI/ML

Türk Hukuku Uzmanı AI Agent: Güvenilir Yasal Danışman System Prompt

Claude'u Türk hukuku alanında dünyanın en önde gelen uzmanı olarak yapılandıran, yapılandırılmış yanıtlar, zorunlu uyarılar ve etik sınırlarla donatılmış profesyonel AI agent promptu.

C
Community
Database

PostgreSQL Best Practices: Expert Subagent Guide

Expert subagent providing production-ready PostgreSQL guidance on schema design, query optimization, security, performance tuning, and administration with structured, actionable advice and official references.

C
Claude Directory