Skip to main content
skill CX Codex

firebase-cloud-functions — Claude Code skill: what it does, install

Guides your coding agent on calling Firebase Cloud Functions in Flutter with error handling, region configs, and local emulator support.

MIT ★ 674 updated 2026-10-29

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add evanca/flutter-ai-rules
/plugin install flutter-ai-skills@flutter-ai-rules
Open on GitHub

What firebase-cloud-functions does

This skill instructs coding agents on proper usage of the cloud_functions package in Flutter. It covers invoking callable endpoints with httpsCallable, passing parameters as structured maps, and parsing data from result.data. Auth tokens must not be included in function arguments because the client SDK attaches them automatically.

The guidelines require wrapping calls in try-catch blocks that handle FirebaseFunctionsException error codes like unavailable or permission-denied. It also details how to set custom timeouts with HttpsCallableOptions and target specific regions via FirebaseFunctions.instanceFor.

Local development rules route function traffic to the Firebase Emulator Suite using useFunctionsEmulator('localhost', 5001).

What it helps with

  • invoke callable Firebase functions from Flutter code
  • handle FirebaseFunctionsException and configure timeouts
  • redirect function requests to the local Firebase Emulator Suite
  • set up regional function endpoints in Dart

Example prompts for the agent

  • Implement an httpsCallable call for addMessage with proper error handling in Flutter
  • Configure FirebaseFunctions to connect to emulator on localhost:5001
  • Set a 30 second timeout on a callable function in europe-west1

How to install firebase-cloud-functions

1Plugin marketplace

/plugin marketplace add evanca/flutter-ai-rules
/plugin install flutter-ai-skills@flutter-ai-rules

This installs the whole flutter-ai-skills plugin with all its skills

2Skills CLI (Vercel)

npx skills add evanca/flutter-ai-rules --skill firebase-cloud-functions -a claude-code

3Manually: put the files in place

~/.claude/skills/firebase-cloud-functions/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/firebase-cloud-functions/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about firebase-cloud-functions

How to install firebase-cloud-functions in Claude Code?

Run /plugin marketplace add evanca/flutter-ai-rules and then /plugin install flutter-ai-skills@flutter-ai-rules. Alternatively, install via npx skills add evanca/flutter-ai-rules --skill firebase-cloud-functions -a claude-code.

What does firebase-cloud-functions do?

It provides implementation standards for Flutter Cloud Functions, covering httpsCallable calls, map serialization, and error management.

Should authentication tokens be passed in function payloads?

No. The Firebase SDK automatically includes authentication context with every callable request, so manual tokens in parameters are unnecessary.

Source text

SKILL.md · MIT
---
name: firebase-cloud-functions
description: "Use when calling callable functions (httpsCallable), passing data to server-side logic, handling function errors/timeouts, configuring regions, or testing with the Emulator Suite."
license: MIT
---

# Firebase Cloud Functions Skill

This skill defines how to correctly call Firebase Cloud Functions from Flutter applications.

## When to Use

Use this skill when:

* Implementing callable Cloud Functions in a Flutter project.
* Passing structured data to server-side functions and processing results.
* Handling errors, timeouts, and retries for function calls.
* Configuring region-specific function deployments.
* Testing Cloud Functions locally with the Firebase Emulator Suite.

---

## 1. Setup and Configuration

```
flutter pub add cloud_functions
```

```dart
import 'package:cloud_functions/cloud_functions.dart';

// After Firebase.initializeApp():
final functions = FirebaseFunctions.instance;
```

- Initialize Firebase before using any Cloud Functions features.
- For region-specific deployments, specify the region:

```dart
final functions = FirebaseFunctions.instanceFor(region: 'europe-west1');
```

- Deploy callable functions to Firebase **before** attempting to call them from the Flutter app.
- Consider implementing **App Check** to prevent abuse of Cloud Functions.

---

## 2. Calling Functions

Use `httpsCallable` to reference a function, then `call` to invoke it:

```dart
final result = await FirebaseFunctions.instance
  .httpsCallable('functionName')
  .call(data);
```

- Pass data as a `Map` — it is automatically serialized to JSON:

```dart
final result = await FirebaseFunctions.instance
  .httpsCallable('addMessage')
  .call({
    "text": messageText,
    "push": true,
  });
```

- Access the result via the `data` property — it is automatically deserialized from JSON:

```dart
final responseData = result.data;
// Cast to expected type if needed:
final message = result.data as Map<String, dynamic>;
final status = message['status'] as String;
```

- **Do not** pass authentication tokens in function parameters — they are automatically included by the SDK.
- Keep function names consistent between client code and server-side implementations.

---

## 3. Error Handling

Always wrap function calls in `try-catch` and check for `FirebaseFunctionsException`:

```dart
try {
  final result = await FirebaseFunctions.instance
    .httpsCallable('functionName')
    .call(data);
  // Handle successful result
} on FirebaseFunctionsException catch (e) {
  switch (e.code) {
    case 'not-found':
      // Function does not exist
      break;
    case 'permission-denied':
      // User lacks permission
      break;
    case 'unavailable':
      // Service temporarily unavailable — retry
      break;
    default:
      debugPrint('Function error [${e.code}]: ${e.message}');
  }
} catch (e) {
  debugPrint('Unexpected error: $e');
}
```

- Handle network connectivity issues and timeouts appropriately.
- Provide meaningful error messages to users when function calls fail.
- Implement retry logic with exponential backoff for transient errors (`unavailable`, `deadline-exceeded`).

---

## 4. Performance Optimization

Set a timeout appropriate to the expected execution time:

```dart
final callable = FirebaseFunctions.instance.httpsCallable(
  'functionName',
  options: HttpsCallableOptions(
    timeout: const Duration(seconds: 30),
  ),
);
```

- Minimize the amount of data passed to and from functions to reduce latency.
- Use batch operations when possible to reduce the number of function calls.
- Consider client-side caching for frequently used function results.
- Account for **cold starts** for infrequently used functions.
- Implement proper loading states in the UI while waiting for function responses.

---

## 5. Testing and Development

Use the Firebase Emulator Suite for local development and testing:

```dart
FirebaseFunctions.instance.useFunctionsEmulator('localhost', 5001);
```

- Test functions with both valid and invalid inputs to ensure proper validation.
- Verify that functions handle authentication correctly.
- Test with different user roles and permissions to ensure proper access control.
- Implement unit tests for client-side function calling logic.

---

## References

- [Cloud Functions for Firebase Flutter documentation](https://firebase.google.com/docs/functions/callable?platform=flutter)
- [Firebase Emulator Suite](https://firebase.google.com/docs/emulator-suite)

© Ivanna Kaceviča · MIT · evanca/flutter-ai-rules

Similar skills

All skills for Mobile →

From the same set39

The whole set →
developing-genkit-dart developing-genkit-dart — a skill for building AI agents with Genkit Dart that tells the agent when to pull in reference docs for the core framework and its plugins. CX Codex +1 ★ 674repo stars firebase-storage firebase-storage is a skill with guidelines for Firebase Cloud Storage in Flutter apps, covering file uploads, downloads, metadata changes, and storage error handling. CX Codex +1 ★ 674repo stars firebase-data-connect Get guidance for Firebase Data Connect in Flutter, from GraphQL operations and typed SDK generation to access rules and offline handling. CX Codex +1 ★ 674repo stars firebase-remote-config A Flutter skill that keeps the agent on track with Firebase Remote Config: feature flags, in-app defaults, A/B tests and live config updates. CX Codex +1 ★ 674repo stars testing The testing skill guides Flutter and Dart test writing and review, helps investigate flaky tests, and clarifies when to use unit or widget tests. CX Codex +1 ★ 674repo stars firebase-ai This skill gives the agent working patterns for wiring up Firebase AI Logic in a Flutter app and writing Gemini text and chat calls. CX Codex +1 ★ 674repo stars flutterfire-configure Guides Firebase integration in Flutter apps, runs flutterfire configure, and structures multi-flavor project environments. CX Codex +1 ★ 674repo stars flutter-use-column-row-first The flutter-use-column-row-first skill guides Flutter screen layouts with Row, Column, and flexible space. Use it when building a screen that must adapt to different constraints. CX Codex +1 ★ 674repo stars

Project sponsors

Companies that keep this analytics open