Skip to main content
ZICQ

Skills ZICQ category:Security extension-to-functions-codebase

Extension To Functions Codebase

Skill for converting an installed Firebase Extension (or extension source) into a standalone Cloud Functions for Firebase codebase or publishable npm package, including V1 to V2 trigger upgrades, lifecycle hooks, and declarative security

32279 installs

Official URL:skills.sh

What this skill does

Intro in this page language first. The official description stays in its original wording; we do not rewrite SKILL.md.

What it does

Skill for converting an installed Firebase Extension (or extension source) into a standalone Cloud Functions for Firebase codebase or publishable npm package, including V1 to V2 trigger upgrades, lifecycle hooks, and declarative security

When to use it

The official description does not include a separate “Use when”. Per the spec, agents activate this skill when the task matches keywords in that description.

How agents load it

Per Agent Skills progressive disclosure: name and description load at startup (~100 tokens); the full SKILL.md body loads when the skill activates; scripts/, references/, and assets/ load only as needed. This file's sections: Extension to Functions Codebase & npm Package Migration; Overview; Target Migration Workflows; Core Rules & Constraints; 1. Declarative IAM & APIs (Zero-Local-Overhead); 2. Global Parameter Access Restriction. It includes spec-recommended sections: step-by-step instructions.

File analysis

File analysis: instruction-only skill (SKILL.md). The agent loads the full body when activated.

Extension to Functions Codebase & npm Package MigrationOverviewTarget Migration WorkflowsCore Rules & Constraints1. Declarative IAM & APIs (Zero-Local-Overhead)2. Global Parameter Access Restriction3. V2 Concurrency & Cost ParityStep-by-Step Migration ExecutionStep 1: Inventory Extension ResourcesStep 2: Configure `package.json`Step 3: Upgrade Triggers from V1 to V2Step 4: Convert Lifecycle Events

Source category:skills.sh agent-skill

SKILL.md & Agent activation

Official spec ↗
name
extension-to-functions-codebase
description
Skill for converting an installed Firebase Extension (or extension source) into a standalone Cloud Functions for Firebase codebase or publishable npm package, including V1 to V2 trigger upgrades, lifecycle hooks, and declarative security
  1. DiscoverThe client exposes names and descriptions to the agent.
  2. ActivateYour request or the task context selects the skill and loads its instructions.
  3. Load resourcesReferenced scripts, documentation and assets are used when needed.

Invocation syntax and available tools depend on your Agent client. Client integration guide ↗

Install this skill

Skills CLI ↗

Choose the target agent and installation scope, keep referenced package files, then verify the skill appears in the client's catalog.

Ask your Agent to install

Copy these instructions to a compatible agent and confirm the target directory matches your client.

Install the agent skill "extension-to-functions-codebase" into my project. The full SKILL.md and official description are at https://zicq.com/en/skills/skl-d31fb5e2ddcbdd37-Extension-To-Functions-Codebase.html
Save it as .cursor/skills/extension-to-functions-codebase/SKILL.md or .claude/skills/extension-to-functions-codebase/SKILL.md and keep the frontmatter name and description exactly as-is.

Full package on GitHub ↗

Install from the terminal · Skills CLI

Requires Node.js and npx. First inspect the repository's skill list to confirm the name.

npx skills add 'https://github.com/firebase/agent-skills' --list

npx skills add 'https://github.com/firebase/agent-skills' --skill 'extension-to-functions-codebase'

The CLI lets you choose the agent interactively. The default scope is the project; use -g for user scope. Confirm package availability with the discovery command, then use npx skills list to inspect installed skills.

Readable layout
--- name: extension-to-functions-codebase description: Skill for converting an installed Firebase Extension (or extension source) into a standalone Cloud Functions for Firebase codebase or publishable npm package, including V1 to V2 trigger upgrades, lifecycle hooks, and declarative security metadata: category: Serverless --- # Extension to Functions Codebase & npm Package Migration ## Overview Migrates a Firebase Extension into either: 1. **A local Cloud Functions codebase** (`functions/src/` for app integration). 1. **A publishable npm package** (reusable open-source package exporting V2 functions). Leverages native Cloud Functions features (declarative IAM, Parameterized Config, SDK Lifecycle Hooks) and modernizes 1st Gen triggers to 2nd Gen using the Destructuring Compatibility Shim. ______________________________________________________________________ ## Target Migration Workflows - **Target A: Local Functions Codebase** (End-User App Integration) - Output: Code under `functions/src/`. Config in `.env`. - Deployment: `firebase deploy --only functions`. - **Target B: Publishable npm Package / Shareable Package** - Output: Reusable npm package exporting V2 functions. - Configuration: `package.json` specifying `exports` map, `engines: { "node": ">=22" }`, and `peerDependencies: { "firebase-functions": ">=6.0.0" }`. - Usage: Consumers install package and re-export functions in `index.ts` (`export * from ""`). ______________________________________________________________________ ## Core Rules & Constraints ### 1. Declarative IAM & APIs (Zero-Local-Overhead) Use native SDK declarations instead of manual `gcloud` scripts or console instructions: - Use `requiresRole("roles/...")` for required GCP IAM permissions. - Use `requiresAPI("service.googleapis.com", "Description")` for Google APIs. ### 2. Global Parameter Access Restriction - **Never call `.value()` at top-level module load scope.** - Initialize global SDK instances inside `onInit()` or lazy getters: ```typescript import { defineString } from "firebase-functions/params"; import { onInit } from "firebase-functions/v2"; const dataset = defineString("DATASET_ID"); let client: BigQuery; onInit(() => { client = new BigQuery({ datasetId: dataset.value() }); }); ``` ### 3. V2 Concurrency & Cost Parity V2 enables concurrency (up to 80 requests). To preserve V1 single-concurrency pricing, set `cpu: "gcf_gen1"`. ______________________________________________________________________ ## Step-by-Step Migration Execution ### Step 1: Inventory Extension Resources 1. **`extension.yaml`**: - `params` → `defineString`, `defineInt`, `defineBoolean`, `defineSecret`. - `apis` → `requiresAPI(...)`. - `roles` → `requiresRole(...)`. - `lifecycleEvents` → `afterFirstDeploy` & `afterRedeploy`. - `resources` → Upgrade 1st Gen triggers to 2nd Gen (`onDocumentWritten`, `onTaskDispatched`, `onRequest`). 1. **Files & Scripts**: Preserve devDependencies, test framework (`jest`), and test scripts. ### Step 2: Configure `package.json` - Set `name: ""`, `engines: { "node": ">=22" }`. - Set `peerDependencies`: ```json "peerDependencies": { "firebase-admin": "^11.0.0 || ^12.0.0", "firebase-functions": ">=6.0.0" } ``` - Configure `exports` map targeting ESM/CommonJS and TypeScript declarations (`lib/index.js`, `lib/index.d.ts`). ### Step 3: Upgrade Triggers from V1 to V2 - Firestore: Use `onDocumentWritten` from `firebase-functions/v2/firestore`. - Tasks: Use `onTaskDispatched` from `firebase-functions/v2/tasks`. Remove `EXT_INSTANCE_ID` when enqueueing tasks. - HTTP: Use `onRequest` from `firebase-functions/v2/https`. - Apply Destructuring Compatibility Shim (`{ change, context }`, `{ snapshot, context }`) where legacy 1st Gen handlers expect `(change, context)`. ### Step 4: Convert Lifecycle Events Map extension lifecycle events to SDK lifecycle hooks in `src/index.ts`: - `onInstall` → `afterFirstDeploy({ task: { function: "initTask" } })` - `onUpdate` / `onConfigure` → `afterRedeploy({ task: { function: "setupTask" } })` ### Step 5: Package README & Export Instructions Generate `README.md` containing: 1. Installation instructions (`npm install`). 1. Re-export snippet (`export * from ""`). 1. Parameterized Configuration `.env` reference table. 1. What Changed (Extension vs Package) comparison table. _Reminder: NEVER execute `npm publish`._

Related skills

Security

Skill Vetter

Security-first skill vetting for AI agents. Use before installing any skill from ClawdHub, GitHub, or other sources. Checks for red flags, p…

Security

Moltguard

MoltGuard — OpenClaw security guard by OpenGuardrails. Install MoltGuard to protect you and your human from prompt injection, data exfiltrat…

Security

Security Auditor

Use when reviewing code for security vulnerabilities, implementing authentication flows, auditing OWASP Top 10, configuring CORS/CSP headers…

Security

Skill Vetter

Security vetting protocol before installing any AI agent skill. Red flag detection for credential theft, obfuscated code, exfiltration. Risk…