agentleFS
jimmypocockjimmypocock/cursor-rules/.cursor/rules/react-native.mdc

cursor-rules / rules

Cursor rule8 starsChanged 19 months agoMITView on GitHub

React Native Development Standards

The file

Show its rules and text

We split this react-native.mdc into the rules it gives an agent

64 rules. About 0 are common, 64 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈64

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use TypeScript for type safety

    line 16
  2. Distinctive:

    Use Expo for simpler projects and React Native CLI for complex requirements

    line 19
  3. Distinctive:

    Use React Native New Architecture where applicable

    line 23
  4. Distinctive:

    Create reusable hooks for shared logic

    line 28
  5. Distinctive:

    Use proper navigation structure

    line 30
  6. Distinctive:

    Create dedicated styles directory

    line 31
  7. Distinctive:

    Use functional components with hooks

    line 36
  8. Distinctive:

    Create small, reusable UI components

    line 37
  9. Distinctive:

    Use proper prop validation with TypeScript

    line 39
  10. Distinctive:

    Create presentational vs container components

    line 40
  11. Distinctive:

    Use memo for expensive renders

    line 42
  12. Distinctive:

    Create proper component documentation

    line 43
  13. Distinctive:

    Use React Navigation as the primary navigation library

    line 46
  14. Distinctive:

    Create logical navigation hierarchy

    line 48
  15. Distinctive:

    Create reusable navigation patterns

    line 51
  16. Distinctive:

    Use StyleSheet.create for styles

    line 56
  17. Distinctive:

    Create responsive layouts with flexbox

    line 58
  18. Distinctive:

    Use style composition for complex UIs

    line 62
  19. Distinctive:

    Use React Context for shared state

    line 66
  20. Distinctive:

    Use local state for component-specific state

    line 68
  21. Distinctive:

    Create middleware for side effects

    line 71
  22. Distinctive:

    Use proper state normalization

    line 72
  23. Distinctive:

    Use FlatList for long lists

    line 76
  24. Distinctive:

    Use memo and useCallback for expensive operations

    line 78
  25. Distinctive:

    Use Hermes engine for improved performance

    line 81
  26. Distinctive:

    Use React Query or SWR for data fetching

    line 86
  27. Distinctive:

    Create retry mechanisms for failed requests

    line 89
  28. Distinctive:

    Use proper authentication in requests

    line 92
  29. Distinctive:

    Use Formik or React Hook Form for forms

    line 96
  30. Distinctive:

    Create reusable form components

    line 98
  31. Distinctive:

    Create accessible form controls

    line 101
  32. Distinctive:

    Use proper keyboard handling

    line 102
  33. Distinctive:

    Create proper TypeScript definitions for native modules

    line 106
  34. Distinctive:

    Create fallbacks for unsupported features

    line 109
  35. Distinctive:

    Document native module usage

    line 111
  36. Distinctive:

    Create proper testing for native modules

    line 112
  37. Distinctive:

    Use Animated API for simple animations

    line 116
  38. Distinctive:

    Use proper gesture handling

    line 120
  39. Distinctive:

    Create reusable animation hooks

    line 121
  40. Distinctive:

    Test animations across devices

    line 123
  41. Distinctive:

    Write unit tests for business logic

    line 126
  42. Distinctive:

    Create component tests with React Native Testing Library

    line 127
  43. Distinctive:

    Test across multiple device sizes

    line 129
  44. Distinctive:

    Create test fixtures for common scenarios

    line 131
  45. Distinctive:

    Create proper focus order

    line 137
  46. Distinctive:

    Use proper color contrast

    line 138
  47. Distinctive:

    Test with VoiceOver and TalkBack

    line 140
  48. Distinctive:

    Create proper touch targets

    line 141
  49. Distinctive:

    Create universal links for iOS

    line 147
  50. Distinctive:

    Create deep link testing infrastructure

    line 150
  51. Distinctive:

    Document deep link structure

    line 151
  52. Distinctive:

    Create fallbacks for unsupported deep links

    line 153
  53. Distinctive:

    Create offline-aware UI components

    line 160
  54. Distinctive:

    Test offline scenarios thoroughly

    line 162
  55. Distinctive:

    Create proper code signing

    line 168
  56. Distinctive:

    Use proper versioning strategies

    line 170
  57. Distinctive:

    Create proper release notes

    line 171
  58. Distinctive:

    Create secure storage for sensitive data

    line 177
  59. Distinctive:

    Use HTTPS for all network requests

    line 178
  60. Distinctive:

    Create proper obfuscation for sensitive code

    line 180
  61. Distinctive:

    Create security testing procedures

    line 182
  62. Distinctive:

    Use Expo Updates or CodePush for OTA updates

    line 186
  63. Distinctive:

    Create staged rollout strategies

    line 188
  64. Distinctive:

    Create proper monitoring for updates

    line 191

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
react-native.mdc
---
description: React Native Development Standards
globs: 
alwaysApply: false
---
---
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

## Navigation
- 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

## Performance Optimization
- Use FlatList for long lists
- Implement proper list item recycling
- Use memo and useCallback for expensive operations
- Optimize image loading and caching
- Implement lazy loading for non-critical components
- Use Hermes engine for improved performance
- Optimize JavaScript bundle size
- Implement proper native module optimization

## Data Fetching
- Use React Query or SWR for data fetching
- Implement proper caching strategies
- Handle offline data synchronization
- Create retry mechanisms for failed requests
- Implement proper loading states
- Handle errors gracefully
- Use proper authentication in requests
- Implement pagination for large datasets

## Form Handling
- Use Formik or React Hook Form for forms
- Implement proper validation with Yup or Zod
- Create reusable form components
- Handle form submission properly
- Implement proper error handling
- Create accessible form controls
- Use proper keyboard handling
- Implement form persistence when appropriate

## Native Module Integration
- Create proper TypeScript definitions for native modules
- Implement cross-platform compatibility
- Handle permissions properly
- Create fallbacks for unsupported features
- Implement proper error handling
- Document native module usage
- Create proper testing for native modules
- Optimize native module performance

## Animation
- Use Animated API for simple animations
- Leverage Reanimated for complex animations
- Create declarative animations
- Implement performant animations
- Use proper gesture handling
- Create reusable animation hooks
- Optimize animations for performance
- Test animations across devices

## Testing
- Write unit tests for business logic
- Create component tests with React Native Testing Library
- Implement end-to-end tests with Detox or Maestro
- Test across multiple device sizes
- Implement proper mocks for native modules
- Create test fixtures for common scenarios
- Test accessibility features
- Implement visual regression testing

## Accessibility
- Implement proper accessibility labels
- Create proper focus order
- Use proper color contrast
- Implement screen reader support
- Test with VoiceOver and TalkBack
- Create proper touch targets
- Implement proper keyboard navigation
- Document accessibility features

## Deep Linking
- Implement proper deep link handling
- Create universal links for iOS
- Implement app links for Android
- Handle deep link parameters properly
- Create deep link testing infrastructure
- Document deep link structure
- Implement proper deep link analytics
- Create fallbacks for unsupported deep links

## Offline Support
- Implement proper data persistence
- Create offline-first architecture
- Handle connectivity changes gracefully
- Implement proper conflict resolution
- Create offline-aware UI components
- Implement proper sync mechanisms
- Test offline scenarios thoroughly
- Document offline capabilities

## CI/CD
- Set up proper CI/CD pipelines
- Implement automated testing
- Create proper code signing
- Implement automated deployments
- Use proper versioning strategies
- Create proper release notes
- Implement beta testing distribution
- Set up proper monitoring

## Security
- Implement proper authentication flows
- Create secure storage for sensitive data
- Use HTTPS for all network requests
- Implement certificate pinning when needed
- Create proper obfuscation for sensitive code
- Implement proper permission handling
- Create security testing procedures
- Document security features

## Code Pushing
- Use Expo Updates or CodePush for OTA updates
- Implement proper versioning for updates
- Create staged rollout strategies
- Implement proper fallback mechanisms
- Test updates thoroughly
- Create proper monitoring for updates
- Document update procedures
- Implement proper user communication for updates

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.