All skills
firebase avatar

/extension-to-functions-codebase

@073edf7 official
by firebasefirebase/agent-skills461 stars
102

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

Use this Skill: https://skilld.dev/gh/firebase/agent-skills/extension-to-functions-codebase

This session only. Nothing lands on disk.

referencessignature-mapping.md

≈1.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Firebase Functions V1 vs V2 Signature Mapping

This reference maps legacy V1 functions to their modern V2 equivalents. When using the compatibility shim, you can destructure the V2 event object using the exact parameter names from the legacy V1 trigger signature (change, snapshot, message, object) alongside context.


Cloud Firestore

V1 Trigger V2 Equivalent Destructuring Pattern
firestore.document().onWrite() onDocumentWritten() ({ change, context })
firestore.document().onCreate() onDocumentCreated() ({ snapshot, context })
firestore.document().onUpdate() onDocumentUpdated() ({ change, context })
firestore.document().onDelete() onDocumentDeleted() ({ snapshot, context })

Cloud Pub/Sub

V1 Trigger V2 Equivalent Destructuring Pattern
pubsub.topic().onPublish() onMessagePublished() ({ message, context })
pubsub.schedule().onRun() onSchedule() Access event directly

[!NOTE] Scheduled functions moved from the pubsub namespace to the scheduler namespace in V2.


Realtime Database

V1 Trigger V2 Equivalent Destructuring Pattern
database.ref().onWrite() onValueWritten() ({ change, context })
database.ref().onCreate() onValueCreated() ({ snapshot, context })
database.ref().onUpdate() onValueUpdated() ({ change, context })
database.ref().onDelete() onValueDeleted() ({ snapshot, context })

Cloud Storage

V1 Trigger V2 Equivalent Destructuring Pattern
storage.object().onArchive() onObjectArchived() ({ object, context })
storage.object().onDelete() onObjectDeleted() ({ object, context })
storage.object().onFinalize() onObjectFinalized() ({ object, context })
storage.object().onMetadataUpdate() onObjectMetadataUpdated() ({ object, context })

HTTP / Callables

V1 Trigger V2 Equivalent Destructuring Pattern
https.onRequest() https.onRequest() Standard Express (req, res)
https.onCall() https.onCall() Destructure ({ data, auth })

[!IMPORTANT] HTTP Callables do NOT use the Destructuring Shim. In V2, the handler receives a single CallableRequest object (not a CloudEvent). You should destructure properties like data, auth, and app directly from it. The traditional context object is unavailable.


Auth (Blocking)

V1 Trigger V2 Equivalent Destructuring Pattern
auth.user().beforeSignIn() identity.beforeUserSignedIn() Access event directly
auth.user().beforeCreate() identity.beforeUserCreated() Access event directly

[!NOTE] Auth Blocking triggers moved to the identity namespace in V2.


Cloud Tasks

V1 Trigger V2 Equivalent Destructuring Pattern
tasks.taskQueue().onDispatch() onTaskDispatched() Access event directly

Source: SKILL.md on GitHub

No alerts1mo3 checks · Risk SAFE
  • Gen Agent Trust Hub1mo

    The skill provides comprehensive instructions for migrating Firebase Extensions to Cloud Functions or npm packages using official Firebase SDK patterns. It incorporates security best practices, such as declarative IAM and parameterized secret management, and includes specific safeguards against unauthorized code publishing.

  • Socket1mo

    No alerts

  • Snyk1mo

    Risk: LOW · No issues

Signed by skilld at 073edf7. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 days ago.

Activeupdated 2 months ago
metadata
{
  "category": "Serverless"
}

README badge

README badge for firebase/agent-skills/extension-to-functions-codebase