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
/plugin marketplace add evanca/flutter-ai-rules
/plugin install flutter-ai-skills@flutter-ai-rulesWhat 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
@authdirectives
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-rulesThis 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-code3Manually: put the files in place
~/.claude/skills/firebase-data-connect/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/firebase-data-connect/
1Skills CLI (Vercel)
npx skills add evanca/flutter-ai-rules --skill firebase-data-connect -a codex2Manually: put the files in place
.agents/skills/firebase-data-connect/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add evanca/flutter-ai-rules --skill firebase-data-connect -a cursor2Manually: put the files in place
.cursor/skills/firebase-data-connect/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install evanca/flutter-ai-rules skills/firebase-data-connect2Manually: put the files in place
.github/skills/firebase-data-connect/SKILL.md1Skills CLI (Vercel)
npx skills add evanca/flutter-ai-rules --skill firebase-data-connect -a gemini-cli2Platform CLI
gemini skills install https://github.com/evanca/flutter-ai-rules --path skills/firebase-data-connectManually: put the files in place
.devin/skills/firebase-data-connect/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
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.