Skip to main content
skill CX Codex

firebase-data-connect · evanca — Claude Code skill: setup and install

Get guidance for Firebase Data Connect in Flutter, from GraphQL operations and typed SDK generation to access rules and offline handling.

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-data-connect does

The skill walks through adding firebase_data_connect to a Flutter app, initializing Firebase, and defining a GraphQL schema with queries and mutations. Run flutterfire generate to create typed Dart classes for those operations. The generated SDK can execute them or subscribe to query updates.

Its guidance also covers pagination, local query-result caching, and handling network or validation errors. Access control uses @auth directives and Firebase Authentication. The described platform support covers iOS, Android, and Web; other platforms are unsupported, so confirm your target before building around this setup.

What it helps with

  • configure Firebase Data Connect in a Flutter app
  • define GraphQL schemas, queries, and mutations
  • generate a typed Dart SDK
  • serve cached data when a network request fails
  • restrict access with @auth directives

Example prompts for the agent

  • Set up Firebase Data Connect in this Flutter app and generate its typed SDK.
  • Create GraphQL queries and mutations for this Data Connect schema.
  • Handle network failures and return cached results while offline.

How to install firebase-data-connect

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-data-connect -a claude-code

3Manually: put the files in place

~/.claude/skills/firebase-data-connect/SKILL.md

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

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

Questions about firebase-data-connect

How do I install firebase-data-connect in Claude Code?

Run /plugin marketplace add evanca/flutter-ai-rules and then /plugin install flutter-ai-skills@flutter-ai-rules.

What does firebase-data-connect do?

It guides Claude Code through Firebase Data Connect setup for Flutter, including GraphQL operations, SDK generation, error handling, and access control.

Which platforms does the skill cover?

The setup described supports iOS, Android, and Web. Other platforms are unsupported.

Source text

SKILL.md · MIT
---
name: firebase-data-connect
description: "Use when setting up Data Connect, writing GraphQL queries/mutations, configuring generated SDKs, handling offline, or applying security rules."
license: MIT
---

# Firebase Data Connect Skill

This skill defines how to correctly use Firebase Data Connect in Flutter applications.

## When to Use

Use this skill when:

* Setting up and configuring Firebase Data Connect in a Flutter project.
* Designing schemas, queries, and mutations for Data Connect.
* Implementing generated SDK calls for typed queries and mutations.
* Handling network failures, data inconsistencies, and offline scenarios.
* Applying security and performance best practices.

---

## 1. Setup and Configuration

### Step 1: Install the package

```
flutter pub add firebase_data_connect
```

### Step 2: Import and initialize

```dart
import 'package:firebase_data_connect/firebase_data_connect.dart';
import 'package:firebase_core/firebase_core.dart';
import 'firebase_options.dart';

await Firebase.initializeApp(
  options: DefaultFirebaseOptions.currentPlatform,
);
```

### Step 3: Define a schema in `dataconnect/schema/schema.gql`

```graphql
type Movie @table {
  id: UUID! @default(expr: "uuidV4()")
  title: String!
  releaseYear: Int
  genre: String
  rating: Float
  description: String
}
```

### Step 4: Define queries and mutations in `dataconnect/connector/queries.gql`

```graphql
query ListMovies @auth(level: PUBLIC) {
  movies {
    id
    title
    releaseYear
    genre
    rating
  }
}

mutation CreateMovie($title: String!, $releaseYear: Int, $genre: String) @auth(level: USER) {
  movie_insert(data: {
    title: $title
    releaseYear: $releaseYear
    genre: $genre
  })
}

mutation DeleteMovie($id: UUID!) @auth(level: USER) {
  movie_delete(id: $id)
}
```

### Step 5: Generate the typed Flutter SDK

```
flutterfire generate
```

This produces typed Dart classes for each query and mutation.

**Platform support:**

| Platform | Support |
|---|---|
| iOS | Full |
| Android | Full |
| Web | Full |
| Other platforms | Not supported |

---

## 2. Executing Queries and Mutations

Use the generated SDK to execute typed queries and mutations:

```dart
// Execute a query
final result = await ListMoviesQuery().execute();
final movies = result.data.movies;

// Execute a mutation
await CreateMovieMutation(title: 'Inception', releaseYear: 2010, genre: 'Sci-Fi')
    .execute();

// Delete by ID
await DeleteMovieMutation(id: movieId).execute();
```

### Real-Time Listeners

Subscribe to query changes for live updates:

```dart
final subscription = ListMoviesQuery().subscribe();
subscription.listen((result) {
  final movies = result.data.movies;
  // Update UI with latest movie list
});
```

---

## 3. Performance and Caching

- Design efficient queries requesting only the fields needed to minimize data transfer.
- Implement **pagination** for large datasets:
  ```graphql
  query ListMoviesPaginated($limit: Int!, $offset: Int!) @auth(level: PUBLIC) {
    movies(limit: $limit, offset: $offset) {
      id
      title
      releaseYear
    }
  }
  ```
- Use real-time listeners judiciously to avoid unnecessary network usage.
- Consider **offline capabilities** for critical app functionality by caching query results locally.

---

## 4. Error Handling

Wrap Data Connect calls in try/catch to handle network and validation errors:

```dart
try {
  final result = await ListMoviesQuery().execute();
  return result.data.movies;
} on FirebaseException catch (e) {
  if (e.code == 'unavailable') {
    // Handle offline — return cached data
    return _localCache.getMovies();
  }
  rethrow;
}
```

- Implement **retry logic** with exponential backoff for transient connection errors.
- Provide meaningful error messages for data validation failures.
- Monitor error rates and investigate recurring issues.

---

## 5. Security

- Use `@auth` directives in schema to control access levels (`PUBLIC`, `USER`, `NO_ACCESS`).
- Integrate **Firebase Authentication** for user-based access control.
- Validate data on both client and server sides.
- Follow data privacy best practices when handling user information.

---

## References

- [Firebase Data Connect documentation](https://firebase.google.com/docs/data-connect)
- [Data Connect Flutter SDK reference](https://firebase.google.com/docs/data-connect/flutter-sdk)

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

Similar skills

All skills for Backend and APIs →

firebase-data-connect by other authors comes first.

firebase-data-connect Google LLC firebase-data-connect is a Claude Code skill for building Firebase SQL Connect backends with PostgreSQL. It activates for schema design, authorized operations, realtime updates, or SDK generation. CX Codex +1 179,900installs firebase-ai-logic-basics Google LLC firebase-ai-logic-basics adds Firebase AI Logic to client apps across Android, iOS, Web, and Flutter to invoke Gemini models without spinning up a backend. CX Codex +1 146,900installs firebase-firestore Google LLC The firebase-firestore skill handles Cloud Firestore setup, data models, indexes, and SDK work. Use it when an app needs a new database or a migration. CX Codex +1 146,900installs appwrite-dart appwrite Gives your agent the Appwrite Dart SDK reference: auth, database queries, file uploads, realtime and server-side admin. CX Codex +1 1,100installs firebase sickn33 Guides backend design across Firestore, Cloud Functions, and Firebase Hosting with a focus on security rules and query costs. CX Codex +1 1,600installs firebase-apk-scanner trailofbits firebase-apk-scanner unpacks an Android APK, pulls out its Firebase config and probes databases, buckets and functions for open access. Built for mobile app security audits. CX Codex +1 6,000installs flutter-use-http-package flutter The flutter-use-http-package skill shows how to send GET, POST, PUT, and DELETE requests with Flutter's http package and handle JSON responses. Use it when an app needs to read from or write to a REST API. CX Codex +1 39,100installs

From the same set39

The whole set →
provider Guides agents on architecting Flutter state with the provider package, keeping rebuilds minimal and dependencies reactive. CX Codex +1 ★ 674repo stars mockito mockito is a Claude Code skill for Dart and Flutter tests that guides mock generation, stubbing, and interaction checks. It activates for Mockito testing tasks. CX Codex +1 ★ 674repo stars 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-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 firebase-cloud-functions Guides your coding agent on calling Firebase Cloud Functions in Flutter with error handling, region configs, and local emulator support. 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

Project sponsors

Companies that keep this analytics open