Source profileQuality 84/100

evanca/flutter-ai-rules/skills/firebase-ai/SKILL.md

firebase-ai

Use when setting up firebase_ai, generating text/chat with Gemini, streaming AI output, building multimodal prompts, or handling AI errors.

Source repository stars
604
Declared platforms
0
Static risk flags
0
Last source update
2026-08-04
Source checked
2026-08-04

Decision brief

What it does—and where it fits

This skill defines how to correctly use Firebase AI Logic in Flutter applications.

Best for

  • Setting up and configuring Firebase AI in a Flutter project.
  • Generating text content or chat responses with Gemini models.
  • Implementing streaming AI responses for real-time UI updates.

Not for

  • Tasks that require unconfirmed production actions or broad system permissions.
  • Environments where the pinned source and install steps cannot be inspected.

Compatibility matrix

Platform support, with evidence labels

PlatformStatusEvidenceWhat to check
CodexNot declaredNo explicit evidencePortability before use
Claude CodeNot declaredNo explicit evidencePortability before use
CursorNot declaredNo explicit evidencePortability before use
Gemini CLINot declaredNo explicit evidencePortability before use
Open the compatibility checker

Installation

Inspect first. Install second.

The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

Source-detected install commandSource
npx skills add https://github.com/evanca/flutter-ai-rules --skill "skills/firebase-ai"
Safe inspection promptEditorial

Inspect the Agent Skill "firebase-ai" from https://github.com/evanca/flutter-ai-rules/blob/b294a77b68b5508f8d3151fb93d87ed9622d2ff1/skills/firebase-ai/SKILL.md at commit b294a77b68b5508f8d3151fb93d87ed9622d2ff1. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

Workflow

What the source asks the agent to do

  1. 01

    1. Setup and Configuration

    Ensure the Firebase project is configured for AI services via the Firebase AI Logic page in the Firebase Console.

    Ensure the Firebase project is configured for AI services via the Firebase AI Logic page in the Firebase Console.Initialize Firebase before using any Firebase AI features.Use FirebaseAI.googleAI() for the Gemini Developer API backend (recommended starting point).
  2. 02

    When to Use

    Setting up and configuring Firebase AI in a Flutter project. Generating text content or chat responses with Gemini models. Implementing streaming AI responses for real-time UI updates. Sending multimodal prompts (text + images) to Gemini. Handling errors, offline scenarios, and…

    Setting up and configuring Firebase AI in a Flutter project.Generating text content or chat responses with Gemini models.Implementing streaming AI responses for real-time UI updates.
  3. 03

    2. Generating Content

    Use streaming to display partial results as they arrive:

    Use streaming to display partial results as they arrive:
  4. 04

    Single-turn text generation

    Review the “Single-turn text generation” section in the pinned source before continuing.

    Review and apply the “Single-turn text generation” source section.
  5. 05

    Multi-turn chat

    Review the “Multi-turn chat” section in the pinned source before continuing.

    Review and apply the “Multi-turn chat” source section.

Permission review

Static risk signals and limitations

No configured static risk pattern was detected

This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.

Evidence record

Why each signal appears

EvidenceSourceComputedTestedEditorial
SignalValueEvidence typeMeaning
Quality score84/100ComputedDocumentation, specificity, maintenance, and trust rules
Repository stars604SourceRepository attention, not individual Skill quality
Compatibility0 platformsSourceDeclared in the catalog source record
Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

Pinned source

Provenance and original SKILL.md

Repository
evanca/flutter-ai-rules
Skill path
skills/firebase-ai/SKILL.md
Commit
b294a77b68b5508f8d3151fb93d87ed9622d2ff1
License
MIT
Collected
2026-08-04
Default branch
main
View the original SKILL.md

Firebase AI Skill

This skill defines how to correctly use Firebase AI Logic in Flutter applications.

When to Use

Use this skill when:

  • Setting up and configuring Firebase AI in a Flutter project.
  • Generating text content or chat responses with Gemini models.
  • Implementing streaming AI responses for real-time UI updates.
  • Sending multimodal prompts (text + images) to Gemini.
  • Handling errors, offline scenarios, and rate limits for AI operations.
  • Applying security and privacy considerations for AI features.

1. Setup and Configuration

flutter pub add firebase_ai
import 'package:firebase_ai/firebase_ai.dart';
import 'package:firebase_core/firebase_core.dart';
import 'firebase_options.dart';

// Initialize FirebaseApp
await Firebase.initializeApp(
  options: DefaultFirebaseOptions.currentPlatform,
);

// Initialize the Gemini Developer API backend service
final model =
    FirebaseAI.googleAI().generativeModel(model: 'gemini-2.5-flash');
  • Ensure the Firebase project is configured for AI services via the Firebase AI Logic page in the Firebase Console.
  • Initialize Firebase before using any Firebase AI features.
  • Use FirebaseAI.googleAI() for the Gemini Developer API backend (recommended starting point).
  • Implement App Check to prevent abuse of Firebase AI endpoints.

Platform support:

PlatformSupport
iOSFull
AndroidFull
WebFull
macOS / other AppleBeta
WindowsNot supported

2. Generating Content

Single-turn text generation

final response = await model.generateContent([
  Content.text('Summarize the benefits of Flutter for mobile development'),
]);
final text = response.text; // The generated summary string

Multi-turn chat

final chat = model.startChat();
final response = await chat.sendMessage(
  Content.text('What is the difference between StatelessWidget and StatefulWidget?'),
);
print(response.text);

// Follow-up in the same conversation
final followUp = await chat.sendMessage(
  Content.text('When should I use StatefulWidget?'),
);
print(followUp.text);

Streaming responses

Use streaming to display partial results as they arrive:

final stream = model.generateContentStream([
  Content.text('Write a step-by-step guide to implementing dark mode in Flutter'),
]);

await for (final chunk in stream) {
  // Append chunk.text to the UI progressively
  setState(() => _output += chunk.text ?? '');
}

Multimodal prompts (text + image)

final imageBytes = await File('photo.jpg').readAsBytes();
final response = await model.generateContent([
  Content.multi([
    TextPart('Describe what you see in this image'),
    InlineDataPart('image/jpeg', imageBytes),
  ]),
]);

3. Error Handling

Wrap AI calls in structured error handling:

try {
  final response = await model.generateContent([Content.text(prompt)]);
  return response.text;
} on FirebaseAIException catch (e) {
  if (e.message?.contains('quota') ?? false) {
    // Handle rate limiting — show retry message or queue the request
    return 'Service is busy. Please try again shortly.';
  }
  return 'AI service error: ${e.message}';
} catch (e) {
  return 'Unexpected error: $e';
}
  • Provide meaningful error messages to users when AI operations fail.
  • Handle offline scenarios with appropriate fallback behavior (e.g., cached responses).
  • Implement exponential backoff for rate-limited or transient errors.

4. Security and Privacy

  • Follow Firebase Security Rules best practices when using AI services alongside other Firebase products.
  • Ensure proper authentication and authorization for AI feature access.
  • Sanitize user input before sending it to the model to prevent prompt injection.
  • Be mindful of data privacy requirements when processing user content with AI services.
  • Implement appropriate content filtering and moderation using safety settings:
final model = FirebaseAI.googleAI().generativeModel(
  model: 'gemini-2.5-flash',
  safetySettings: [
    SafetySetting(HarmCategory.harassment, HarmBlockThreshold.medium),
    SafetySetting(HarmCategory.dangerousContent, HarmBlockThreshold.high),
  ],
);

References