Index of every page on this site: llms.txt
All skills
software-mansion-labs avatar

/react-native-best-practices

@43cde80
Run it yourself

Software Mansion's best practices for production React Native and Expo apps on the New Architecture. MUST USE before writing, reviewing, or debugging ANY code in a React Native or Expo project. If the working directory contains a package.json with react-native, expo, or expo-router as a dependency, this skill applies. Trigger on: any code task in a React Native/Expo project, 'React Native', 'Expo', 'New Architecture', 'Reanimated', 'Gesture Handler', 'react-native-svg', 'ExecuTorch', 'react-native-audio-api', 'react-native-enriched-html', 'Worklet', 'Fabric', 'TurboModule', 'WebGPU', 'react-native-wgpu', 'TypeGPU', 'GPU shader', 'WGSL', 'svg', 'animation', 'gesture', 'audio', 'rich text', 'AI model', 'multithreading', 'chart', 'vector', 'image filter', 'shared value', 'useSharedValue', 'runOnJS', 'scheduleOnRN', 'thread', 'worklet', 'Bundle Mode', or any question involving UI, graphics, native modules, or React Native threading and animation behavior. Also use when a more specific sub-skill matches.

Use this Skill: https://skilld.dev/gh/software-mansion-labs/skills/react-native-best-practices

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

README.md

≈2.6k tokens on demand. Your agent reads this file only when SKILL.md points to it.

React Native Best Practices Skill

Production patterns for React Native apps on the New Architecture, by Software Mansion.

Add this skill to give your AI coding agent accurate, current guidance for Software Mansion's React Native libraries: Reanimated, Gesture Handler, React Native SVG, ExecuTorch, Audio API, and more.

Sub-skills

Sub-skill Covers Status
Animations Reanimated 4, CSS transitions, CSS animations, CSS pseudo-selectors and callbacks, shared values, canvas animations (Skia), GPU shader animations (WebGPU, TypeGPU), layout animations, scroll-driven animations, SVG animations, 120fps, performance flags Complete
Gestures Gesture Handler: tap, pan, pinch, rotation, fling, hover, long press, Pressable, RectButton, Swipeable, Touchable, DrawerLayout, gesture composition, testing Complete
SVG React Native SVG: when to use vs expo-image/Skia/Lottie/Rive/fonts/WebView, installation, loading (URI/XML/file), touch events, filters, FilterImage, performance pitfalls, iOS memory leaks Complete
On-device AI Routes to the standalone react-native-executorch skill for setup, ready-made models and hooks, custom models and pipelines, and troubleshooting Complete
Rich Text Rich text editing with react-native-enriched, Markdown rendering with react-native-enriched-markdown Complete
Multithreading react-native-worklets: Worker Runtimes, scheduling APIs, shared memory, Serializable, Synchronizable Complete
Enable Worklets Bundle Mode Step-by-step Bundle Mode enablement for react-native-worklets (Expo, RN CLI, brownfield): babel plugin options, metro config helpers, mandatory metro + metro-runtime patches for every package manager (Yarn berry, npm/Yarn classic, bun, pnpm), verification, uniwind/NativeWind resolver workaround Complete
Audio React Native Audio API: playback (buffer sources, oscillators, streaming, queued playback), recording (file, data callback, graph processing), effects (gain, filters, delay, convolver, panner, waveshaper), analysis and visualization, worklets (custom processing, synthesis, UIRuntime/AudioRuntime), system integration (sessions, interruptions, notifications, permissions), testing Complete
JSI React Native JSI (JavaScript Interface): C++ API for interacting with the JS runtime — jsi::Value, HostObject, HostFunction, NativeState, ArrayBuffer, type casting, threading safety, calling JS from C++, CallInvoker/invokeAsync, performance (zero-copy, PropNameID caching, Scope), setup on Android/iOS, TurboModules vs Nitro Modules vs pure JSI, C++ memory patterns, crash debugging Complete
Complete = full reference documentation with code examples.

Structure

react-native-best-practices/
├── SKILL.md                              # Entry point: routing table for sub-skills
└── references/
    ├── animations/
    │   ├── SKILL.md                      # When to use, what references to read
    │   ├── animations.md                 # Decision tree, CSS transitions/animations, shared values
    │   ├── css-pseudo-selectors.md       # :hover/:active/:focus without React state
    │   ├── animation-functions.md        # Core hooks, withSpring, withTiming, withDecay, composition
    │   ├── layout-animations.md          # Entering/exiting, transitions, keyframes
    │   ├── scroll-and-events.md          # Scroll-driven animations, useAnimatedReaction, useFrameCallback
    │   ├── canvas-animations.md           # Skia canvas animations, path morphing, SKSL shaders, gesture integration
    │   ├── canvas-atlas.md                # Atlas batched sprite/tile animation, useTexture, useRSXformBuffer, RSXform
    │   ├── gpu-animations.md             # Shader animations, react-native-wgpu, TypeGPU, particles
    │   ├── svg-animations.md              # Animating SVG elements and paths with Reanimated
    │   └── animations-performance.md     # 120fps, feature flags, simultaneous animation limits
    ├── gestures/
    │   ├── SKILL.md                      # Version decision tree (v2 Builder vs v3 Hook API)
    │   ├── gestures.md                   # Decision tree, lifecycle, threading, SharedValue config
    │   ├── tap-handling.md               # RectButton, Pressable, tap, double-tap, hit slop
    │   ├── continuous-gestures.md        # Pan, Pinch, Rotation, LongPress, Fling, Hover
    │   ├── gesture-composition.md        # Simultaneous, Race, Exclusive, VirtualGestureDetector
    │   ├── swipeable-and-drawer.md       # ReanimatedSwipeable, ReanimatedDrawerLayout
    │   └── testing.md                    # Jest setup, fireGestureHandler, troubleshooting
    ├── svg/
    │   ├── SKILL.md                      # When to use react-native-svg vs alternatives
    │   ├── when-to-use.md               # Choosing between svg, expo-image, icons, Skia, Lottie
    │   └── svg.md                        # Installation, loading (URI/XML/file), touch events, filters, FilterImage, performance
    ├── on-device-ai/
    │   └── SKILL.md                      # Routes to the standalone react-native-executorch skill
    ├── rich-text/
    │   └── SKILL.md                      # Editor and renderer patterns, style customization
    ├── multithreading/
    │   ├── SKILL.md                      # Runtime model, API decision tree, critical rules
    │   ├── threading-api.md              # Scheduling APIs, Worker Runtimes, sync/async
    │   ├── shared-memory.md              # Closures, Serializable, Synchronizable
    │   └── setup-and-advanced.md         # Installation, Babel config, Bundle Mode, Jest
    ├── enable-worklets-bundle-mode/
    │   ├── SKILL.md                      # State detection, babel plugin, metro config, patches, verification
    │   └── references/
    │       ├── patching-yarn-berry.md    # Metro patches via Yarn 2+ builtin patch: protocol
    │       ├── patching-patch-package.md # Metro patches via patch-package (npm / Yarn 1 classic)
    │       ├── patching-bun.md           # Metro patches via bun's native patching
    │       ├── patching-pnpm.md          # Metro patches via pnpm patch
    │       └── uniwind-remap-workaround.md # Guarded metro config when a library remaps react-native
    ├── audio/
    │   ├── SKILL.md                      # When to use, what references to read
    │   ├── audio.md                      # Decision tree, AudioContext lifecycle, singleton, audio graph, decoding
    │   ├── playback.md                   # AudioBufferSourceNode, OscillatorNode, StreamerNode, queued playback, AudioParam, noise
    │   ├── recording.md                  # AudioRecorder modes (file, callback, graph), permissions, file formats
    │   ├── effects-and-analysis.md       # GainNode (ADSR), filters, delay, convolver, panner, AnalyserNode, visualization
    │   ├── worklets.md                   # WorkletNode, WorkletSourceNode, WorkletProcessingNode, runtimes, performance
    │   └── system-and-notifications.md   # AudioManager, sessions, interruptions, notifications, permissions, testing
    └── jsi/
        ├── SKILL.md                      # Decision tree, references routing
        ├── overview.md                   # JSI architecture, sync model, runtime data, prototype manipulation
        ├── core-types.md                 # Value, PropNameID, HostFunction, HostObject, NativeState, WeakObject, Scope
        ├── casting-and-serialization.md  # get/as convention, string encoding, C++↔JS mapping, folly::dynamic, ISerialization
        ├── threading-safety.md           # Single-thread rule, destruction order, hot reload pitfalls, WithRuntimeDecorator
        ├── calling-js-and-async.md       # HostFunction install, calling JS from C++, CallInvoker, Promise patterns
        ├── performance.md                # Batching, PropNameID cache, zero-copy ArrayBuffer, Scope in loops
        ├── setup-and-templates.md        # Android (FBJNI), iOS (ObjC++), library scaffolding templates
        ├── module-approaches.md          # Pure JSI vs TurboModules vs Nitro Modules decision tree
        ├── cpp-memory-patterns.md        # unique_ptr, shared_ptr, move, RAII, circular ownership, GC boundary
        └── debugging-and-pitfalls.md     # Crash traces, symbolication, ASan, common JSI crash patterns

Adding a Sub-skill

  1. Create the directory: references/<your-topic>/
  2. Write SKILL.md with frontmatter:
    ---
    name: your-topic
    description: "What it covers and when to trigger. Include specific keywords users might type."
    ---
  3. Add reference files for detailed patterns and code examples
  4. Register it in the parent SKILL.md sub-skills table
  5. Keep SKILL.md under 500 lines. Move detailed content to reference files and link to them with a "when to read" table.

Libraries Covered

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 alerttoday5 checks · Risk SAFE
  • Gen Agent Trust Hubtoday

    The skill provides comprehensive documentation for React Native best practices. It can modify build tool configurations and apply patches to the Metro bundler from the official Software Mansion GitHub repository, so ensure project backups before use.

  • Socket19d

    No alerts

  • Snyktoday

    Risk: CRITICAL · 1 issue

  • Runlayer8mo

    5/24 files flagged

  • ZeroLeaks7mo

    Scan incomplete

Signed by skilld at 43cde80. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Activeupdated 3 weeks ago

README badge

README badge for software-mansion-labs/skills/react-native-best-practices