firebase-emulator-workflow
Firebase Emulator Suiteの起動・停止・管理ワークフロー。「エミュレーター」「Firebase」「Firestore」「Auth」「ローカル開発」などのキーワードで自動適用。
When & Why to Use This Skill
This Claude skill provides a comprehensive workflow for managing the Firebase Emulator Suite, allowing developers to start, stop, and monitor local environments for Firestore, Auth, and Storage. It streamlines local development by automating environment detection and providing quick troubleshooting for common configuration issues.
Use Cases
- Local Development: Effortlessly spin up local Firebase services to build and test features without incurring cloud costs or requiring an active internet connection.
- Resource Management: Use background start and stop commands to efficiently manage system resources during and after development sessions.
- Cross-Platform Integration: Simplify the process of connecting iOS (Swift) and Backend (Go) applications to local emulators through automated environment variable configuration.
- Environment Troubleshooting: Quickly resolve common setup hurdles such as port conflicts and missing configuration files with built-in diagnostic guidance.
| name | firebase-emulator-workflow |
|---|---|
| description | Firebase Emulator Suiteの起動・停止・管理ワークフロー。「エミュレーター」「Firebase」「Firestore」「Auth」「ローカル開発」などのキーワードで自動適用。 |
Firebase Emulator Workflow
Firebase Emulator Suite のローカル開発環境管理ワークフロー。
コマンド一覧
| コマンド | 用途 |
|---|---|
/firebase-emulator:emulator-start |
エミュレーター起動(バックグラウンド) |
/firebase-emulator:emulator-stop |
エミュレーター停止 |
/firebase-emulator:emulator-status |
状態確認 |
推奨ワークフロー
開発開始 → emulator-start(バックグラウンド起動)
↓
iOS/Backend 開発
↓
開発終了 → emulator-stop(リソース解放)
環境変数
| 変数 | 説明 | デフォルト |
|---|---|---|
FIREBASE_PROJECT_ID |
プロジェクトID | 自動検出 |
EMULATOR_PORT_FIRESTORE |
Firestore ポート | 8090 |
EMULATOR_PORT_AUTH |
Auth ポート | 9099 |
EMULATOR_PORT_STORAGE |
Storage ポート | 9199 |
EMULATOR_PORT_UI |
UI ポート | 4000 |
ディレクトリ検出
以下の順序で Firebase 設定を検出:
- 環境変数
FIREBASE_DIR - カレントディレクトリの
firebase.json firebase/サブディレクトリ
Emulator UI
起動後、ブラウザで確認:
http://localhost:4000
アプリからの接続
iOS (Swift)
let settings = Firestore.firestore().settings
settings.host = "localhost:8090"
settings.isSSLEnabled = false
Firestore.firestore().settings = settings
Go Backend
os.Setenv("FIRESTORE_EMULATOR_HOST", "localhost:8090")
os.Setenv("FIREBASE_AUTH_EMULATOR_HOST", "localhost:9099")
よくある問題
ポートが既に使用中
Port 8090 is already in use
対処: 既存のプロセスを終了
lsof -ti :8090 | xargs kill -9
firebase.json が見つからない
Error: No Firebase project directory found
対処: firebase init でプロジェクトを初期化