Skip to content

Debugging

The debugging skill provides knowledge for diagnosing problems in React Native apps using the CDP MCP server, native device logs, and bash tools.

Activates when Claude encounters crashes, blank screens, connection issues, error logs, Metro problems, network failures, or any diagnostic task.

What you needToolCommand
Metro statusMCPcdp_status
JS crashMCPcdp_error_log
Native crash (iOS)MCPcollect_logs(sources=["native_ios"])
Native crash (Android)MCPcollect_logs(sources=["native_android"])
Current screenMCPcdp_navigation_state
Component treeMCPcdp_component_tree(filter="...")
Store stateMCPcdp_store_state(path="...")
API callsMCPcdp_network_log
Console outputMCPcdp_console_log(level="all")
Debugger paused?MCPcdp_status (reports isPaused)
RedBox overlay?MCPcdp_component_tree (auto-detects)
Metro alive?bashcurl localhost:8081/status
UI element treeMCPdevice_snapshot
Runtime valueMCPcdp_evaluate(expression="...")

If cdp_error_log is empty but the app is broken, the problem is native.

Error TypeWhere to Find
JS runtime errorcdp_error_log
Unhandled promise rejectioncdp_error_log
RedBox overlaycdp_component_tree (APP_HAS_REDBOX)
console.error()cdp_console_log(level="error")
Metro bundle syntax errorcurl localhost:8081/status
Native crash (iOS)collect_logs(sources=["native_ios"])
Native crash (Android)collect_logs(sources=["native_android"])
Network failurecdp_network_log (status=0)

Always called first. Decision tree:

  • metro.running = false means start Metro
  • app.hasRedBox = true means read cdp_error_log, fix, reload
  • app.isPaused = true means cdp_reload
  • app.errorCount > 0 means check cdp_error_log
  • capabilities.networkDomain = false means network logging uses injected hooks (RN < 0.83)
  • capabilities.fiberTree = false means release build or non-Hermes engine
SymptomFix
Metro not foundStart dev server: npx expo start
No Hermes targetWait for app to load, retry
Error code 1006Close other debugger UIs (DevTools, Flipper, Chrome)
Evaluate timeout (5s)Search for debugger; statements, check for long sync ops
”hook not available”Only works in __DEV__ mode with Hermes
APP_HAS_REDBOXRead error log, fix code, reload
”No store found”Add if (__DEV__) global.__ZUSTAND_STORES__ = { ... }
All CDP calls failReload app and reconnect with cdp_status
  • 5-second timeout on all CDP calls (caused by debugger; statements, long sync ops, unresolved promises)
  • Single CDP session (Hermes allows exactly one client; close DevTools/Flipper first)
  • Fiber tree limitations: only works in __DEV__ + Hermes; component in tree does not mean visible on screen

After cdp_reload, auto-reconnect waits up to 30 seconds. If cdp_component_tree returns “No fiber roots”, wait 2 seconds and retry.

The MCP server auto-discovers Metro on ports 8081, 8082, 19000, 19006. Pass metroPort to cdp_status for non-standard ports.