extension-to-functions-codebase

tarafından firebase

Kurulu bir Firebase Uzantısını (veya uzantı kaynağını) bağımsız bir Firebase için Cloud Functions kod tabanına veya yayınlanabilir bir npm paketine dönüştürme becerisi,…

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

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).
  2. 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 "<package-name>").

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:
    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:
    • paramsdefineString, defineInt, defineBoolean, defineSecret.
    • apisrequiresAPI(...).
    • rolesrequiresRole(...).
    • lifecycleEventsafterFirstDeploy & afterRedeploy.
    • resources → Upgrade 1st Gen triggers to 2nd Gen (onDocumentWritten, onTaskDispatched, onRequest).
  2. Files & Scripts: Preserve devDependencies, test framework (jest), and test scripts.

Step 2: Configure package.json

  • Set name: "<package-name>", engines: { "node": ">=22" }.
  • Set peerDependencies:
    "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:

  • onInstallafterFirstDeploy({ task: { function: "initTask" } })
  • onUpdate / onConfigureafterRedeploy({ task: { function: "setupTask" } })

Step 5: Package README & Export Instructions

Generate README.md containing:

  1. Installation instructions (npm install).
  2. Re-export snippet (export * from "<package-name>").
  3. Parameterized Configuration .env reference table.
  4. What Changed (Extension vs Package) comparison table.

Reminder: NEVER execute npm publish.

firebase tarafından daha fazla skill

developing-genkit-dart
firebase
We need to translate the given text from English to Turkish, preserving the name "developing-genkit-dart" if it appears, but it does not appear in the text. The text describes a unified AI SDK for Dart. We must not add any extra commentary, labels, or formatting. Just the translation. The text: "Unified AI SDK for Dart enabling code generation, structured outputs, tools, flows, and agents. Provides core APIs for generation, tool definition, flow orchestration, embeddings, and streaming with a single interface Includes 8+ plugins for LLM providers (Google Gemini, Anthropic Claude, OpenAI GPT), Firebase AI, Model Context Protocol, Chrome browser integration, and HTTP server hosting via Shelf Built-in CLI with local development UI for flow execution, tracing, model experimentation, and..." We need to translate accurately, preserving product names, protocol names, URLs, numbers, technical terms. So "Unified AI SDK for Dart" -> "Dart için Birleşik AI SDK'sı" but careful: "AI" is technical term, keep as AI.
official
developing-genkit-js
firebase
Genkit akışları, araçları ve çoklu model desteği ile AI destekli Node.js/TypeScript uygulamaları oluşturun. Genkit, sağlayıcıdan bağımsızdır; eklentiler aracılığıyla Google AI, OpenAI, Anthropic, Ollama ve diğer LLM sağlayıcılarını destekler. Zod ile tür güvenli şemalar kullanarak akışlar tanımlayın, üretim isteklerini yürütün ve TypeScript'te çok adımlı AI iş akışları oluşturun. Genkit CLI v1.29.0+ gerektirir; son büyük API değişiklikleri nedeniyle güncel kalıplar için önceki bilgilere değil, genkit docs:read ve common-errors.md dosyasına başvurmalısınız...
official
firebase-ai-logic
firebase
We need to translate the given English text into Turkish, preserving the name "firebase-ai-logic" only if it appears in the source text. The source text does not contain that name; it's just the directory item type. So we translate the description only. The text is about client-side Gemini integration for web apps. We must preserve product names (Gemini, Gemini Nano, Chrome, Cloud Storage, App Check), protocol names, URLs (none), numbers (20 MB), and technical terms (multimodal inference, streaming, on-device hybrid execution, etc.). No extra commentary, no labels. Just the translation. Let's translate carefully: "Client-side Gemini integration for web apps with multimodal inference, streaming, and on-device hybrid execution." -> "Web uygulamaları için çok modlu çıkarım, akış ve cihaz üzerinde hibrit yürütme ile istemci tarafı Gemini entegrasyonu." "Supports text-only and multimodal inputs (images, audio, video, PDFs);
official
firebase-ai-logic-basics
firebase
Firebase AI Logic (Gemini API)'yi web uygulamalarına entegre etmek için resmi beceri. Kurulum, çok modlu çıkarım, yapılandırılmış çıktı ve güvenlik konularını kapsar.
official
firebase-app-hosting-basics
firebase
Firebase App Hosting ile Next.js, Angular ve diğer desteklenen framework'leri kullanarak full-stack web uygulamaları dağıtın ve yönetin. Blaze fiyatlandırma planında bir Firebase projesi gerektirir; Sunucu Taraflı Render (SSR) ve Artımlı Statik Rejenerasyon (ISR) iş akışlarını destekler. Firebase.json yapılandırması ve isteğe bağlı apphosting.yaml ile backend kurulumu yaparak dağıtım yapın veya GitHub entegrasyonu aracılığıyla otomatik "git push ile dağıt" özelliğini etkinleştirin. Hassas anahtarlara güvenli erişim için CLI komutlarıyla gizli yönetimi içerir...
official
firebase-auth-basics
firebase
Firebase Authentication'ı birden çok kimlik sağlayıcı ve güvenli veri erişim kuralları ile kurun. E-posta/şifre, telefon numarası, anonim, federasyon sağlayıcıları (Google, Facebook, Twitter, GitHub, Microsoft, Apple) ve özel kimlik doğrulama entegrasyonunu destekler. Her kimliği doğrulanmış kullanıcı, Firebase hizmetlerine erişmek için benzersiz bir kimlik ve JWT tabanlı token'lar (kısa ömürlü ID token'ları ve uzun ömürlü yenileme token'ları) alır. Google Sign In, anonim ve e-posta/şifre için CLI üzerinden sağlayıcıları etkinleştirin; Firebase Console'u kullanın...
official
firebase-basics
firebase
Firebase proje kurulumu ve AI ajan entegrasyonu için CLI iş akışı. firebase-local-env-setup becerisinin ve Firebase CLI kurulumunun önceden tamamlanmasını gerektirir. Temel iş akışı, firebase login ile kimlik doğrulama, benzersiz kimliklerle proje oluşturma ve etkileşimli firebase init komutu ile hizmet başlatmayı kapsar. Kurulum sırasında Firestore, Functions ve Hosting dahil olmak üzere özellik seçimini destekler ve otomatik yapılandırma dosyası oluşturur. --help bayrakları ile kendi kendini belgeleyen CLI...
official
firebase-crashlytics
firebase
Firebase Crashlytics için kapsamlı kılavuz; sağlama ve SDK kullanımını içerir. Kullanıcının Crashlytics kurulumu, ekleme… konularında yardıma ihtiyacı olduğunda bu beceriyi kullanın.
official