react-native-best-practices

callstackincubator/agent-skills · updated May 30, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/callstackincubator/agent-skills --skill react-native-best-practices
0 commentsdiscussion
summary

Structured performance optimization reference for React Native apps covering FPS, bundle size, TTI, and memory.

  • Organized into 9 JavaScript/React guides (profiling, lists, animations, memory), 9 native optimization guides (Turbo Modules, threading, profiling), and 9 bundling guides (tree shaking, code splitting, size analysis)
  • Each reference follows a hybrid format with quick patterns/commands, impact ratings (CRITICAL/HIGH/MEDIUM), and deep-dive explanations with prerequisites and comm
skill.md

React Native Best Practices

Overview

Performance optimization guide for React Native applications, covering JavaScript/React, Native (iOS/Android), and bundling optimizations. Based on Callstack's "Ultimate Guide to React Native Optimization".

Skill Format

Each reference file follows a hybrid format for fast lookup and deep understanding:

  • Quick Pattern: Incorrect/Correct code snippets for immediate pattern matching
  • Quick Command: Shell commands for process/measurement skills
  • Quick Config: Configuration snippets for setup-focused skills
  • Quick Reference: Summary tables for conceptual skills
  • Deep Dive: Full context with When to Use, Prerequisites, Step-by-Step, Common Pitfalls

Impact ratings: CRITICAL (fix immediately), HIGH (significant improvement), MEDIUM (worthwhile optimization)

When to Apply

Reference these guidelines when:

  • Debugging slow/janky UI or animations
  • Investigating memory leaks (JS or native)
  • Optimizing app startup time (TTI)
  • Reducing bundle or app size
  • Writing native modules (Turbo Modules)
  • Profiling React Native performance
  • Reviewing React Native code for performance

Security Notes

  • Treat shell commands in these references as local developer operations. Review them before running, prefer version-pinned tooling, and avoid piping remote scripts directly to a shell.
  • Treat third-party libraries and plugins as dependencies that still require normal supply-chain controls: pin versions, verify provenance, and update through your standard review process.
  • Treat Re.Pack code splitting as first-party artifact delivery only. Remote chunks must come from trusted HTTPS origins you control and be pinned to the current app release.

Priority-Ordered Guidelines

Priority Category Impact Prefix
1 FPS & Re-renders CRITICAL js-*
2 Bundle Size CRITICAL bundle-*
3 TTI Optimization HIGH native-*, bundle-*
4 Native Performance HIGH native-*
5 Memory Management MEDIUM-HIGH js-*, native-*
6 Animations MEDIUM js-*

Quick Reference

Optimization Workflow

Follow this cycle for any performance issue: Measure → Optimize → Re-measure → Validate

  1. Measure: Capture baseline metrics (FPS, TTI, bundle size) before changes
  2. Optimize: Apply the targeted fix from the relevant reference
  3. Re-measure: Run the same measurement to get updated metrics
  4. Validate: Confirm improvement (e.g., FPS 45→60, TTI 3.2s→1.8s, bundle 2.1MB→1.6MB)

If metrics did not improve, revert and try the next suggested fix.

Critical: FPS & Re-renders

Profile first:

# Open React Native DevTools
# Press 'j' in Metro, or shake device → "Open DevTools"

Common fixes:

  • Replace ScrollView with FlatList/FlashList for lists
  • Use React Compiler for automatic memoization
  • Use atomic state (Jotai/Zustand) to reduce re-renders
  • Use useDeferredValue for expensive computations

Critical: Bundle Size

Analyze bundle:

npx react-native bundle \
  --entry-file index.js \
  --bundle-output output.js \
  --platform ios \
  --sourcemap-output output.js.map \
  --dev false --minify true

npx source-map-explorer output.js --no-border-checks

Verify improvement after optimization:

# Record baseline size before changes
ls -lh output.js  # e.g., Before: 2.1 MB

# After applying fixes, re-bundle and compare
npx react-native bundle --entry-file index.js --bundle-output output.js \
  --platform ios --dev false --minify true
ls -lh output.js  # e.g., After: 1.6 MB  (24% reduction)

Common fixes:

  • Avoid barrel imports (import directly from source)
  • Remove unnecessary Intl polyfills only after checking Hermes API and method coverage
  • Enable tree shaking (Expo SDK 52+ or Re.Pack)
  • Enable R8 for Android native code shrinking

High: TTI Optimization

Measure TTI:

  • Use react-native-performance for markers
  • Only measure cold starts (exclude warm/hot/prewarm)

Common fixes:

  • Disable JS bundle compression on Android (enables Hermes mmap)
  • Use native navigation (react-native-screens)
  • Preload commonly-used expensive screens before navigating to them

High: Native Performance

Profile native:

  • iOS: Xcode Instruments → Time Profiler
  • Android: Android Studio → CPU Profiler

Common fixes:

  • Use background threads for heavy native work
  • Prefer async over sync Turbo Module methods
  • Use C++ for cross-platform performance-critical code

References

Full documentation with code examples in references/:

JavaScript/React (js-*)

File Impact Description
js-lists-flatlist-flashlist.md CRITICAL Replace ScrollView with virtualized lists
js-profile-react.md MEDIUM React DevTools profiling
js-measure-fps.md HIGH FPS monitoring and measurement
js-memory-leaks.md MEDIUM JS memory leak hunting
js-atomic-state.md HIGH Jotai/Zustand patterns
js-concurrent-react.md HIGH useDeferredValue, useTransition
js-react-compiler.md HIGH Automatic memoization
js-animations-reanimated.md MEDIUM Reanimated worklets
js-bottomsheet.md HIGH Bottom sheet optimization
js-uncontrolled-components.md HIGH TextInput optimization

Native (native-*)

File Impact Description
native-turbo-modules.md HIGH Building fast native modules
native-sdks-over-polyfills.md HIGH Native vs JS libraries
native-measure-tti.md HIGH TTI measurement setup
native-threading-model.md HIGH Turbo Module threads
native-profiling.md MEDIUM Xcode/Android Studio profiling
native-platform-setup.md MEDIUM iOS/Android tooling guide
native-view-flattening.md MEDIUM View hierarchy debugging
native-memory-patterns.md MEDIUM C++/Swift/Kotlin memory
native-memory-leaks.md MEDIUM Native memory leak hunting
native-android-16kb-alignment.md CRITICAL Third-party library alignment for Google Play

Bundling (bundle-*)

File Impact Description
bundle-barrel-exports.md CRITICAL Avoid barrel imports
bundle-analyze-js.md CRITICAL JS bundle visualization
bundle-tree-shaking.md HIGH Dead code elimination
bundle-analyze-app.md HIGH App size analysis
bundle-r8-android.md HIGH Android code shrinking
bundle-hermes-mmap.md HIGH Disable bundle compression
bundle-native-assets.md HIGH Asset catalog setup
bundle-library-size.md MEDIUM Evaluate dependencies
bundle-code-splitting.md MEDIUM Re.Pack code splitting

Searching References

# Find patterns by keyword
grep -l "reanimated" references/
grep -l "flatlist" references/
grep -l "memory" references/
grep -l "profil" references/
grep -l "tti" references/
grep -l "bundle" references/

Problem → Skill Mapping

Problem Start With
App feels slow/janky js-measure-fps.mdjs-profile-react.md
Too many re-renders js-profile-react.mdjs-react-compiler.md
Slow startup (TTI) native-measure-tti.mdbundle-analyze-js.md
Large app size bundle-analyze-app.mdbundle-r8-android.md
Memory growing js-memory-leaks.md or native-memory-leaks.md
Animation drops frames js-animations-reanimated.md
Bottom sheet jank/re-renders js-bottomsheet.mdjs-animations-reanimated.md
List scroll jank js-lists-flatlist-flashlist.md
TextInput lag js-uncontrolled-components.md
Native module slow native-turbo-modules.mdnative-threading-model.md
Native library alignment issue native-android-16kb-alignment.md

Attribution

Based on "The Ultimate Guide to React Native Optimization" by Callstack.

how to use react-native-best-practices

How to use react-native-best-practices on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your development machine
  • Node.js version 16.0+ with npm package manager (verify with node --version)
  • Active project directory or workspace where you want to add react-native-best-practices
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/callstackincubator/agent-skills --skill react-native-best-practices

The skills CLI fetches react-native-best-practices from GitHub repository callstackincubator/agent-skills and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/react-native-best-practices

Reload or restart Cursor to activate react-native-best-practices. Access the skill through slash commands (e.g., /react-native-best-practices) or your agent's skill management interface.

Security & Verification Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

Task Automation & Efficiency

Automate repetitive workflows and reduce manual effort

Example

Generate reports, summarize documents, draft communications

Save 3-5 hours per week on routine tasks

Knowledge Enhancement

Learn new skills, understand complex topics, get expert guidance

Example

Explain concepts, provide examples, suggest learning resources

Accelerate learning and skill development by 2x

Quality Improvement

Enhance output quality through reviews, suggestions, and refinements

Example

Review drafts, suggest improvements, catch errors

Improve work quality by 30-40% with less effort

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client with skill support
  • Clear understanding of task or problem to solve
  • Willingness to iterate and refine outputs

Time Estimate

15-45 minutes depending on use case complexity

Installation Steps

  1. 1.Install skill using provided installation command
  2. 2.Test with simple use case relevant to your work
  3. 3.Evaluate output quality and relevance
  4. 4.Iterate on prompts to improve results
  5. 5.Integrate into regular workflow if valuable

Common Pitfalls

  • Expecting perfect results without iteration
  • Not providing enough context in prompts
  • Using skill for tasks outside its intended scope
  • Accepting outputs without review and validation

Best Practices

✓ Do

  • +Start with clear, specific prompts
  • +Provide relevant context and constraints
  • +Review and refine all outputs before using
  • +Iterate to improve output quality
  • +Document successful prompt patterns

✗ Don't

  • Don't use without understanding skill limitations
  • Don't skip validation of outputs
  • Don't share sensitive information in prompts
  • Don't expect skill to replace human judgment

💡 Pro Tips

  • Be specific about desired format and style
  • Ask for multiple options to choose from
  • Request explanations to understand reasoning
  • Combine AI efficiency with human expertise

When to Use This

✓ Use When

Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.

✗ Avoid When

Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.

Learning Path

  1. 1Familiarize yourself with skill capabilities and limitations
  2. 2Start with low-risk, non-critical tasks
  3. 3Progress to more complex and valuable use cases
  4. 4Build expertise through regular use and experimentation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.660 reviews
  • Kwame Zhang· Dec 28, 2024

    react-native-best-practices is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Aisha Martinez· Dec 28, 2024

    Useful defaults in react-native-best-practices — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Mateo Kim· Dec 24, 2024

    We added react-native-best-practices from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Chaitanya Patil· Dec 12, 2024

    react-native-best-practices fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Diya Gonzalez· Dec 8, 2024

    react-native-best-practices has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Diego Chawla· Dec 4, 2024

    react-native-best-practices fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Maya Wang· Nov 27, 2024

    Keeps context tight: react-native-best-practices is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Evelyn Gill· Nov 23, 2024

    Registry listing for react-native-best-practices matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Dev Abebe· Nov 19, 2024

    Solid pick for teams standardizing on skills: react-native-best-practices is focused, and the summary matches what you get after install.

  • Valentina Choi· Nov 15, 2024

    react-native-best-practices reduced setup friction for our internal harness; good balance of opinion and flexibility.

showing 1-10 of 60

1 / 6