Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Use when calling callable functions (httpsCallable), passing data to server-side logic, handling function errors/timeouts, configuring regions, or testing with the Emulator Suite.
.claude/skills/evanca-firebase-cloud-functions/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | -14% | 0% |
| case-08 | ✗→✓ | ▲ Improved | -5% | 0% |
| case-07 | ✓→✓ | = Same ✓ | 8% | 0% |
| case-02 | ✓→✓ | = Same ✓ | -17% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 17% | 0% |
This skill defines how to correctly call Firebase Cloud Functions from Flutter applications.
Use this skill when:
flutter pub add cloud_functionsdartimport 'package:cloud_functions/cloud_functions.dart'; // After Firebase.initializeApp(): final functions = FirebaseFunctions.instance;
dartfinal functions = FirebaseFunctions.instanceFor(region: 'europe-west1');
Use httpsCallable to reference a function, then call to invoke it:
dartfinal result = await FirebaseFunctions.instance .httpsCallable('functionName') .call(data);
Map — it is automatically serialized to JSON:dartfinal result = await FirebaseFunctions.instance .httpsCallable('addMessage') .call({ "text": messageText, "push": true, });
data property — it is automatically deserialized from JSON:dartfinal responseData = result.data; // Cast to expected type if needed: final message = result.data as Map<String, dynamic>; final status = message['status'] as String;
Always wrap function calls in try-catch and check for FirebaseFunctionsException:
darttry { 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'); }
unavailable, deadline-exceeded).Set a timeout appropriate to the expected execution time:
dartfinal callable = FirebaseFunctions.instance.httpsCallable( 'functionName', options: HttpsCallableOptions( timeout: const Duration(seconds: 30), ), );
Use the Firebase Emulator Suite for local development and testing:
dartFirebaseFunctions.instance.useFunctionsEmulator('localhost', 5001);
Other measured skills in the registry, with their headline benchmark lift.