🛠️ 開発・MCP コミュニティ
mobile-debugging
Debug React Native apps including metro bundler issues, native errors, performance problems, and crash analysis. Use when troubleshooting errors or investigating issues.
⚡ おすすめ: コマンド1行でインストール(60秒)
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o mobile-debugging.zip https://jpskill.com/download/17419.zip && unzip -o mobile-debugging.zip && rm mobile-debugging.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/17419.zip -OutFile "$d\mobile-debugging.zip"; Expand-Archive "$d\mobile-debugging.zip" -DestinationPath $d -Force; ri "$d\mobile-debugging.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
mobile-debugging.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
mobile-debuggingフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
モバイルデバッグ
React Native および Expo アプリケーションのデバッグガイドです。
どのような時に使うか
- アプリがクラッシュまたはフリーズする場合
- Metro bundler のエラーが発生する場合
- ネイティブモジュールの問題が発生する場合
- パフォーマンスの問題が発生する場合
- ビルドが失敗する場合
- ネットワークリクエストのデバッグが必要な場合
よくある問題と解決策
Metro Bundler の問題
# すべてのキャッシュをクリア
npx expo start --clear
watchman watch-del-all
rm -rf node_modules && npm install
# packager のキャッシュをリセット
rm -rf /tmp/metro-*
rm -rf /tmp/haste-*
ネイティブモジュールのエラー
# iOS: pods をリセット
cd ios && pod deintegrate && pod install && cd ..
# Android: ビルドをクリーン
cd android && ./gradlew clean && cd ..
# Expo: Prebuild をクリーン
npx expo prebuild --clean
シミュレーター/エミュレーターの問題
# iOS: シミュレーターをリセット
xcrun simctl erase all
# Android: エミュレーターのデータを消去
adb devices # デバイス ID を見つける
adb -s DEVICE_ID emu kill
デバッグツール
React DevTools
# インストール
npm install -g react-devtools
# 起動
react-devtools
# アプリ内: デバイスをシェイク -> "Debug Remote JS"
Metro Logs
# 詳細なログを表示
npx expo start --verbose
# iOS デバイスのログ
npx react-native log-ios
# Android デバイスのログ
npx react-native log-android
adb logcat
ネットワークデバッグ
// ネットワークインスペクターを有効にする
import { Platform } from 'react-native';
if (__DEV__ && Platform.OS === 'ios') {
require('react-native').NativeModules.DevSettings.setIsDebuggingRemotely(true);
}
// または、高度なネットワーク検査のために Flipper を使用する
パフォーマンスデバッグ
遅いレンダリングの特定
// パフォーマンスロギングを追加
import { useEffect, useRef } from 'react';
function useRenderTime(componentName: string) {
const start = useRef(performance.now());
useEffect(() => {
const duration = performance.now() - start.current;
if (duration > 16) {
console.warn(`Slow render: ${componentName} took ${duration.toFixed(2)}ms`);
}
});
}
// コンポーネントで使用
function MyComponent() {
useRenderTime('MyComponent');
return <View>...</View>;
}
メモリーリーク
// クリーンアップの欠落を確認
useEffect(() => {
const subscription = someObservable.subscribe();
const timer = setInterval(() => {}, 1000);
// 必ずクリーンアップする!
return () => {
subscription.unsubscribe();
clearInterval(timer);
};
}, []);
エラー調査
JavaScript エラー
# スタックトレースでエラーを探す
# 最近のファイルの変更を確認
# インポートと依存関係を確認
# 変数名のタイプミスを確認
ネイティブエラー
# iOS: Xcode コンソールを確認
# Android: Android Studio Logcat を確認
# Java/Swift の例外を探す
# ネイティブモジュールの互換性を確認
ビルドエラー
# パッケージのバージョンを確認
npx expo-doctor
# node/npm のバージョンを確認
node --version
npm --version
# 競合する依存関係を確認
npm ls PACKAGE_NAME
デバッグコマンド
# ポートを使用しているものを確認
lsof -ti:8081 # Metro bundler のポート
lsof -ti:19000 # Expo DevTools
# ポート上のプロセスを強制終了
kill -9 $(lsof -ti:8081)
# デバイスの接続を確認
# iOS
xcrun simctl list devices
# Android
adb devices
# adb を再起動
adb kill-server
adb start-server
デバッグチェックリスト
問題を調査する際に:
- 再現: 問題を一貫してトリガーできますか?
- 最近の変更: 壊れる前に何を変更しましたか?
- エラーメッセージ: スタックトレースを含む、完全なエラーを読んでください
- 依存関係: パッケージに互換性があるか確認してください
- プラットフォーム: iOS、Android、または両方で発生しますか?
- 環境: 開発環境のみですか、それとも本番ビルドでも発生しますか?
- ログ: Metro、Xcode、および Logcat で詳細を確認してください
よくあるエラーパターン
- "Unable to resolve module": インポートパスとファイルが存在するか確認してください
- "Invariant Violation": React のエラーです。コンポーネントのライフサイクルを確認してください
- "Network request failed": API URL とネットワーク接続を確認してください
- "Undefined is not an object": プロパティにアクセスする前に、null/undefined を確認してください
- "Maximum call stack size exceeded": 無限ループまたは再帰
参考資料
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Mobile Debugging
Debugging guide for React Native and Expo applications.
When to Use
- App crashes or freezes
- Metro bundler errors
- Native module issues
- Performance problems
- Build failures
- Network request debugging
Common Issues & Fixes
Metro Bundler Problems
# Clear all caches
npx expo start --clear
watchman watch-del-all
rm -rf node_modules && npm install
# Reset packager cache
rm -rf /tmp/metro-*
rm -rf /tmp/haste-*
Native Module Errors
# iOS: Reset pods
cd ios && pod deintegrate && pod install && cd ..
# Android: Clean build
cd android && ./gradlew clean && cd ..
# Expo: Prebuild clean
npx expo prebuild --clean
Simulator/Emulator Issues
# iOS: Reset simulator
xcrun simctl erase all
# Android: Wipe emulator data
adb devices # Find device ID
adb -s DEVICE_ID emu kill
Debugging Tools
React DevTools
# Install
npm install -g react-devtools
# Start
react-devtools
# In app: Shake device -> "Debug Remote JS"
Metro Logs
# View detailed logs
npx expo start --verbose
# iOS device logs
npx react-native log-ios
# Android device logs
npx react-native log-android
adb logcat
Network Debugging
// Enable network inspector
import { Platform } from 'react-native';
if (__DEV__ && Platform.OS === 'ios') {
require('react-native').NativeModules.DevSettings.setIsDebuggingRemotely(true);
}
// Or use Flipper for advanced network inspection
Performance Debugging
Identify Slow Renders
// Add performance logging
import { useEffect, useRef } from 'react';
function useRenderTime(componentName: string) {
const start = useRef(performance.now());
useEffect(() => {
const duration = performance.now() - start.current;
if (duration > 16) {
console.warn(`Slow render: ${componentName} took ${duration.toFixed(2)}ms`);
}
});
}
// Use in components
function MyComponent() {
useRenderTime('MyComponent');
return <View>...</View>;
}
Memory Leaks
// Check for missing cleanup
useEffect(() => {
const subscription = someObservable.subscribe();
const timer = setInterval(() => {}, 1000);
// MUST clean up!
return () => {
subscription.unsubscribe();
clearInterval(timer);
};
}, []);
Error Investigation
JavaScript Errors
# Look for error in stack trace
# Check recent file changes
# Verify imports and dependencies
# Check for typos in variable names
Native Errors
# iOS: Check Xcode console
# Android: Check Android Studio Logcat
# Look for Java/Swift exceptions
# Check native module compatibility
Build Errors
# Check package versions
npx expo-doctor
# Verify node/npm versions
node --version
npm --version
# Check for conflicting dependencies
npm ls PACKAGE_NAME
Debugging Commands
# Check what's using a port
lsof -ti:8081 # Metro bundler port
lsof -ti:19000 # Expo DevTools
# Kill process on port
kill -9 $(lsof -ti:8081)
# Check device connectivity
# iOS
xcrun simctl list devices
# Android
adb devices
# Restart adb
adb kill-server
adb start-server
Debugging Checklist
When investigating issues:
- Reproduce: Can you consistently trigger the issue?
- Recent Changes: What was changed before it broke?
- Error Message: Read the full error, including stack trace
- Dependencies: Check if packages are compatible
- Platform: Does it happen on iOS, Android, or both?
- Environment: Dev only or production builds too?
- Logs: Check Metro, Xcode, and Logcat for details
Common Error Patterns
- "Unable to resolve module": Check import path and file exists
- "Invariant Violation": React error, check component lifecycle
- "Network request failed": Check API URL and network connection
- "Undefined is not an object": Check for null/undefined before accessing properties
- "Maximum call stack size exceeded": Infinite loop or recursion