dentvega/firebase-agent-skills/firebase-cloud-functions
Claude Code and agent skill by dentvega/firebase-agent-skills
- community
Checking that the SKILL.md file is still in the repository.
Scaffolds, runs locally, and deploys Firebase Cloud Functions (2nd gen) — HTTPS endpoints, callable functions, Firestore/Auth/Storage triggers, and scheduled jobs. Use whenever the user needs server-side logic that runs in response to an HTTP request, a database change, or a cron schedule.
Install
npx vskill@latest install dentvega/firebase-agent-skills/firebase-cloud-functionsSKILL.md
The same SKILL.md was published earlier as dentvega/firebase-agent-skills/firebase-cloud-functions.
Firebase Cloud Functions (2nd gen)
Minimum viable example
A signed-in client calls it via httpsCallable("hello"). That's the entire round-trip.
Always use the v2 SDK (firebase-functions/v2) for new functions. v1 is legacy and lacks Cloud Run features like concurrency, min instances, and arbitrary regions.
1. Initialize
In a Firebase project root that already has firebase.json:
Choose TypeScript and install dependencies. This creates functions/ with:
2. Function types
Scaffold a callable
For the canonical v2 callable with the auth check, invoke the scaffold:
Use --append to add a second function to the same file without overwriting. Then fill in the TODO inside the function body.
HTTPS endpoint
For public REST endpoints. Auth must be checked manually.
Callable function
For client SDKs (httpsCallable). Auth is verified automatically; user is at request.auth.
Client side:
Firestore trigger
Run on writes to a path. v2 trigger paths use {wildcards}.
Scheduled function
Cron-driven. Times are interpreted in the function's timezone (UTC by default).
3. Local development with the emulator
The emulator suite runs Functions + Firestore + Auth locally so you don't burn quota:
The Functions emulator hot-reloads when functions/lib/ changes. Run TypeScript in watch mode in a second terminal:
Connect callable functions from a web client:
4. Deploy
Deploy a single function (faster iteration):
First deploy on a project enables required Google Cloud APIs (Cloud Build, Artifact Registry, Cloud Run). It may take a few minutes and prompt for billing.
5. Configuration & secrets
Do not use functions.config() — it's the v1 pattern and is deprecated for v2.
For non-secret config, use environment variables in functions/.env:
Available in code as process.env.STRIPE_API_VERSION.
For secrets (API keys, signing keys), use Secret Manager:
Reference in code via the function options:
The secret is only mounted into functions that declare it — explicit, auditable, no global env leak.
6. Cost & cold-start tuning
- Set `minInstances: 1` for any user-facing callable that needs to respond in <1s. Cold starts on Node 20 are typically 500-2000ms; min instances eliminate them at the cost of always-on billing (~$8/mo per instance).
- Set `concurrency` (default 80) higher if the function is I/O-bound and lower if CPU-bound. Each instance serves up to
concurrencyrequests at once. - Set `memory` to the smallest size that doesn't OOM. Bigger memory = bigger CPU allocation but proportional billing.
- Set `region` to be co-located with your Firestore database and your users.
See references/admin-sdk.md for using the Admin SDK inside functions (bypasses security rules) and references/triggers.md for Auth/Storage/Pub-Sub triggers.
7. Common mistakes
- Not awaiting promises in triggers. Background triggers exit immediately when the handler returns; un-awaited work gets killed and you'll see partial updates.
- Calling `admin.initializeApp()` inside a handler. Initialize once at module top level — re-init in every invocation is slow and leaks resources.
- Using `onCall` without checking `request.auth`. Anyone with the project's web API key can invoke it. Always assert auth.
- Long-running work in HTTPS functions. Functions max out at 60 minutes (HTTP: 60 min, callable: 60 min — but mobile clients time out far sooner). For long jobs, enqueue a Cloud Task or use a Pub/Sub-triggered function.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/firebase-cloud-functions/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/dentvega/firebase-agent-skills/firebase-cloud-functions)