/major-ai-skills:firebasefrom major-ai-skills
Design Firebase Auth, Firestore Security Rules, Cloud Functions, and FCM with Emulator-first testing—close open rules, keep Admin SDK server-only, and avoid emulator-only index false confidence.
Ships in major-ai-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Firebase sits on a Google Cloud project: Auth, Firestore / Realtime Database, Storage, Cloud Functions, Hosting, and FCM. Client config is public; authorization is Security Rules + ID tokens, not obscurity. The Admin SDK bypasses Rules and must stay server-only. Agents write Rules first, test with the Emulator Suite, never set FIREBASE_AUTH_EMULATOR_HOST in production, and remember the Firestore emulator does not enforce composite indexes.
┌─────────────────────────────────────────────────────────────┐
│ Firebase client → data plane │
│ │
│ Client SDKs (web / iOS / Android / Flutter) │
│ ├── Public firebaseConfig (apiKey is not a secret) │
│ └── ID token → Auth │
│ │
│ Firestore / Storage │
│ ├── Security Rules (request.auth, resource.data, claims) │
│ └── Indexes required in prod (emulator may skip) │
│ │
│ Trusted server │
│ ├── Cloud Functions / your backend + Admin SDK │
│ ├── Custom claims (small; force token refresh) │
│ └── FCM (no full emulator — can hit real messaging) │
└─────────────────────────────────────────────────────────────┘
Use when
Do not use when
@supabase.@vercel / @nextjs.allow read, write: if true in production, embedding service-account JSON in apps, or inventing GCP keys → refuse.request.auth.uid, ownership fields, and validated request.resource.data shapes.request.auth.token.admin); keep claims small; after Admin SDK updates, client must re-auth or getIdToken(true).firebase.json. Omit protocols in FIREBASE_AUTH_EMULATOR_HOST / FIRESTORE_EMULATOR_HOST (127.0.0.1:9099).failed-precondition / index links in errors).firestore.rules:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
function signedIn() {
return request.auth != null;
}
function isOwner() {
return signedIn() && resource.data.ownerId == request.auth.uid;
}
function isAdmin() {
return signedIn() && request.auth.token.admin == true;
}
match /items/{itemId} {
allow read: if isOwner() || isAdmin();
allow create: if signedIn()
&& request.resource.data.ownerId == request.auth.uid
&& request.resource.data.keys().hasOnly(['ownerId', 'sku', 'qty', 'updatedAt'])
&& request.resource.data.qty is int
&& request.resource.data.qty >= 0;
allow update: if (isOwner() || isAdmin())
&& request.resource.data.ownerId == resource.data.ownerId;
allow delete: if isOwner() || isAdmin();
}
}
}
firebase.json (excerpt):
{
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"emulators": {
"auth": { "port": 9099 },
"firestore": { "port": 8080 },
"functions": { "port": 5001 },
"ui": { "enabled": true, "port": 4000 }
}
}
Local loop (never export emulator hosts into prod shells):
firebase login
firebase use staging
firebase emulators:start --only auth,firestore,functions
firebase deploy --only firestore:rules,firestore:indexes --project staging
# After Admin setCustomUserClaims: client getIdToken(true)
| Signature | Likely cause | Fix path |
|---|---|---|
| Open data / unexpected reads | allow … if true or missing ownership | Tighten Rules; Emulator Rules tests |
PERMISSION_DENIED after claim change | Stale ID token | getIdToken(true) or re-login |
failed-precondition / index required | Missing composite index (works in emulator) | Deploy index; test against real Firestore |
| Admin works in app binary | Service account or privileged API in client | Move to Functions/backend |
| Auth emulator tokens accepted in prod | FIREBASE_AUTH_EMULATOR_HOST set | Unset in prod; fail deploy if present |
| FCM send in “local” test hits real devices | No FCM emulator | Feature-flag; use test devices only |
| Cold start / region latency | Functions region far from users | Match region; prefer min instances only when justified |
| SHA / redirect errors (Auth) | Platform allowlist mismatch | Add SHA fingerprints / authorized domains |
get() costs (billed reads).contentType / size on writes.firestore.indexes.json and review in PR.@flutter / @react-native — common Firebase mobile clients@supabase — Postgres BaaS alternative@vercel — frontends that call Firebase APIs@gcloud-cli — underlying GCP IAM, billing, and Functions opsMANDATORY: Treat client Firebase config as public. Enforce access in Security Rules and server Admin SDK only. Never commit service accounts or leave open Rules. Test Rules in emulators, but validate composite indexes against a real project. Never set
FIREBASE_AUTH_EMULATOR_HOSTin production.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub alivirgo/major-ai-skills --plugin major-ai-skills412 skills in this plugin
/3d-slicerAutomate 3D Slicer research workflows with MRML, VTK/ITK, DICOM data, and Segment Editor. Use for software workflows, not clinical interpretation./abbreviated-git-statusInspect Git branch, staging, and working-tree changes with short or porcelain status output when a compact repository check is needed./ableton-liveAutomate Ableton Live sessions with Python MIDI Remote Scripts, Max for Live, AbletonOSC, and Link synchronization./act-as-a-personal-tutorExplain a subject step by step, assess prior knowledge, and use short exercises to check understanding before advancing.Other plugins' skills for the same job