Skill for converting an installed Firebase Extension (or extension source) to a standalone Cloud Functions for Firebase codebase or publishable npm package, including upgrading triggers from V1 to V2 and configuring lifecycle hooks and declarative security
This Firebase skill guides an agent through migrating an installed Firebase Extension (or extension source) into either a standalone Cloud Functions for Firebase codebase for end-user app integration, or a publishable/open-source npm package for extension publishers. It solves the problem of moving off the Extensions packaging model onto native Cloud Functions GA capabilities — handling permissions, dependencies, and lifecycle hooks declaratively in code — while modernizing legacy V1 triggers to V2.
The skill defines two target workflows (local functions/src codebase versus reusable npm package with an exports map), enforces git safety by requiring a clean working tree and committing in-place copies before rewriting, and lays out rules such as never calling a parameter's .value() at global scope (initialize inside onInit instead) and preserving V1 fractional CPU pricing via cpu: "gcf_gen1" when disabling V2 concurrency. It provides a step-by-step execution plan: inventory the extension (extension.yaml params, apis, roles, lifecycleEvents, resources plus docs and scripts), create or update package.json with firebase-functions declared in dependencies or peerDependencies, and move function code so deployable functions can be re-exported from a consumer entrypoint. Reference files cover configuration migration, a destructuring compatibility shim for V1-to-V2 signatures, and signature mapping. Notably, it assumes Workload Identities, Declarative Security, and SDK Lifecycle Hooks are fully GA and instructs the agent to use requiresAPI/requiresRole imports rather than emitting manual gcloud IAM commands or console steps.
It targets Firebase extension developers and app teams converting extensions into maintainable functions codebases or shareable packages, and anyone upgrading extension triggers from 1st gen to 2nd gen.
Target A is a local Cloud Functions codebase placed in the project's functions/src/ folder, configured via defineString/defineSecret in .env and deployed with firebase deploy --only functions. Target B is a publishable npm package with an exports map and firebase-functions in dependencies or peerDependencies, which end users install and re-export.
It converts 1st gen triggers (firebase-functions/v1) to 2nd gen (firebase-functions/v2) using a Destructuring Compatibility Shim, and maps signatures via reference files. To keep V1 fractional CPU pricing and disable V2 concurrency, it sets cpu: "gcf_gen1".
No. It assumes Workload Identities, Declarative Security, and Lifecycle Hooks are GA and instructs the agent to use declarative requiresAPI and requiresRole SDK imports instead of telling users to run manual gcloud commands or enable APIs in the console.
It verifies a clean git status before starting and, when copying an extension's source into a new subdirectory, copies and commits immediately with a descriptive message before rewriting.
A complete inventory of the extension — extension.yaml params, apis, roles, lifecycleEvents, and resources, plus source files, README/PREINSTALL/POSTINSTALL docs, and any backfill or helper scripts — so nothing is lost.
Quick Setup:
.claude/skills/Repository
firebase/agent-skills