# Firebase Emulator Workflow

> Firebase Emulator Suite の起動・停止・管理ワークフロー。「エミュレーター」「Firebase」「Firestore」「Auth」「ローカル開発」などのキーワードで自動適用。

- Skill: `no-problem-dev/firebase-emulator-workflow` (Agent Skill)
- Install (CLI): `npx skillmds@latest add no-problem-dev/firebase-emulator-workflow`
- Raw SKILL.md: https://api.skillmd.com/api/skills/no-problem-dev/firebase-emulator-workflow/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Productivity, DevOps & Infra
- Author: no-problem-dev (https://skillmd.com/u/no-problem-dev)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/no-problem-dev/firebase-emulator-workflow

---


# Firebase Emulator ワークフロー（v2.0）

Firebase Emulator Suite のローカル開発環境管理ワークフロー。

## スキル

| スキル | 用途 | 使いどころ |
|--------|------|-----------|
| **emulator-control** | 起動・停止・状態確認 | 「エミュレーター起動」「停止」「状態」 |

## 推奨ワークフロー

```
開発開始 → emulator-control（起動）
    ↓
iOS / Backend 開発
    ↓
開発終了 → emulator-control（停止）
```

## 環境変数

| 変数 | 説明 | デフォルト |
|------|------|-----------|
| `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 設定を検出:

1. 環境変数 `FIREBASE_DIR`
2. カレントディレクトリの `firebase.json`
3. `firebase/` サブディレクトリ

## Emulator UI

起動後、ブラウザで確認:

```
http://localhost:4000
```

## アプリからの接続

### iOS (Swift)

```swift
let settings = Firestore.firestore().settings
settings.host = "localhost:8090"
settings.isSSLEnabled = false
Firestore.firestore().settings = settings
```

### Go Backend

```go
os.Setenv("FIRESTORE_EMULATOR_HOST", "localhost:8090")
os.Setenv("FIREBASE_AUTH_EMULATOR_HOST", "localhost:9099")
```

## よくある問題

### ポートが既に使用中

```
Port 8090 is already in use
```

**対処**: 既存のプロセスを終了
```bash
lsof -ti :8090 | xargs kill -9
```

### firebase.json が見つからない

```
Error: No Firebase project directory found
```

**対処**: `firebase init` でプロジェクトを初期化

