Token导航 LogoToken导航

Agent Skill · 开发

firebase(Firebase 安全)

firebase 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

firebase 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证为 MIT,第三方扫描已通过,按安装量在开发类的 21,746 个 Skill 里排第 1,531。

总安装 27,456周安装 1,103GitHub Stars 35,668下载 8,888核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:firebase(Firebase 安全)
来源仓库:https://github.com/sickn33/antigravity-awesome-skills
仓库路径:skills/firebase
安装命令:
npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill firebase
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill firebase

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

Firebase 后端设置以及有关身份验证、数据库、存储和功能的安全第一指南。

涵盖九项 Firebase 服务:身份验证、Firestore、实时数据库、云功能、存储、托管、安全规则、管理 SDK 和本地模拟器 强调安全规则设计、查询模式的数据建模和模块化 SDK 导入,以避免常见陷阱 强调要避免的反模式:缺少安全规则、客户端管理操作以及导致成本超支的大型集合的侦听器 与 Next.js、React、OAuth 和 Stripe 工作流程完美集成

来源仓库内路径:skills/firebase

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill fir…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

firebase 怎么安装?

在终端执行 npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill firebase。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

firebase 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

firebase 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

firebase 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

firebase 用的人多吗?

公开数据是累计安装 27,456 次,近一周安装 1,103 次,下载 8,888 次,GitHub 35,668 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

firebase 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
skill-vetter

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
firebase

Firebase 安全 · 本页

27,45635,668需要联网MIT通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Firebase

Firebase gives you a complete backend in minutes - auth, database, storage, functions, hosting. But the ease of setup hides real complexity. Security rules are your last line of defense, and they're often wrong. Firestore queries are limited, and you learn this after you've designed your data model.

This skill covers Firebase Authentication, Firestore, Realtime Database, Cloud Functions, Cloud Storage, and Firebase Hosting. Key insight: Firebase is optimized for read-heavy, denormalized data. If you're thinking relationally, you're thinking wrong.

2025 lesson: Firestore pricing can surprise you. Reads are cheap until they're not. A poorly designed listener can cost more than a dedicated database. Plan your data model for your query patterns, not your data relationships.

Principles

  • Design data for queries, not relationships
  • Security rules are mandatory, not optional
  • Denormalize aggressively - duplication is cheap, joins are expensive
  • Batch writes and transactions for consistency
  • Use offline persistence wisely - it's not free
  • Cloud Functions for what clients shouldn't do
  • Environment-based config, never hardcode keys in client

Capabilities

  • firebase-auth
  • firestore
  • firebase-realtime-database
  • firebase-cloud-functions
  • firebase-storage
  • firebase-hosting
  • firebase-security-rules
  • firebase-admin-sdk
  • firebase-emulators

Scope

  • general-backend-architecture -> backend
  • payment-processing -> stripe
  • email-sending -> email
  • advanced-auth-flows -> authentication-oauth
  • kubernetes-deployment -> devops

Tooling

Core

  • firebase - When: Client-side SDK Note: Modular SDK - tree-shakeable
  • firebase-admin - When: Server-side / Cloud Functions Note: Full access, bypasses security rules
  • firebase-functions - When: Cloud Functions v2 Note: v2 functions are recommended

Testing

  • @firebase/rules-unit-testing - When: Testing security rules Note: Essential - rules bugs are security bugs
  • firebase-tools - When: Emulator suite Note: Local development without hitting production

Frameworks

  • reactfire - When: React + Firebase Note: Hooks-based, handles subscriptions
  • vuefire - When: Vue + Firebase Note: Vue-specific bindings
  • angularfire - When: Angular + Firebase Note: Official Angular bindings

Patterns

Modular SDK Import

Import only what you need for smaller bundles

When to use: Client-side Firebase usage

MODULAR IMPORTS:

""" Firebase v9+ uses modular SDK. Import only what you need. This enables tree-shaking and smaller bundles. """

// WRONG: v8-compat style (larger bundle) import firebase from 'firebase/compat/app'; import 'firebase/compat/firestore'; const db = firebase.firestore();

// RIGHT: v9+ modular (tree-shakeable) import {initializeApp} from 'firebase/app'; import {getFirestore, collection, doc, getDoc} from 'firebase/firestore';

const app = initializeApp(firebaseConfig); const db = getFirestore(app);

// Get a document const docRef = doc(db, 'users', 'userId'); const docSnap = await getDoc(docRef);

if (docSnap.exists()) {console.log(docSnap.data());}

// Query with constraints import {query, where, orderBy, limit} from 'firebase/firestore';

const q = query(collection(db, 'posts'), where('published', '==', true), orderBy('createdAt', 'desc'), limit(10));

Security Rules Design

Secure your data with proper rules from day one

When to use: Any Firestore database

FIRESTORE SECURITY RULES:

""" Rules are your last line of defense. Every read and write goes through them. Get them wrong, and your data is exposed. """

rules_version = '2'; service cloud.firestore {match /databases/{database}/documents {

// Helper functions
function isSignedIn() {
  return request.auth != null;
}

function isOwner(userId) {
  return request.auth.uid == userId;
}

function isAdmin() {
  return request.auth.token.admin == true;
}

// Users collection
match /users/{userId} {
  // Anyone can read public profile
  allow read: if true;

  // Only owner can write their own data
  allow write: if isOwner(userId);

  // Private subcollection
  match /private/{document=**} {
    allow read, write: if isOwner(userId);
  }
}

// Posts collection
match /posts/{postId} {
  // Anyone can read published posts
  allow read: if resource.data.published == true
              || isOwner(resource.data.authorId);

  // Only authenticated users can create
  allow create: if isSignedIn()
                && request.resource.data.authorId == request.auth.uid;

  // Only author can update/delete
  allow update, delete: if isOwner(resource.data.authorId);
}

// Admin-only collection
match /admin/{document=**} {
  allow read, write: if isAdmin();
}

}}

Data Modeling for Queries

Design Firestore data structure around query patterns

When to use: Designing Firestore schema

FIRESTORE DATA MODELING:

""" Firestore is NOT relational. You can't JOIN. Design your data for how you'll QUERY it, not how it relates. """

// WRONG: Normalized (SQL thinking) // users/{userId} // posts/{postId} with authorId field // To get "posts by user" - need to query posts collection

// RIGHT: Denormalized for queries // users/{userId}/posts/{postId} - subcollection // OR // posts/{postId} with embedded author data

// Document structure for a post const post = {id: 'post123', title: 'My Post', content: '...',

// Embed frequently-needed author data author: {id: 'user456', name: 'Jane Doe', avatarUrl: '...'},

// Arrays for IN queries (max 30 items for 'in') tags: ['javascript', 'firebase'],

// Maps for compound queries stats: {likes: 42, comments: 7, views: 1000},

// Timestamps createdAt: serverTimestamp(), updatedAt: serverTimestamp(),

// Booleans for filtering published: true, featured: false};

// Query patterns this enables: // - Get post with author info: 1 read (no join needed) // - Posts by tag: where('tags', 'array-contains', 'javascript') // - Featured posts: where('featured', '==', true) // - Recent posts: orderBy('createdAt', 'desc')

// When author updates their name, update all their posts // This is the tradeoff: writes are more complex, reads are fast

Real-time Listeners

Subscribe to data changes with proper cleanup

When to use: Real-time features

REAL-TIME LISTENERS:

""" onSnapshot creates a persistent connection. Always unsubscribe when component unmounts to prevent memory leaks and extra reads. """

// React hook for real-time document function useDocument(path) {const [data, setData] = useState(null); const [loading, setLoading] = useState(true); const [error, setError] = useState(null);

useEffect(() => {const docRef = doc(db, path);

// Subscribe to document
const unsubscribe = onSnapshot(
  docRef,
  (snapshot) => {
    if (snapshot.exists()) {
      setData({ id: snapshot.id, ...snapshot.data() });
    } else {
      setData(null);
    }
    setLoading(false);
  },
  (err) => {
    setError(err);
    setLoading(false);
  }
);

// Cleanup on unmount
return () => unsubscribe();

}, [path]);

return {data, loading, error};}

// Usage function UserProfile({userId}) {const {data: user, loading} = useDocument(users/${userId});

if (loading) return; return {user?.name};}

// Collection with query function usePosts(limit = 10) {const [posts, setPosts] = useState([]);

useEffect(() => {const q = query(collection(db, 'posts'), where('published', '==', true), orderBy('createdAt', 'desc'), limit(limit));

const unsubscribe = onSnapshot(q, (snapshot) => {
  const results = snapshot.docs.map(doc => ({
    id: doc.id,
    ...doc.data()
  }));
  setPosts(results);
});

return () => unsubscribe();

}, [limit]);

return posts;}

Cloud Functions Patterns

Server-side logic with Cloud Functions v2

When to use: Backend logic, triggers, scheduled tasks

CLOUD FUNCTIONS V2:

""" Cloud Functions run server-side code triggered by events. V2 uses more standard Node.js patterns and better scaling. """

import {onRequest} from 'firebase-functions/v2/https'; import {onDocumentCreated} from 'firebase-functions/v2/firestore'; import {onSchedule} from 'firebase-functions/v2/scheduler'; import {getFirestore} from 'firebase-admin/firestore'; import {initializeApp} from 'firebase-admin/app';

initializeApp(); const db = getFirestore();

// HTTP function export const api = onRequest({cors: true, region: 'us-central1'}, async (req, res) => {// Verify auth token const token = req.headers.authorization?.split('Bearer ')[1]; if (!token) {res.status(401).json({error: 'Unauthorized'}); return;}

try {
  const decoded = await getAuth().verifyIdToken(token);
  // Process request with decoded.uid
  res.json({ userId: decoded.uid });
} catch (error) {
  res.status(401).json({ error: 'Invalid token' });
}

});

// Firestore trigger - on document create export const onUserCreated = onDocumentCreated('users/{userId}', async (event) => {const snapshot = event.data; const userId = event.params.userId;

if (!snapshot) return;

const userData = snapshot.data();

// Send welcome email, create related documents, etc.
await db.collection('notifications').add({
  userId,
  type: 'welcome',
  message: `Welcome, ${userData.name}!`,
  createdAt: FieldValue.serverTimestamp()
});

});

// Scheduled function (every day at midnight) export const dailyCleanup = onSchedule({schedule: '0 0 * * *', timeZone: 'UTC'}, async (event) => {const cutoff = new Date(); cutoff.setDate(cutoff.getDate() - 30);

// Delete old documents
const oldDocs = await db.collection('logs')
  .where('createdAt', '<', cutoff)
  .limit(500)
  .get();

const batch = db.batch();
oldDocs.docs.forEach(doc => batch.delete(doc.ref));
await batch.commit();

console.log(`Deleted ${oldDocs.size} old logs`);

});

Batch Operations

Atomic writes and transactions for consistency

When to use: Multiple document updates that must succeed together

BATCH WRITES AND TRANSACTIONS:

""" Batches: Multiple writes that all succeed or all fail. Transactions: Read-then-write operations with consistency. Max 500 operations per batch/transaction. """

import {writeBatch, runTransaction, doc, getDoc, increment, serverTimestamp} from 'firebase/firestore';

// Batch write - no reads, just writes async function createPostWithTags(post, tags) {const batch = writeBatch(db);

// Create post const postRef = doc(collection(db, 'posts')); batch.set(postRef, {...post, createdAt: serverTimestamp()});

// Update tag counts for (const tag of tags) {const tagRef = doc(db, 'tags', tag); batch.set(tagRef, {count: increment(1), lastUsed: serverTimestamp()}, {merge: true});}

await batch.commit(); return postRef.id;}

// Transaction - read and write atomically async function likePost(postId, userId) {return runTransaction(db, async (transaction) => {const postRef = doc(db, 'posts', postId); const likeRef = doc(db, 'posts', postId, 'likes', userId);

const postSnap = await transaction.get(postRef);
if (!postSnap.exists()) {
  throw new Error('Post not found');
}

const likeSnap = await transaction.get(likeRef);
if (likeSnap.exists()) {
  throw new Error('Already liked');
}

// Increment like count and add like document
transaction.update(postRef, {
  likeCount: increment(1)
});

transaction.set(likeRef, {
  userId,
  createdAt: serverTimestamp()
});

return postSnap.data().likeCount + 1;

});}

Social Login (Google, GitHub, etc.)

OAuth provider setup and authentication flows

When to use: Social login implementation

SOCIAL LOGIN WITH FIREBASE AUTH

import {getAuth, signInWithPopup, signInWithRedirect, GoogleAuthProvider, GithubAuthProvider, OAuthProvider} from "firebase/auth";

const auth = getAuth();

// GOOGLE const googleProvider = new GoogleAuthProvider(); googleProvider.addScope("email"); googleProvider.setCustomParameters({prompt: "select_account"});

async function signInWithGoogle() {try {const result = await signInWithPopup(auth, googleProvider); return result.user;} catch (error) {if (error.code === "auth/account-exists-with-different-credential") {return handleAccountConflict(error);} throw error;}}

// GITHUB const githubProvider = new GithubAuthProvider(); githubProvider.addScope("read:user");

// APPLE (Required for iOS apps!) const appleProvider = new OAuthProvider("apple.com"); appleProvider.addScope("email"); appleProvider.addScope("name");

Popup vs Redirect Auth

When to use popup vs redirect for OAuth

When to use: Choosing authentication flow

Popup: Desktop, SPA (simpler, can be blocked)

Redirect: Mobile, iOS Safari (always works)

async function signIn(provider) {if (/iPhone|iPad|Android/i.test(navigator.userAgent)) {return signInWithRedirect(auth, provider);} try {return await signInWithPopup(auth, provider);} catch (e) {if (e.code === "auth/popup-blocked") {return signInWithRedirect(auth, provider);} throw e;}}

// Check redirect result on page load useEffect(() => {getRedirectResult(auth).then(r => r && setUser(r.user));}, []);

Account Linking

Link multiple providers to one account

When to use: User has accounts with different providers

import {fetchSignInMethodsForEmail, linkWithCredential} from "firebase/auth";

async function handleAccountConflict(error) {const email = error.customData?.email; const pendingCred = OAuthProvider.credentialFromError(error); const methods = await fetchSignInMethodsForEmail(auth, email);

if (methods.includes("google.com")) {alert("Sign in with Google to link accounts"); const result = await signInWithPopup(auth, new GoogleAuthProvider()); await linkWithCredential(result.user, pendingCred); return result.user;}}

// Link new provider await linkWithPopup(auth.currentUser, new GithubAuthProvider());

// Unlink provider (keep at least one!) await unlink(auth.currentUser, "github.com");

Auth State Persistence

Control session lifetime

When to use: Managing user sessions

import {setPersistence, browserLocalPersistence, browserSessionPersistence} from "firebase/auth";

// LOCAL: survives browser close (default) // SESSION: cleared on tab close

async function signInWithRememberMe(email, pass, remember) {await setPersistence(auth, remember? browserLocalPersistence: browserSessionPersistence); return signInWithEmailAndPassword(auth, email, pass);}

// React auth hook function useAuth() {const [user, setUser] = useState(null); const [loading, setLoading] = useState(true); useEffect(() => onAuthStateChanged(auth, u => {setUser(u); setLoading(false);}), []); return {user, loading};}

Email Verification and Password Reset

Complete email auth flow

When to use: Email/password authentication

import {sendEmailVerification, sendPasswordResetEmail, reauthenticateWithCredential} from "firebase/auth";

// Sign up with verification async function signUp(email, password) {const result = await createUserWithEmailAndPassword(auth, email, password); await sendEmailVerification(result.user); return result.user;}

// Password reset await sendPasswordResetEmail(auth, email);

// Change password (requires recent auth) const cred = EmailAuthProvider.credential(user.email, currentPass); await reauthenticateWithCredential(user, cred); await updatePassword(user, newPass);

Token Management for APIs

Handle ID tokens for backend calls

When to use: Authenticating with backend APIs

import {getIdToken, onIdTokenChanged} from "firebase/auth";

// Get token (auto-refreshes if expired) const token = await getIdToken(auth.currentUser);

// API helper with auto-retry async function apiCall(url, opts = {}) {const token = await getIdToken(auth.currentUser); const res = await fetch(url, {...opts, headers: {...opts.headers, Authorization: "Bearer " + token}}); if (res.status === 401) {const newToken = await getIdToken(auth.currentUser, true); return fetch(url, {...opts, headers: {...opts.headers, Authorization: "Bearer " + newToken}});} return res;}

// Sync to cookie for SSR onIdTokenChanged(auth, async u => {document.cookie = u? "__session=" + await u.getIdToken(): "__session=; max-age=0";});

// Check admin claim const {claims} = await auth.currentUser.getIdTokenResult(); const isAdmin = claims.admin === true;

Collaboration

Delegation Triggers

  • user needs complex OAuth flow -> authentication-oauth (Firebase Auth handles basics, complex flows need OAuth skill)
  • user needs payment integration -> stripe (Firebase + Stripe common pattern)
  • user needs email functionality -> email (Firebase doesn't include email - use SendGrid, Resend, etc.)
  • user needs container deployment -> devops (Beyond Firebase Hosting - Kubernetes, Docker)
  • user needs relational data model -> postgres-wizard (Firestore is wrong choice for highly relational data)
  • user needs full-text search -> elasticsearch-search (Firestore doesn't support full-text search - use Algolia/Elastic)

Related Skills

Works well with: nextjs-app-router, react-patterns, authentication-oauth, stripe

When to Use

  • User mentions or implies: firebase
  • User mentions or implies: firestore
  • User mentions or implies: firebase auth
  • User mentions or implies: cloud functions
  • User mentions or implies: firebase storage
  • User mentions or implies: realtime database
  • User mentions or implies: firebase hosting
  • User mentions or implies: firebase emulator
  • User mentions or implies: security rules
  • User mentions or implies: firebase admin

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.

平台分布

Claude Code

27.18%
按下载量换算2,416

Antigravity

20.53%
按下载量换算1,825

Gemini CLI

18.83%
按下载量换算1,674

OpenCode

13.22%
按下载量换算1,175

Cursor

8.21%
按下载量换算730

Codex

3.71%
按下载量换算330

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

继续浏览同类 Skills