react-native-expo-best-practices
1
总安装量
1
周安装量
#45682
全站排名
安装命令
npx skills add https://github.com/pproenca/dot-skills --skill react-native-expo-best-practices
Agent 安装分布
claude-code
1
Skill 文档
React Native Expo Best Practices
Comprehensive performance optimization guide for React Native applications built with Expo, designed for AI agents and LLMs. Contains 45 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.
When to Apply
Reference these guidelines when:
- Writing new React Native/Expo components
- Optimizing FlatList or list rendering performance
- Implementing navigation and screen transitions
- Adding animations with Reanimated
- Setting up data fetching and caching
- Reviewing code for performance issues
- Debugging frame drops or memory issues
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | App Startup Optimization | CRITICAL | launch- |
| 2 | Bundle Size & Dependencies | CRITICAL | bundle- |
| 3 | List Virtualization | CRITICAL | list- |
| 4 | Navigation & Routing | HIGH | nav- |
| 5 | Data Fetching Patterns | HIGH | data- |
| 6 | Re-render Prevention | MEDIUM | render- |
| 7 | Animation Performance | MEDIUM | anim- |
| 8 | Memory & Resource Management | LOW-MEDIUM | mem- |
Quick Reference
1. App Startup Optimization (CRITICAL)
launch-hermes-bytecode– Enable Hermes with Bytecode Compilationlaunch-dev-mode-testing– Disable Development Mode for Performance Testinglaunch-splash-screen– Configure Splash Screen to Hide After Content Readylaunch-minimize-root-imports– Minimize Root-Level Importslaunch-font-loading– Load Fonts Before Rendering Textlaunch-avoid-sync-storage– Avoid Synchronous Storage Reads at Startup
2. Bundle Size & Dependencies (CRITICAL)
bundle-direct-imports– Use Direct Module Imports Instead of Barrel Filesbundle-analyze-dependencies– Analyze Bundle Size Before Adding Dependenciesbundle-dynamic-imports– Use Dynamic Imports for Large Featuresbundle-avoid-polyfills– Avoid Unnecessary Polyfillsbundle-image-assets– Optimize Image Assets for Bundle Size
3. List Virtualization (CRITICAL)
list-use-flashlist– Use FlashList Instead of FlatList for Large Listslist-getitemlayout– Implement getItemLayout for Fixed-Height Itemslist-stable-keys– Use Stable Keys Instead of Array Indexlist-memoize-renderitem– Memoize renderItem and List Item Componentslist-window-size– Tune windowSize for Memory vs Performancelist-avoid-inline-styles– Avoid Inline Styles in List Itemslist-remove-clipped-subviews– Enable removeClippedSubviews for Long Lists
4. Navigation & Routing (HIGH)
nav-async-routes– Enable Async Routes for Lazy Screen Loadingnav-avoid-usenavigation-rerenders– Avoid useNavigation Re-render Issuesnav-alphabetical-loading– Control Route Loading Order with Namingnav-preload-screens– Preload Screens Before Navigationnav-deep-link-performance– Optimize Deep Link Resolution
5. Data Fetching Patterns (HIGH)
data-parallel-fetching– Fetch Independent Data in Paralleldata-request-deduplication– Deduplicate Concurrent Requestsdata-abort-requests– Abort Requests on Component Unmountdata-optimistic-updates– Use Optimistic Updates for Instant Feedbackdata-pagination– Implement Efficient Pagination for Large Datasetsdata-cache-strategies– Configure Appropriate Cache Strategies
6. Re-render Prevention (MEDIUM)
render-memo-components– Wrap Expensive Components with memo()render-usememo-expensive– Memoize Expensive Computations with useMemorender-usecallback-handlers– Stabilize Event Handlers with useCallbackrender-context-splitting– Split Context to Prevent Unnecessary Re-rendersrender-avoid-anonymous-functions– Avoid Anonymous Functions in JSXrender-react-compiler– Enable React Compiler for Automatic Memoization
7. Animation Performance (MEDIUM)
anim-use-reanimated– Use Reanimated for 60 FPS Animationsanim-worklets– Use Worklets for UI Thread Computationanim-layout-animations– Use Layout Animations for Mount/Unmountanim-avoid-js-thread– Avoid JS Thread During Animationsanim-limit-concurrent– Limit Concurrent Animations
8. Memory & Resource Management (LOW-MEDIUM)
mem-useeffect-cleanup– Clean Up Resources in useEffectmem-expo-image– Use expo-image for Efficient Image Cachingmem-avoid-closures-leaks– Avoid Closure Memory Leaksmem-monitor-memory– Monitor Memory Usage in Developmentmem-lazy-components– Lazy Load Heavy Components
How to Use
Read individual reference files for detailed explanations and code examples:
- Section definitions – Category structure and impact levels
- Rule template – Template for adding new rules
Reference Files
| File | Description |
|---|---|
| references/_sections.md | Category definitions and ordering |
| assets/templates/_template.md | Template for new rules |
| metadata.json | Version and reference information |