<< All versions
Skill v1.0.0
currentAutomated scan100/100raidan-ai/opencode-settings/firebase
──Details
PublishedNovember 27, 2026 at 05:38 AM
Content Hashsha256:8b051021c19b3672...
Git SHAb189b968031c
──Files
Files (1 file, 7.8 KB)
SKILL.md7.8 KBactive
SKILL.md · 202 lines · 7.8 KB
name: firebase description: Firebase development on Google's app platform. Covers Firebase CLI, Authentication, Cloud Firestore, Cloud Storage, Cloud Functions, Hosting, Security Rules, and the Emulator Suite, plus the Firebase MCP server. Activate for any Firebase project, auth, database, storage, functions, or hosting task. metadata: version: "1.0.0"
Firebase Skill
Purpose
Provides Firebase development capabilities across Authentication, Cloud Firestore (+ SQL Connect), Cloud Storage, Cloud Functions, Hosting, Security Rules, and the Emulator Suite for local development. Enables building and operating full-stack apps using the Firebase CLI and the official Firebase MCP server.
When to Activate
- Setting up or managing Firebase projects
- Implementing Firebase Authentication (email, OAuth providers, anonymous, custom tokens)
- Modeling and querying data in Cloud Firestore
- Managing Cloud Storage buckets and files, including security rules
- Deploying and debugging Cloud Functions (v1/v2)
- Deploying web apps to Firebase Hosting or App Hosting
- Writing and testing Security Rules
- Running the Emulator Suite for local development and automated tests
- Using the Firebase MCP server for agent-assisted project/data work
Core Knowledge
Firebase MCP Server (verified official)
- Ships in the Firebase CLI — not a separate package.
- Command:
npx -y firebase-tools@latest mcp(stdio) - Docs: https://firebase.google.com/docs/cli/mcp-server · Source: firebase/firebase-tools
src/mcp - Auth: same credentials as the Firebase CLI — logged-in user (
firebase login) or Application Default Credentials (ADC). No separate API key. - Options:
--dir ABSOLUTE_DIR_PATH— absolute path of the dir containingfirebase.jsonto set project context (if omitted,get_project_directory/set_project_directorytools are offered).--only FEATURE_1,FEATURE_2— limit exposed tools, e.g.--only auth,firestore,storage.
jsonc
"firebase-mcp": {"type": "local","command": ["npx", "-y", "firebase-tools@latest", "mcp"],"enabled": false}
- Start with
"enabled": false; flight-check in a live session before enabling. - Firebase agent skills can be installed alongside to teach models how to use MCP tools effectively.
Firebase CLI
bash
firebase --versionfirebase login # authenticate (browser)firebase login:ci # generate a refresh token for CI (use as secret)firebase use --add # select/add project aliasfirebase init # scaffold (choose features)firebase deploy # deploy selected featuresfirebase serve # local preview (hosting/functions)firebase emulators:start # run emulator suite
Core Services
- Authentication: email/password, OAuth providers (Google, GitHub, etc.), phone, anonymous, custom tokens, sign-in links.
- Cloud Firestore: NoSQL document DB, real-time sync, subcollections, queries, transactions, offline persistence; plus SQL Connect for relational data.
- Cloud Storage: object/file storage for images, media, user uploads; governed by Security Rules.
- Cloud Functions: v1 (Node) / v2 (Cloud Run-based) event-driven + HTTPS functions.
- Hosting: static + SSR hosting, rich rewrites, headers, redirects.
- Security Rules: declarative access control for Firestore + Storage.
Security Rules (example — Firestore)
rules_version = '2';service cloud.firestore {match /databases/{database}/documents {match /users/{uid} {allow read, write: if request.auth != null && request.auth.uid == uid;}match /posts/{id} {allow read: if true;allow create: if request.auth != null;allow update, delete: if resource.data.uid == request.auth.uid;}}}
Emulator Suite
bash
firebase emulators:start # all emulatorsfirebase emulators:start --only firestore,authfirebase emulators:exec "npm test" # run tests against emulators# Uses Firestore/Storage emulator + Auth emulator; no cloud cost or side effects.
Workflow
- Authenticate:
firebase login(interactive) orfirebase login:ci(CI token). - Init:
firebase initto scaffold features and generatefirebase.json+.firebaserc. - Develop locally with the Emulator Suite to iterate without cloud cost or data side effects.
- Model data: design Firestore collections/subcollections with security rules in mind (deny by default, then allow).
- Test security rules using the rules emulator (
@firebase/rules-unit-testingorfirebase emulators:exec). - Deploy with
firebase deployscoped to the changed features (--only functions,hosting). - Verify: exercise the deployed endpoints, check Functions logs, confirm Security Rules enforce access.
- Monitor: use Firebase console + Cloud functions logs; enable error tracking.
Tools
bash
firebase login / login:cifirebase init / use / projects:listfirebase deploy [--only functions,hosting,firestore:rules,storage]firebase serve / emulators:startfirebase firestore:indexesfirebase functions:log / functions:shellnpx -y firebase-tools@latest mcp # MCP (stdio)
MCP Requirements
- Local server:
npx -y firebase-tools@latest mcp, stdio. - Optional args:
--dir <abs path>,--only auth,firestore,storage. - Auth = existing CLI/ADC credentials; no API key.
Best Practices
- Deny-by-default Security Rules; grant the minimum access pattern (
read/write/create/update/deletegranularity). - Validate all rules against the emulator before deploying to production.
- Use the Emulator Suite for local dev and CI tests; isolate test projects in CI.
- Keep Functions small and idempotent (event handlers may be retried).
- Use
--onlytargeting to limit deploys and blast radius. - Store secrets (API keys, tokens) in environment config / Secret Manager, never in source.
- Set
firebase.jsonignored project aliases; keep.firebaserccommitted for team consistency. - Enable App Check for production auth to protect your backend resources.
Anti-patterns
- ❌ Committing
.firebaselocal state, service-account JSON keys, orlogin:citokens to git. - ❌ Writing permissive rules like
allow read, write: if truefor real user data. - ❌ Developing/deploying directly against production without emulators or staging.
- ❌ Deploying untested Security Rules that lock users out or expose data.
- ❌ Keeping large binary files in Firestore instead of Cloud Storage.
- ❌ Ignoring Security Rules for Storage (files left publicly readable/writable).
- ❌ Hardcoding project config or secrets array in app code.
Verification
bash
# CLI authenticated + project selectedfirebase login:listfirebase projects:listfirebase use <project># List current rules / indexesfirebase firestore:indexes# Check function logsfirebase functions:log --open# Emulator parity: start suite, run rule tests, confirm no rule violationsfirebase emulators:exec "npm test"
- Before/after changing Security Rules, run
firebase emulators:exec "npm test"to prove allow/deny behavior. - After deploys, exercise read/write paths for both authenticated and anonymous/unauthenticated users in the console.
Examples
Initialize a new project
bash
firebase loginfirebase init# Select: Hosting, Firestore, Functions, Storage, Emulatorsfirebase use --add
Run Firestore rules tests against the emulator
bash
firebase emulators:exec "npm test" --only firestore
Deploy only what changed
bash
firebase deploy --only functions:onUserCreatedfirebase deploy --only hostingfirebase deploy --only firestore:rules
Deploy a backend for a web app
bash
firebase init hostingfirebase loginfirebase deploy --only hosting# Visit the Hosting URL and verify the site + rewrites to Functions work.