jpskill.com
🛠️ 開発・MCP コミュニティ

firebase-development-project-setup

実績のある構成でFirebaseプロジェクトを新規に始める際に、CLI設定や構成の選択、エミュレーター設定などをガイドし、スムーズな初期設定を支援するSkill。

📜 元の英語説明(参考)

This skill should be used when initializing a new Firebase project with proven architecture. Triggers on "new firebase project", "initialize firebase", "firebase init", "set up firebase", "create firebase app", "start firebase project". Guides through CLI setup, architecture choices, and emulator configuration.

🇯🇵 日本人クリエイター向け解説

一言でいうと

実績のある構成でFirebaseプロジェクトを新規に始める際に、CLI設定や構成の選択、エミュレーター設定などをガイドし、スムーズな初期設定を支援するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o firebase-development-project-setup.zip https://jpskill.com/download/16718.zip && unzip -o firebase-development-project-setup.zip && rm firebase-development-project-setup.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/16718.zip -OutFile "$d\firebase-development-project-setup.zip"; Expand-Archive "$d\firebase-development-project-setup.zip" -DestinationPath $d -Force; ri "$d\firebase-development-project-setup.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して firebase-development-project-setup.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → firebase-development-project-setup フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Firebase プロジェクトのセットアップ

概要

このサブスキルは、実績のあるアーキテクチャパターンを使用して、新しい Firebase プロジェクトを初期化する手順をガイドします。Firebase CLI のセットアップ、アーキテクチャの決定、エミュレータの構成、および初期プロジェクト構造を扱います。

主要な原則:

  • すべての関数に TypeScript を使用する
  • 最初からエミュレータを構成する
  • 早い段階でアーキテクチャパターンを選択する (hosting, auth, functions, security)
  • テストインフラストラクチャをすぐにセットアップする

このサブスキルが適用される場合

  • まったく新しい Firebase プロジェクトを開始する場合
  • リポジトリで Firebase を初めてセットアップする場合
  • ユーザーが「new firebase project」、「initialize firebase」、「firebase init」、「set up firebase」と言う場合

以下には使用しないでください:

  • 既存のプロジェクトに機能を追加する場合 → firebase-development:add-feature
  • 既存のセットアップをデバッグする場合 → firebase-development:debug

アーキテクチャの決定

AskUserQuestion を使用して、以下の4つの決定を事前に収集します。

1. Hosting の構成

  • Single Site - 1つの hosting サイト、シンプルなプロジェクト
  • Multiple Sites (site:) - 複数の独立した URL
  • Multiple with Builds (target:) - 事前デプロイフックを持つ複数のサイト

参考: docs/examples/multi-hosting-setup.md

2. 認証アプローチ

  • API Keys - MCP ツール、サーバー間、プログラムによるアクセス
  • Firebase Auth - ログイン UI を持つユーザー向けアプリ
  • Both - Web 用の Firebase Auth + ツール用の API keys

参考: docs/examples/api-key-authentication.md

3. Functions のアーキテクチャ

  • Express API - 多くの関連エンドポイント、ミドルウェアが必要、RESTful ルーティング
  • Domain Grouped - 明確な領域 (posts, admin) を持つ機能豊富なアプリ
  • Individual Files - 独立した関数、最大のモジュール性

参考: docs/examples/express-function-architecture.md

4. セキュリティモデル

  • Server-Write-Only (推奨) - Cloud Functions がすべての書き込みを処理する
  • Client-Write - 大量の書き込み、最速の UX が必要、複雑なルール

参考: docs/examples/firestore-rules-patterns.md

TodoWrite ワークフロー

以下の14のステップでチェックリストを作成します。

ステップ 1: Firebase CLI の確認

firebase --version  # インストールされていない場合は npm install -g firebase-tools でインストール
firebase login

ステップ 2: プロジェクトディレクトリの作成

mkdir my-firebase-project && cd my-firebase-project
git init && git branch -m main

.gitignore を作成し、以下を追加します: node_modules/, .env, .env.local, .firebase/, lib/, dist/

ステップ 3: Firebase Init の実行

firebase init

以下を選択: Firestore, Functions, Hosting, Emulators。functions に TypeScript を選択します。

ステップ 4: アーキテクチャの決定の収集

上記の4つの決定について AskUserQuestion を使用します。

ステップ 5: firebase.json の構成

hosting の決定に基づいてセットアップします。重要なエミュレータ設定:

{
  "emulators": {
    "singleProjectMode": true,
    "ui": { "enabled": true, "port": 4000 }
  }
}

参考: docs/examples/multi-hosting-setup.md

ステップ 6: Functions の構造のセットアップ

アーキテクチャの選択に基づきます:

Express: middleware/, tools/, services/, shared/ を作成 Domain-Grouped: shared/types/, shared/validators/ を作成 Individual: functions/ を作成

依存関係をインストール: express, cors, firebase-admin, firebase-functions, vitest, biome

ステップ 7: 初期 Functions コードの作成

functions/src/index.ts を ABOUTME コメント付きで作成します。Express パターンのヘルスチェックエンドポイントを含めます。

参考: docs/examples/express-function-architecture.md

ステップ 8: Firestore ルールの構成

セキュリティモデルの決定に基づきます。常に以下を含めます:

  • ヘルパー関数 (isAuthenticated(), isOwner())
  • 下部にデフォルトの拒否ルール

参考: docs/examples/firestore-rules-patterns.md

ステップ 9: テストのセットアップ

vitest.config.tsvitest.emulator.config.ts を作成します。__tests__/__tests__/emulator/ ディレクトリをセットアップします。

ステップ 10: Biome の構成

推奨ルールで biome.json を作成します。npm run lint:fix を実行します。

ステップ 11: 環境変数のセットアップ

.env.example テンプレートを作成します。.env にコピーして値を入力します。

hosting の場合: hosting/.env.localNEXT_PUBLIC_USE_EMULATORS=true で作成します。

ステップ 12: 初期の Git コミット

git add . && git commit -m "feat: initial Firebase project setup"

ステップ 13: エミュレータの起動

firebase emulators:start
open http://127.0.0.1:4000

すべてのサービスが起動することを確認します。Express を使用している場合は、ヘルスエンドポイントをテストします。

ステップ 14: 初期のテストの作成

基本的な検証で functions/src/__tests__/setup.test.ts を作成します。npm test を実行します。

検証チェックリスト

完了とマークする前に:

  • [ ] Firebase CLI がインストールされ、ログインしている
  • [ ] TypeScript functions がコンパイルされる: npm run build
  • [ ] すべてのテストに合格する: npm test
  • [ ] Linting に合格する: npm run lint
  • [ ] エミュレータがエラーなしで起動する
  • [ ] エミュレータ UI が http://127.0.0.1:4000 でアクセス可能
  • [ ] Git がコミットで初期化されている
  • [ ] .env ファイルが作成され、git で無視されている
  • [ ] すべてのファイルに ABOUTME コメントがある
  • [ ] アーキテクチャの決定が文書化されている

プロジェクト構造

Express API:

functions/src/
├── index.ts
├── middleware/apiKeyGuard.ts
├── tools/
├── services/
└── __tests__/

Domain-Grouped:

functions/src/
├── index.ts
├── posts.ts
├── users.ts
├── shared/types/
└── __tests__/

Individual Files:

functions/
├── functions/upload.ts
├── functions/process.ts
└── index.js

次のステップ

セットアップ完了後:

  1. 最初の機能を追加 → firebase-development:add-feature
  2. セットアップを確認 → firebase-development:validate
  3. 問題をデバッグ → firebase-development:debug

パターンの参考資料

  • Hosting: docs/examples/multi-hosting-setup.md
  • Auth: docs/examples/api-key-authentication.md
  • Functions: docs/examples/express-function-architecture.md
  • Rules: docs/examples/firestore-rules-patterns.md
  • Emulators: docs/examples/emulator-workflow.md
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Firebase Project Setup

Overview

This sub-skill guides initializing a new Firebase project with proven architecture patterns. It handles Firebase CLI setup, architecture decisions, emulator configuration, and initial project structure.

Key principles:

  • Use TypeScript for all functions
  • Configure emulators from the start
  • Choose architecture patterns early (hosting, auth, functions, security)
  • Set up testing infrastructure immediately

When This Sub-Skill Applies

  • Starting a brand new Firebase project
  • Setting up Firebase for the first time in a repository
  • User says: "new firebase project", "initialize firebase", "firebase init", "set up firebase"

Do not use for:

  • Adding features to existing projects → firebase-development:add-feature
  • Debugging existing setup → firebase-development:debug

Architecture Decisions

Use AskUserQuestion to gather these four decisions upfront:

1. Hosting Configuration

  • Single Site - One hosting site, simple project
  • Multiple Sites (site:) - Multiple independent URLs
  • Multiple with Builds (target:) - Multiple sites with predeploy hooks

Reference: docs/examples/multi-hosting-setup.md

2. Authentication Approach

  • API Keys - MCP tools, server-to-server, programmatic access
  • Firebase Auth - User-facing app with login UI
  • Both - Firebase Auth for web + API keys for tools

Reference: docs/examples/api-key-authentication.md

3. Functions Architecture

  • Express API - Many related endpoints, need middleware, RESTful routing
  • Domain Grouped - Feature-rich app with distinct areas (posts, admin)
  • Individual Files - Independent functions, maximum modularity

Reference: docs/examples/express-function-architecture.md

4. Security Model

  • Server-Write-Only (Preferred) - Cloud Functions handle all writes
  • Client-Write - High-volume writes, need fastest UX, complex rules

Reference: docs/examples/firestore-rules-patterns.md

TodoWrite Workflow

Create checklist with these 14 steps:

Step 1: Verify Firebase CLI

firebase --version  # Install via npm install -g firebase-tools if missing
firebase login

Step 2: Create Project Directory

mkdir my-firebase-project && cd my-firebase-project
git init && git branch -m main

Create .gitignore with: node_modules/, .env, .env.local, .firebase/, lib/, dist/

Step 3: Run Firebase Init

firebase init

Select: Firestore, Functions, Hosting, Emulators. Choose TypeScript for functions.

Step 4: Gather Architecture Decisions

Use AskUserQuestion for the four decisions above.

Step 5: Configure firebase.json

Set up based on hosting decision. Critical emulator settings:

{
  "emulators": {
    "singleProjectMode": true,
    "ui": { "enabled": true, "port": 4000 }
  }
}

Reference: docs/examples/multi-hosting-setup.md

Step 6: Set Up Functions Structure

Based on architecture choice:

Express: Create middleware/, tools/, services/, shared/ Domain-Grouped: Create shared/types/, shared/validators/ Individual: Create functions/

Install dependencies: express, cors, firebase-admin, firebase-functions, vitest, biome

Step 7: Create Initial Functions Code

Create functions/src/index.ts with ABOUTME comments. Include health check endpoint for Express pattern.

Reference: docs/examples/express-function-architecture.md

Step 8: Configure Firestore Rules

Based on security model decision. Always include:

  • Helper functions (isAuthenticated(), isOwner())
  • Default deny rule at bottom

Reference: docs/examples/firestore-rules-patterns.md

Step 9: Set Up Testing

Create vitest.config.ts and vitest.emulator.config.ts. Set up __tests__/ and __tests__/emulator/ directories.

Step 10: Configure Biome

Create biome.json with recommended rules. Run npm run lint:fix.

Step 11: Set Up Environment Variables

Create .env.example template. Copy to .env and fill in values.

For hosting: create hosting/.env.local with NEXT_PUBLIC_USE_EMULATORS=true.

Step 12: Initial Git Commit

git add . && git commit -m "feat: initial Firebase project setup"

Step 13: Start Emulators

firebase emulators:start
open http://127.0.0.1:4000

Verify all services start. Test health endpoint if using Express.

Step 14: Create Initial Tests

Create functions/src/__tests__/setup.test.ts with basic verification. Run npm test.

Verification Checklist

Before marking complete:

  • [ ] Firebase CLI installed and logged in
  • [ ] TypeScript functions compile: npm run build
  • [ ] All tests pass: npm test
  • [ ] Linting passes: npm run lint
  • [ ] Emulators start without errors
  • [ ] Emulator UI accessible at http://127.0.0.1:4000
  • [ ] Git initialized with commits
  • [ ] .env files created and gitignored
  • [ ] ABOUTME comments on all files
  • [ ] Architecture decisions documented

Project Structures

Express API:

functions/src/
├── index.ts
├── middleware/apiKeyGuard.ts
├── tools/
├── services/
└── __tests__/

Domain-Grouped:

functions/src/
├── index.ts
├── posts.ts
├── users.ts
├── shared/types/
└── __tests__/

Individual Files:

functions/
├── functions/upload.ts
├── functions/process.ts
└── index.js

Next Steps

After setup complete:

  1. Add first feature → firebase-development:add-feature
  2. Review setup → firebase-development:validate
  3. Debug issues → firebase-development:debug

Pattern References

  • Hosting: docs/examples/multi-hosting-setup.md
  • Auth: docs/examples/api-key-authentication.md
  • Functions: docs/examples/express-function-architecture.md
  • Rules: docs/examples/firestore-rules-patterns.md
  • Emulators: docs/examples/emulator-workflow.md