Token导航 LogoToken导航TokenDH.com
研究检索权限需确认github未标认证来源可访问clear审计未展示

debug_react-native调试 React native

Agent Skill

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

总安装

1,212

周安装

51

GitHub Stars

公开资料未说明

下载量

424
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:debug_react-native(调试 React native)
来源仓库:https://github.com/snakeo/claude-debug-and-refactor-skills-plugin
仓库路径:skills/debug_react-native
安装命令:
npx skills add snakeo/claude-debug-and-refactor-skills-plugin --skill "debug:react-native"
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

AgentSkills.tonpx skills
npx skills add snakeo/claude-debug-and-refactor-skills-plugin --skill "debug:react-native"

简介

debug_react-native 提供 React Native 移动应用的调试支持。

  • 适用于跨平台 UI 组件与原生模块分析。
  • 需确认项目依赖和设备模拟器配置。debug_react-native 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 涉及真机调试时,应区分开发环境与发布环境。
  • 建议结合 Metro 构建工具和日志查看器验证改动。

SKILL.md

React Native Debugging Guide

You are an expert React Native debugger. When the user encounters React Native issues, follow this systematic four-phase approach to identify, diagnose, and resolve the problem efficiently.

Common Error Patterns

Red Screen Errors (Fatal Errors)

  • "Unable to load script": Metro bundler connection issues
  • "Invariant Violation": React component lifecycle or rendering errors
  • "Module not found": Missing or incorrectly linked dependencies
  • "Native module cannot be null": Native module linking failures
  • "Text strings must be rendered within a component": JSX structure errors

Yellow Box Warnings

  • Deprecation warnings for outdated APIs
  • Performance warnings (excessive re-renders)
  • Unhandled promise rejections
  • Console.warn statements

Metro Bundler Issues

  • Port 8081 already in use
  • Cache corruption causing stale bundles
  • Watchman file watching limits exceeded (EMFILE errors)
  • Symlink resolution failures
  • Module resolution failures

Native Module Linking Errors

  • "RCTBridge required dispatch_sync to load" (iOS)
  • "Native module XYZ tried to override" conflicts
  • CocoaPods installation failures
  • Gradle build failures
  • Auto-linking not working properly

Bridge Communication Failures

  • Serialization errors for complex objects
  • Async bridge message queue overflow
  • Threading violations (UI updates from background thread)
  • Turbo Modules migration issues (New Architecture)

iOS-Specific Build Failures

  • Xcode version incompatibility
  • CocoaPods cache corruption
  • Provisioning profile issues
  • Bitcode compilation errors
  • M1/M2 architecture issues (Rosetta)

Android-Specific Build Failures

  • Gradle version mismatches
  • Android SDK path not configured
  • NDK version conflicts
  • R8/ProGuard minification errors
  • MultiDex issues

Hermes Engine Issues

  • Bytecode compilation failures
  • Incompatible native modules with Hermes
  • Source map issues for stack traces
  • Memory leaks specific to Hermes

Debugging Tools

React Native DevTools (Primary - RN 0.76+)

The default debugging tool for React Native. Access via Dev Menu or press "j" from CLI.

  • Console panel for JavaScript logs
  • React DevTools integration for component inspection
  • Network inspection
  • Performance profiling

Flipper (Comprehensive Desktop Debugger)

Meta's desktop debugging platform with plugin architecture:

  • Layout Inspector: Visualize component hierarchies
  • Network Inspector: Monitor API requests/responses
  • Database Browser: View AsyncStorage, SQLite
  • Log Viewer: Centralized JavaScript and native logs
  • React DevTools Integration: Inspect component trees and hooks
  • Hermes Debugger: Debug Hermes bytecode

Reactotron (State Management Focus)

Free, open-source desktop app by Infinite Red:

  • Redux/MobX state tracking
  • API request/response logging
  • Custom command execution
  • Benchmark timing
  • Error stack traces

React Native Debugger (All-in-One)

Combines multiple debugging features:

  • Chrome DevTools integration
  • React DevTools
  • Redux DevTools
  • Network inspection

Native IDE Tools

  • Xcode: iOS crash logs, memory profiler, Instruments
  • Android Studio: Logcat, Layout Inspector, Profiler, Memory Analyzer

Console and Logging

  • console.log(), console.warn(), console.error()
  • LogBox for structured error/warning display
  • Remote debugging via Chrome DevTools
  • Structured logging with severity levels

The Four Phases of React Native Debugging

Phase 1: Information Gathering

Before attempting any fixes, systematically collect diagnostic information:

# 1. Check React Native environment health
npx react-native doctor

# 2. Get React Native version info
npx react-native info

# 3. Check Node.js and npm/yarn versions
node --version
npm --version  # or: yarn --version

# 4. Verify Metro bundler status
# Check if port 8081 is in use
lsof -i :8081  # macOS/Linux
netstat -ano | findstr :8081  # Windows

# 5. Check Watchman status (file watching)
watchman version
watchman watch-list

# 6. iOS: Check CocoaPods version
pod --version
cd ios && pod outdated

# 7. Android: Check Gradle and SDK
cd android && ./gradlew --version
echo $ANDROID_HOME

Ask the user:

  1. What is the exact error message (copy full stack trace)?
  2. When did the error start occurring?
  3. Did you recently update any dependencies or React Native version?
  4. Does the error occur on iOS, Android, or both?
  5. Is this a development build or production build?
  6. Are you using Expo or bare React Native?
  7. Is Hermes enabled?

Phase 2: Error Classification and Diagnosis

Classify the error into one of these categories:

JavaScript Errors

Symptoms: Red screen with JS stack trace, errors in console Diagnosis:

# Check for syntax errors
npx eslint src/

# Verify TypeScript compilation (if using TS)
npx tsc --noEmit

# Check for circular dependencies
npx madge --circular src/

Build/Compilation Errors

Symptoms: Build fails before app launches Diagnosis:

# iOS: Clean and rebuild
cd ios && xcodebuild clean
cd ios && pod deintegrate && pod install

# Android: Clean Gradle
cd android && ./gradlew clean
cd android && ./gradlew --refresh-dependencies

Runtime/Native Errors

Symptoms: Crash after launch, native stack trace Diagnosis:

# iOS: Check Xcode console and crash logs
# Open Xcode > Window > Devices and Simulators > View Device Logs

# Android: Check Logcat
adb logcat *:E | grep -E "(ReactNative|RN|React)"

Metro/Bundler Errors

Symptoms: "Unable to load script", bundling failures Diagnosis:

# Check Metro process
ps aux | grep metro

# Verify cache state
ls -la $TMPDIR/metro-*
ls -la node_modules/.cache/

Dependency/Linking Errors

Symptoms: "Module not found", "Native module cannot be null" Diagnosis:

# Check installed dependencies
npm ls  # or: yarn list

# Verify native module linking (RN < 0.60)
npx react-native link

# Check auto-linking (RN >= 0.60)
npx react-native config

Phase 3: Resolution Strategies

Apply fixes based on error classification:

The Nuclear Option (Clean Everything)

When nothing else works, perform a complete clean:

# 1. Stop all processes
# Kill Metro bundler (Ctrl+C or)
lsof -ti:8081 | xargs kill -9

# 2. Clear JavaScript caches
rm -rf node_modules
rm -rf $TMPDIR/react-*
rm -rf $TMPDIR/metro-*
rm -rf $TMPDIR/haste-map-*
watchman watch-del-all

# 3. Clear iOS caches
cd ios
rm -rf Pods
rm -rf ~/Library/Caches/CocoaPods
rm -rf ~/Library/Developer/Xcode/DerivedData
pod cache clean --all
pod deintegrate
pod setup
pod install
cd ..

# 4. Clear Android caches
cd android
./gradlew clean
rm -rf .gradle
rm -rf app/build
rm -rf ~/.gradle/caches
cd ..

# 5. Reinstall dependencies
npm cache clean --force  # or: yarn cache clean
npm install  # or: yarn install

# 6. Rebuild
npx react-native start --reset-cache
# In another terminal:
npx react-native run-ios  # or: run-android

Metro Bundler Fixes

# Reset Metro cache
npx react-native start --reset-cache

# Change Metro port if 8081 is occupied
npx react-native start --port 8082

# Kill process using port 8081
lsof -ti:8081 | xargs kill -9  # macOS/Linux
# Windows: Use Resource Monitor to find and kill process

# Fix Watchman issues (EMFILE: too many open files)
watchman watch-del-all
watchman shutdown-server
# Increase file limit (macOS)
echo kern.maxfiles=10485760 | sudo tee -a /etc/sysctl.conf
echo kern.maxfilesperproc=1048576 | sudo tee -a /etc/sysctl.conf
sudo sysctl -w kern.maxfiles=10485760
sudo sysctl -w kern.maxfilesperproc=1048576
ulimit -n 65536

iOS-Specific Fixes

# CocoaPods reinstall
cd ios
pod deintegrate
pod cache clean --all
rm Podfile.lock
pod install --repo-update
cd ..

# Xcode clean build
cd ios
xcodebuild clean -workspace YourApp.xcworkspace -scheme YourApp
cd ..

# M1/M2 Mac issues (run with Rosetta)
# Open Terminal via Rosetta, then:
arch -x86_64 pod install

# Fix provisioning/signing issues
# Open Xcode > Signing & Capabilities > Select team

# Reset iOS Simulator
xcrun simctl shutdown all
xcrun simctl erase all

Android-Specific Fixes

# Set Android SDK path
export ANDROID_HOME=~/Library/Android/sdk  # macOS
export ANDROID_HOME=~/Android/Sdk  # Linux
# Add to PATH
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools

# Gradle clean and rebuild
cd android
./gradlew clean
./gradlew assembleDebug --stacktrace
cd ..

# Fix Gradle wrapper issues
cd android
rm -rf .gradle
./gradlew wrapper --gradle-version=8.3
cd ..

# Accept Android SDK licenses
yes | sdkmanager --licenses

# ADB issues
adb kill-server
adb start-server
adb devices

Native Module Linking Fixes

# For React Native >= 0.60 (auto-linking)
cd ios && pod install && cd ..
npx react-native run-ios

# For React Native < 0.60 (manual linking)
npx react-native link <package-name>

# Verify linking configuration
npx react-native config

# Rebuild after linking
cd android && ./gradlew clean && cd ..
cd ios && pod install && cd ..

Hermes Engine Fixes

# Verify Hermes is enabled (check android/app/build.gradle)
# hermesEnabled: true

# Clean Hermes bytecode cache
cd android && ./gradlew clean && cd ..

# iOS: Reinstall pods with Hermes
cd ios
pod deintegrate
pod install
cd ..

# Disable Hermes temporarily to test
# android/gradle.properties: hermesEnabled=false
# ios/Podfile: :hermes_enabled => false

Dependency Conflict Resolution

# Check for duplicate packages
npm ls <package-name>

# Force resolution with npm
# Add to package.json:
# "overrides": { "problematic-package": "desired-version" }
npm install

# Force resolution with yarn
# Add to package.json:
# "resolutions": { "problematic-package": "desired-version" }
yarn install

# Deduplicate dependencies
npm dedupe  # or: yarn dedupe

Phase 4: Verification and Prevention

After applying fixes, verify the solution:

# 1. Run doctor again
npx react-native doctor

# 2. Start fresh Metro instance
npx react-native start --reset-cache

# 3. Run on both platforms
npx react-native run-ios
npx react-native run-android

# 4. Run tests
npm test  # or: yarn test

# 5. Check for TypeScript errors
npx tsc --noEmit

# 6. Run linter
npx eslint src/ --ext .js,.jsx,.ts,.tsx

Prevention strategies:

  1. Lock dependency versions in package.json
  2. Use exact versions for native modules
  3. Keep React Native version updated (within major versions)
  4. Maintain consistent node_modules across team (use lockfiles)
  5. Document native configuration changes
  6. Use CI/CD to catch build issues early
  7. Enable error boundaries in production
  8. Implement crash reporting (Sentry, Crashlytics)

Quick Reference Commands

# Environment check
npx react-native doctor
npx react-native info

# Start with cache reset
npx react-native start --reset-cache

# Run on specific platform
npx react-native run-ios
npx react-native run-ios --simulator="iPhone 15 Pro"
npx react-native run-android
npx react-native run-android --deviceId=<device-id>

# iOS specific
cd ios && pod install
cd ios && pod update
cd ios && pod deintegrate && pod install
xcodebuild clean -workspace ios/YourApp.xcworkspace -scheme YourApp

# Android specific
cd android && ./gradlew clean
cd android && ./gradlew assembleDebug --stacktrace
cd android && ./gradlew assembleRelease
adb logcat *:E
adb reverse tcp:8081 tcp:8081

# Process management
lsof -ti:8081 | xargs kill -9  # Kill Metro
watchman watch-del-all
watchman shutdown-server

# Cache clearing
rm -rf node_modules
rm -rf $TMPDIR/react-*
rm -rf $TMPDIR/metro-*
rm -rf ios/Pods
rm -rf android/.gradle
rm -rf android/app/build

# Dependency management
npm cache clean --force
yarn cache clean
npm install
yarn install

# Debugging
npx react-native log-ios
npx react-native log-android
adb shell input keyevent 82  # Open Dev Menu on Android

# Generate release builds
cd android && ./gradlew bundleRelease
cd ios && xcodebuild -workspace YourApp.xcworkspace -scheme YourApp -configuration Release archive

Platform-Specific Debugging

iOS Debugging Checklist

  1. Open Xcode and check Issue Navigator (Cmd+5)
  2. Check Console output in Debug area (Cmd+Shift+C)
  3. Verify Signing & Capabilities settings
  4. Check Podfile and Podfile.lock for version mismatches
  5. Review build phases and linked frameworks
  6. Use Instruments for memory/CPU profiling
  7. Check device logs: Window > Devices and Simulators

Android Debugging Checklist

  1. Open Android Studio and check Build output
  2. Check Logcat for errors: View > Tool Windows > Logcat
  3. Verify build.gradle dependencies and versions
  4. Check AndroidManifest.xml for permissions
  5. Review ProGuard rules if using minification
  6. Use Android Profiler for performance issues
  7. Check adb devices for device connectivity

New Architecture (Fabric + TurboModules)

If using React Native New Architecture:

# Enable New Architecture (android/gradle.properties)
newArchEnabled=true

# Enable New Architecture (ios/Podfile)
ENV['RCT_NEW_ARCH_ENABLED'] = '1'

# Rebuild after enabling
cd ios && pod install
cd android && ./gradlew clean

# Common New Architecture issues:
# 1. Native modules not compatible - check for TurboModule support
# 2. Fabric renderer issues - verify component compatibility
# 3. Build failures - ensure correct versions of dependencies

Error Handling Best Practices

// Implement Error Boundaries
import React, { Component, ErrorInfo, ReactNode } from 'react';

interface Props {
  children: ReactNode;
  fallback?: ReactNode;
}

interface State {
  hasError: boolean;
  error?: Error;
}

class ErrorBoundary extends Component<Props, State> {
  constructor(props: Props) {
    super(props);
    this.state = { hasError: false };
  }

  static getDerivedStateFromError(error: Error): State {
    return { hasError: true, error };
  }

  componentDidCatch(error: Error, errorInfo: ErrorInfo) {
    // Log to error reporting service (Sentry, Crashlytics)
    console.error('Error caught by boundary:', error, errorInfo);
  }

  render() {
    if (this.state.hasError) {
      return this.props.fallback || <FallbackComponent error={this.state.error} />;
    }
    return this.props.children;
  }
}

// Async error handling
const fetchData = async () => {
  try {
    const response = await fetch(url);
    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    }
    return await response.json();
  } catch (error) {
    console.error('Fetch error:', error);
    // Report to crash analytics
    throw error;
  }
};

Debugging Workflow Summary

  1. Gather Information: Run npx react-native doctor, collect error messages, identify platform
  2. Classify Error: JavaScript, Build, Runtime, Metro, or Dependency issue
  3. Apply Targeted Fix: Use platform-specific commands based on classification
  4. Verify Fix: Test on both platforms, run tests, check for regressions
  5. Document: Note what caused the issue and how it was resolved

Remember: Most React Native issues can be resolved by clearing caches and rebuilding. When in doubt, perform the "nuclear option" clean and rebuild.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Antigravity

32.49%
按下载量换算138

Claude Code

22.16%
按下载量换算94

OpenCode

19.6%
按下载量换算83

Cursor

13.44%
按下载量换算57

Gemini CLI

7.75%
按下载量换算33

windsurf

3.18%
按下载量换算13

安全审计

暂无安全审计结果可展示。

权限和风险

权限需确认

当前来源未能明确判断权限范围,默认进入异常复核队列。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills