by 2389-research
启动新的 Firebase 项目涉及许多影响长期可维护性的架构决策。本技能将指导您完成 CLI 设置、架构模式以及仿真器配置,并分享生产环境部署中经过验证的最佳实践。
1. 打开 Claude 聊天界面
2. 点击下方 "📋 复制" 按钮
3. 粘贴到 Claude 聊天框中并发送
4. 输入 "使用 firebase-development-project-setup 技能" 开始使用
=== firebase-development-project-setup 技能 === 作者: 2389-research 描述: 启动新的 Firebase 项目涉及许多影响长期可维护性的架构决策。本技能将指导您完成 CLI 设置、架构模式以及仿真器配置,并分享生产环境部署中经过验证的最佳实践。 使用方法: 1. 调用技能: "使用 firebase-development-project-setup 技能" 2. 提供相关信息: 根据技能要求提供必要参数 3. 查看结果: 技能会返回处理结果 示例: "使用 firebase-development-project-setup 技能,帮我分析一下这段代码"
这种方法适用于所有 Claude 用户,不需要安装额外工具。
coding
safe
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:
Do not use for:
firebase-development:add-featurefirebase-development:debugUse AskUserQuestion to gather these four decisions upfront:
Reference: docs/examples/multi-hosting-setup.md
Reference: docs/examples/api-key-authentication.md
Reference: docs/examples/express-function-architecture.md
Reference: docs/examples/firestore-rules-patterns.md
Create checklist with these 14 steps:
firebase --version # Install via npm install -g firebase-tools if missing
firebase login
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/
firebase init
Select: Firestore, Functions, Hosting, Emulators. Choose TypeScript for functions.
Use AskUserQuestion for the four decisions above.
Set up based on hosting decision. Critical emulator settings:
{
"emulators": {
"singleProjectMode": true,
"ui": { "enabled": true, "port": 4000 }
}
}
Reference: docs/examples/multi-hosting-setup.md
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
Create functions/src/index.ts with ABOUTME comments. Include health check endpoint for Express pattern.
Reference: docs/examples/express-function-architecture.md
Based on security model decision. Always include:
isAuthenticated(), isOwner())Reference: docs/examples/firestore-rules-patterns.md
Create vitest.config.ts and vitest.emulator.config.ts. Set up __tests__/ and __tests__/emulator/ directories.
Create biome.json with recommended rules. Run npm run lint:fix.
Create .env.example template. Copy to .env and fill in values.
For hosting: create hosting/.env.local with NEXT_PUBLIC_USE_EMULATORS=true.
git add . && git commit -m "feat: initial Firebase project setup"
firebase emulators:start
open http://127.0.0.1:4000
Verify all services start. Test health endpoint if using Express.
Create functions/src/__tests__/setup.test.ts with basic verification. Run npm test.
Before marking complete:
npm run buildnpm testnpm run lint.env files created and gitignoredExpress 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
After setup complete:
firebase-development:add-featurefirebase-development:validatefirebase-development:debugdocs/examples/multi-hosting-setup.mddocs/examples/api-key-authentication.mddocs/examples/express-function-architecture.mddocs/examples/firestore-rules-patterns.mddocs/examples/emulator-workflow.mdView Count
0
Download Count
0
Favorite Count
0
Quality Score
70