Builds Firebase backends for web/mobile apps: Auth, Firestore, Cloud Functions, Storage, Hosting. Covers data modeling, security rules, real-time listeners, batch writes, transactions, and social login.
Ships in 10-platform. 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.
None: SKILL.md is the whole skill.
不该用(负边界,应转交其他技能):
核心心智:Firebase 易上手但隐藏复杂度。安全规则是最后一道防线,且经常写错;按「查询模式」而非「数据关系」设计模型。Firestore 计费会反咬你——读操作便宜直到不便宜,一个糟糕的监听器可能比专用数据库更贵。
firebase(v9+,可 tree-shaking);服务端/云函数用 firebase-admin(全权限,绕过安全规则)。云函数用 firebase-functions v2。@firebase/rules-unit-testing 做单测(规则 bug 就是安全漏洞)。onSnapshot,组件卸载时务必 unsubscribe。firebase-tools 的 Emulator Suite,避免打到生产环境。import { getFirestore, doc, getDoc } from 'firebase/firestore',禁用 firebase/compat/*。in / array-contains-any 查询最多 30 个值;batch/transaction 最多 500 个操作。onSnapshot 都要保存返回的 unsubscribe 并在清理时调用。安全规则(Firestore,rules_version '2',最后一道防线):
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
function isSignedIn() { return request.auth != null; }
function isOwner(userId) { return request.auth.uid == userId; }
function isAdmin() { return request.auth.token.admin == true; }
match /users/{userId} {
allow read: if true;
allow write: if isOwner(userId);
match /private/{document=**} { allow read, write: if isOwner(userId); }
}
match /posts/{postId} {
allow read: if resource.data.published == true
|| isOwner(resource.data.authorId);
allow create: if isSignedIn()
&& request.resource.data.authorId == request.auth.uid;
allow update, delete: if isOwner(resource.data.authorId);
}
match /admin/{document=**} { allow read, write: if isAdmin(); }
}
}
面向查询的数据建模(内嵌作者信息,1 次读取无需 JOIN):
const post = {
title: 'My Post', content: '...',
author: { id: 'user456', name: 'Jane Doe', avatarUrl: '...' }, // 内嵌常用字段
tags: ['javascript', 'firebase'], // array-contains 查询
stats: { likes: 42, comments: 7 },
createdAt: serverTimestamp(),
published: true, featured: false // 布尔位用于过滤
};
// 代价:作者改名要更新其所有 post —— 写复杂、读快
实时监听 + 清理(React Hook):
useEffect(() => {
const unsubscribe = onSnapshot(doc(db, path), (snap) => {
setData(snap.exists() ? { id: snap.id, ...snap.data() } : null);
}, (err) => setError(err));
return () => unsubscribe(); // 卸载时解绑,防内存泄漏与多余读取
}, [path]);
事务(先读后写,保证一致性,如点赞计数):
import { runTransaction, increment, serverTimestamp } from 'firebase/firestore';
await runTransaction(db, async (tx) => {
const postRef = doc(db, 'posts', postId);
const likeRef = doc(db, 'posts', postId, 'likes', userId);
const postSnap = await tx.get(postRef);
if (!postSnap.exists()) throw new Error('Post not found');
if ((await tx.get(likeRef)).exists()) throw new Error('Already liked');
tx.update(postRef, { likeCount: increment(1) });
tx.set(likeRef, { userId, createdAt: serverTimestamp() });
});
云函数 v2(HTTP 验证 Token / Firestore 触发器 / 定时任务):
import { onRequest } from 'firebase-functions/v2/https';
import { onDocumentCreated } from 'firebase-functions/v2/firestore';
import { onSchedule } from 'firebase-functions/v2/scheduler';
export const api = onRequest({ cors: true, region: 'us-central1' }, async (req, res) => {
const token = req.headers.authorization?.split('Bearer ')[1];
if (!token) return res.status(401).json({ error: 'Unauthorized' });
const decoded = await getAuth().verifyIdToken(token);
res.json({ userId: decoded.uid });
});
export const onUserCreated = onDocumentCreated('users/{userId}', async (event) => {
if (!event.data) return;
await db.collection('notifications').add({ userId: event.params.userId, type: 'welcome' });
});
export const dailyCleanup = onSchedule({ schedule: '0 0 * * *', timeZone: 'UTC' }, async () => {
// batch 删除 30 天前日志,单批 ≤500
});
社交登录(弹窗 vs 重定向:桌面用 popup,移动/iOS Safari 用 redirect):
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;
}
}
// 账号冲突 auth/account-exists-with-different-credential 时,用 linkWithCredential 关联
Token 管理(后端 API 调用,自动刷新 + 401 重试):
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 fresh = await getIdToken(auth.currentUser, true); // 强制刷新
return fetch(url, { ...opts, headers: { ...opts.headers, Authorization: 'Bearer ' + fresh } });
}
return res;
}
firebase-admin 绕过安全规则,只在受信任的服务端使用。new OAuthProvider('apple.com'))。browserLocalPersistence(默认,关浏览器仍在)vs browserSessionPersistence(关标签页即清)。采编自 sickn33/antigravity-awesome-skills(MIT)。
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
firebase-backend, firestore, security-rules, real-time-data, social-login, baas
66 skills in this plugin
/agentmail-email-infra当 AI 智能体需要真实邮箱完成注册/验证码/事务通信时使用;通过 AgentMail REST API 开通账号、收发邮件、注册 Webhook、查询 karma 余额并产出可执行调用;不适用于自建/企业 SMTP/IMAP 或个人邮箱代收。触发词:AgentMail、智能体邮箱、theagentmail.net/agentphone-voice-sms-agents当需要给 AI 代理配备电话号码、发起/接听语音通话、收发短信、查看通话转写或配置 Webhook 时使用;调用 AgentPhone REST API(base=https://api.agentphone.to/v1)完成代理/号码/通话/短信/Webhook/用量的全生命周期管理,产出可直接执行的 curl 与 Webhook 处理代码;不适用于自建 Twilio/SIP/STUN 等底层电信栈或非 AgentPhone 平台。触发词:电话代理、语音通话、短信、号码、Webhook、转写。/ai-native-cli-design当设计/改造供 AI 智能体调用的命令行工具时使用;按 core/recommended/ecosystem 三层产出 JSON 优先、可校验的 CLI 契约(默认 JSON、结构化错误、退出码、护栏、agent/ 目录与自描述);不适用于纯人类交互 CLI、GUI 或库 API 设计;触发词:agent CLI、AI 友好命令行、CLI JSON 输出、退出码规范、agent/ 目录/amazon-alexa-skill-builder当需要用 ASK CLI + AWS Lambda 开发 Amazon Alexa 语音技能、并以 Claude 作为对话大脑(含 DynamoDB 记忆、Polly 语音、APL 屏显、Smart Home 控制)时使用;做交互模型/Lambda 处理器/部署脚本的搭建与产出;不适用于纯网页/移动 App 或非 Alexa 平台语音助手;触发词:Alexa、ASK CLI、语音技能、Smart Home/apify-actor-development当需要创建、修改或调试 Apify Actor(无服务器 Docker 抓取/自动化程序)时使用;引导选模板、配 input/output schema 与 actor.json、写入口逻辑、本地 apify run 测试并 apify push 部署;不适用于已有现成 Actor 直接调用(用 apify-ecommerce-scraper)、无 APIFY_TOKEN、或普通网页抓取无需打包为 Actor。触发词:apify actor、apify create、apify push、input_schema、actor.json、爬虫部署、serverless scraper、crawlee/apify-actorization当需要把现有 JS/TS、Python 脚本或任意 CLI 工具改造成可在 Apify 平台运行的 Actor(接受 JSON 输入、产出结构化 JSON、打包为 Docker 镜像并部署/变现)时使用;做 apify init 初始化 + SDK 生命周期包裹 + 配置 input/output/actor schema + apify run 本地测试 + apify push 部署,产出可上架的 Actor;不适用于从零写新爬虫、单纯调用现成 Actor、或无 apify CLI/APIFY_TOKEN。触发词:apify actor、actorization、改造成 actor、apify push、apify init、input_schema、serverless 爬虫/10-platform:firebase-backendfrom 10-platform
npx claudepluginhub findscripter/everything-skills --plugin 10-platformOther plugins' skills for the same job