Agent skill

Firebase Cloud Firestore

by evanca in evanca/flutter-ai-rules

A skill your agent uses when setting up Firestore, designing schemas, doing CRUD, creating listeners, paginating queries, configuring indexes, enabling offline persistence, or writing security rules.

MITAuto-check passedMobile

Install Firebase Cloud Firestore

skills CLI
$ npx skills add evanca/flutter-ai-rules --skill firebase-cloud-firestore -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install evanca/flutter-ai-rules firebase-cloud-firestore --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/evanca/flutter-ai-rules.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/firebase-cloud-firestore .claude/skills/firebase-cloud-firestore && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
firebase-cloud-firestore
GitHub stars
647
Token cost
~2.2k tokens
SKILL.md length
705 words
Files
1
Skills in repo
37
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when setting up Firestore, designing schemas, doing CRUD, creating listeners, paginating queries, configuring indexes, enabling offline persistence, or writing security rules.

  • Works in 8 steps: Database Selection → Setup and Configuration → Document Structure → …
  • Setting up Firestore
  • SKILL.md covers When to Use, 1. Database Selection, 2. Setup and Configuration and 3. Document Structure, plus 6 more sections
  • Calls flutter; reaches github.com

What it does

Firebase Cloud Firestore is an agent skill from evanca/flutter-ai-rules. Use when setting up Firestore, designing schemas, doing CRUD, creating listeners, paginating queries, configuring indexes, enabling offline persistence, or writing security rules.

Its SKILL.md is about 2.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Mobile. It works with Cloud Firestore and Firebase. The repository describes itself as: Flutter AI Skills and Rules for Claude, Codex, Cursor, and Other AI-Powered IDEs. The licence is MIT.

When your agent uses it

  • Setting up Firestore
  • Designing schemas
  • Creating listeners
  • Paginating queries

Example prompts

  • “/firebase-cloud-firestore”

Workflow steps

8 steps, taken from the step headings in SKILL.md.

  1. Database Selection
  2. Setup and Configuration
  3. Document Structure
  4. Indexing
  5. Read and Write Operations
  6. Designing for Scale
  7. Real-time Updates
  8. Security

What it can do on your machine

Read from SKILL.md and the folder at commit 7b9cce2. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • flutter

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • github.com

    Also links to:

    • firebase.google.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Firebase Cloud Firestore loads about 2.2k tokens when it runs. Until then it costs about 51 tokens; SKILL.md has 705 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~51
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from evanca/flutter-ai-rules at commit 7b9cce2, republished under its MIT licence (© evanca). 705 words, ~2,187 tokens.

Download SKILL.mdSave it as .claude/skills/firebase-cloud-firestore/SKILL.md (or your agent's skills folder).
name
firebase-cloud-firestore
description
Use when setting up Firestore, designing schemas, doing CRUD, creating listeners, paginating queries, configuring indexes, enabling offline persistence, or writing security rules.
license
MIT

Firebase Cloud Firestore Skill

This skill defines how to correctly implement Cloud Firestore in Flutter applications, covering data modeling, queries, real-time updates, security rules, and scale optimization.

When to Use

Use this skill when:

  • Setting up and configuring Cloud Firestore in a Flutter project.
  • Designing document and collection structure or planning subcollections.
  • Performing read, write, batch, or transaction operations.
  • Implementing real-time listeners or paginated queries.
  • Optimizing for scale and avoiding write hotspots.
  • Writing or debugging Firestore security rules.

1. Database Selection

Choose Cloud Firestore when the app needs:

  • Rich, hierarchical data models with subcollections.
  • Complex queries: chaining filters, combining filtering and sorting on a property.
  • Transactions that atomically read and write data from any part of the database.
  • High availability (typical uptime 99.999%) or critical-level reliability.
  • Automatic scaling to millions of concurrent users.

Use Realtime Database instead for simple data models requiring simple lookups and extremely low-latency synchronization (typical response times under 10ms).


2. Setup and Configuration

flutter pub add cloud_firestore
dart
import 'package:cloud_firestore/cloud_firestore.dart';

final db = FirebaseFirestore.instance; // after Firebase.initializeApp()

Location:

  • Select the database location closest to users and compute resources.
  • Use multi-region locations for critical apps (maximum availability and durability).
  • Use regional locations for lower costs and lower write latency.

iOS/macOS: Consider pre-compiled frameworks to improve build times:

ruby
pod 'FirebaseFirestore',
  :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git',
  :tag => 'IOS_SDK_VERSION'

Offline persistence is enabled by default on mobile. Configure cache size:

dart
FirebaseFirestore.instance.settings = const Settings(
  persistenceEnabled: true,
  cacheSizeBytes: Settings.CACHE_SIZE_UNLIMITED,
);

3. Document Structure

  • Avoid document IDs . and .. (special meaning in Firestore paths).
  • Avoid forward slashes (/) in document IDs (path separators).
  • Do not use monotonically increasing document IDs (e.g., Customer1, Customer2) — causes write hotspots.
  • Use Firestore's automatic document IDs when possible:
dart
final docRef = await db.collection("users").add({
  'name': 'Ada Lovelace',
  'email': 'ada@example.com',
  'created_at': FieldValue.serverTimestamp(),
});
print('Created document with ID: ${docRef.id}');
  • Avoid these characters in field names (require extra escaping): . [ ] * `
  • Use subcollections within documents to organize complex, hierarchical data rather than deeply nested objects.

4. Indexing

  • Firestore queries are indexed by default; query performance is proportional to the result set size, not the dataset size.
  • Set collection-level index exemptions to reduce write latency and storage costs.
  • Disable Descending and Array indexing for fields that do not need them.
  • Exempt string fields with long values that are not used for querying.
  • Exempt fields with sequential values (e.g., timestamps) from indexing if not used in queries — avoids the 500 writes/second index limit.
  • Add single-field exemptions for TTL fields.
  • Exempt large array or map fields not used in queries — avoids the 40,000 index entries per document limit.

5. Read and Write Operations

Read All Documents in a Collection
dart
final querySnapshot = await db.collection("users").get();
for (var doc in querySnapshot.docs) {
  print("${doc.id} => ${doc.data()}");
}
Query with Filters
dart
final query = db.collection("users")
    .where("age", isGreaterThanOrEqualTo: 18)
    .orderBy("age")
    .limit(20);

final results = await query.get();
Cursor-Based Pagination
dart
// First page
final first = db.collection("cities").orderBy("name").limit(25);
final firstSnapshot = await first.get();

// Next page using last document as cursor
final lastDoc = firstSnapshot.docs.last;
final next = db.collection("cities")
    .orderBy("name")
    .startAfterDocument(lastDoc)
    .limit(25);
  • Do not use offsets for pagination — use cursors to avoid retrieving and being billed for skipped documents.
Write with Server Timestamp
dart
await db.collection("users").doc("user_1").set({
  'name': 'Grace Hopper',
  'updated_at': FieldValue.serverTimestamp(),
});
Batch Write (Atomic, Up to 500 Operations)
dart
final batch = db.batch();
batch.set(db.collection("cities").doc("LA"), {'name': 'Los Angeles'});
batch.update(db.collection("cities").doc("SF"), {'population': 860000});
batch.delete(db.collection("cities").doc("OLD"));
await batch.commit();
Show full SKILL.md (291 more words)Show less
Transaction
dart
await db.runTransaction((transaction) async {
  final snapshot = await transaction.get(db.collection("counters").doc("visits"));
  final currentCount = snapshot.get("count") as int;
  transaction.update(snapshot.reference, {"count": currentCount + 1});
});
  • Execute independent operations (e.g., a document lookup and a query) in parallel, not sequentially.
  • Be aware of write rate limits: ~1 write per second per document.
  • For writing a large number of documents, use a bulk writer instead of the atomic batch writer.

6. Designing for Scale

  • Avoid high read or write rates to lexicographically close documents (hotspotting).
  • Avoid creating new documents with monotonically increasing fields (like timestamps) at a very high rate.
  • Avoid deleting documents in a collection at a high rate.
  • Gradually increase traffic when writing to the database at a high rate — ramp up over 5 minutes.
  • Avoid queries that skip over recently deleted data — use start_at to find the correct start point.
  • Distribute writes across different document paths to avoid contention.
  • Firestore scales automatically to ~1 million concurrent connections and 10,000 writes/second.

7. Real-time Updates

dart
final subscription = db.collection("messages")
    .where("room", isEqualTo: "general")
    .orderBy("timestamp", descending: true)
    .limit(50)
    .snapshots()
    .listen((querySnapshot) {
      for (var change in querySnapshot.docChanges) {
        switch (change.type) {
          case DocumentChangeType.added:
            print("New message: ${change.doc.data()}");
            break;
          case DocumentChangeType.modified:
            print("Modified: ${change.doc.data()}");
            break;
          case DocumentChangeType.removed:
            print("Removed: ${change.doc.id}");
            break;
        }
      }
    });

// Detach when no longer needed:
subscription.cancel();
  • Limit the number of simultaneous real-time listeners.
  • Detach listeners when they are no longer needed to avoid memory leaks and unnecessary reads.
  • Use compound queries to filter data server-side rather than filtering on the client.
  • For large collections, use queries to limit the data being listened to — never listen to an entire large collection.

8. Security

  • Always use Firebase Security Rules to protect Firestore data.
  • Security rules do not cascade unless a wildcard is used.
  • If a query's results might contain data the user does not have access to, the entire query fails.

Example rules for user-owned documents:

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /users/{userId} {
      allow read, update, delete: if request.auth != null && request.auth.uid == userId;
      allow create: if request.auth != null;
    }
  }
}
  • Validate user input before submitting to Firestore to prevent injection attacks.
  • Use transactions for operations that require atomic updates to multiple documents.
  • Implement proper error handling for all Firestore operations.
  • Never store sensitive information in Firestore without proper access controls.

References

© evanca, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/firebase-cloud-firestore of evanca/flutter-ai-rules.

Open the folder on GitHubat commit 7b9cce2

Compare with similar skills

Firebase Cloud Firestore next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Firebase Cloud Firestore compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Firebase Cloud Firestore this skillevanca/flutter-ai-rules647—~2.2kAutomated safety check: PassMIT
Exposed MigrationGerardPaligot/Confily152—~1.3kAutomated safety check: PassApache-2.0
Kotlin LintingGerardPaligot/Confily152—~708Automated safety check: PassApache-2.0
Post Edit VerificationGerardPaligot/Confily152—~1.1kAutomated safety check: PassApache-2.0
Deployduyet/pricetrack139—~338Automated safety check: PassMIT
Firebase APK Security Scannertrailofbits/skills7.4k—~1.8kAutomated safety check: PassCC-BY-SA-4.0

Similar skills

  • Exposed Migration

    GerardPaligot/Confily

    A skill your agent uses when adding, removing, or modifying columns, indexes, or tables in any Exposed table object (files under infrastructure/exposed/ ending in Table.kt).

    152 GitHub stars~1.3k tokensUpdated 10 days ago
    MobileAuto-check passed
  • Kotlin Linting

    GerardPaligot/Confily

    A skill your agent uses whenever you write or modify Kotlin files in this project.

    152 GitHub stars~708 tokensUpdated 10 days ago
    MobileAuto-check passed
  • Post Edit Verification

    GerardPaligot/Confily

    Use this skill after every working session where Kotlin or Android code was created or modified, and ALWAYS before committing, opening a PR, or reporting work as done.

    152 GitHub stars~1.1k tokensUpdated 10 days ago
    MobileAuto-check passed
  • Deploy

    duyet/pricetrack

    Deploy functions, hosting, or full release to Firebase. An agent skill from duyet/pricetrack.

    139 GitHub stars~338 tokensUpdated 2 days ago
    Data & AnalyticsAuto-check passed
  • Official

    Scans Android APKs for Firebase security misconfigurations such as open databases, storage buckets, weak authentication and exposed cloud functions, for authorized testing only.

    7.4k GitHub stars~1.8k tokensUpdated 5 days ago
    SecurityAuto-check passed
  • Firebase App Platform

    sickn33/agentic-awesome-skills

    Build and operate apps on Firebase using Auth, Firestore, Cloud Functions, and Hosting.

    47k GitHub starsUsed in 2 repos~2.6k tokens
    Backend & APIsAuto-check: notes

More from evanca/flutter-ai-rules

All 37 skills in this repo
  • Code Review

    evanca/flutter-ai-rules

    A skill your agent uses when asked to review a PR, MR, branch, or diff, audit changed files, or check code quality.

    647 GitHub stars~2.4k tokensUpdated 23 days ago
    Auto-check passed
  • Developing Genkit Dart

    evanca/flutter-ai-rules

    A skill your agent uses when building AI agents in Dart, implementing Genkit flows or tools, integrating LLMs into Dart or Flutter applications, or using Genkit Dart plugins.

    647 GitHub stars~961 tokensUpdated 23 days ago
    Auto-check passed
  • Generate Images With Firebase AI

    evanca/flutter-ai-rules

    A skill your agent uses when generating or editing images from Flutter/Dart with Firebase AI Logic and a Gemini image model (Nano Banana), making the first call work, choosing Gemini Developer API…

    647 GitHub stars~2.3k tokensUpdated 23 days ago
    Auto-check passed
  • Flutter Use Column Row First

    evanca/flutter-ai-rules

    A skill your agent uses when building any Flutter screen or component to choose responsive Row, Column, Expanded, Flexible, and Spacer layouts before fixed-size or coordinate-based alternatives.

    647 GitHub stars~1.3k tokensUpdated 23 days ago
    Auto-check passed
  • Architecture Feature First

    evanca/flutter-ai-rules

    A skill your agent uses when creating a feature, designing folder structure, adding repositories/services/view models, wiring dependency injection, or deciding which layer owns logic.

    647 GitHub stars~1.9k tokensUpdated 23 days ago
    Auto-check passed
  • Bloc

    evanca/flutter-ai-rules

    A skill your agent uses when creating a Cubit or Bloc, modeling state with sealed classes or status enums, wiring BlocBuilder/BlocListener/BlocProvider, writing bloc tests, or choosing between Cubit…

    647 GitHub stars~2.8k tokensUpdated 23 days ago
    Auto-check passed

Categories

Questions about Firebase Cloud Firestore

What does Firebase Cloud Firestore do?

A skill your agent uses when setting up Firestore, designing schemas, doing CRUD, creating listeners, paginating queries, configuring indexes, enabling offline persistence, or writing security rules. Firebase Cloud Firestore is an agent skill from evanca/flutter-ai-rules. Use when setting up Firestore, designing schemas, doing CRUD, creating listeners, paginating queries, configuring indexes, enabling offline persistence, or writing security rules.

When should I use Firebase Cloud Firestore?

Firebase Cloud Firestore fits situations like: setting up Firestore; designing schemas; creating listeners; paginating queries.

How do I install Firebase Cloud Firestore in Claude Code?

Run `npx skills add evanca/flutter-ai-rules --skill firebase-cloud-firestore -a claude-code`. Or copy the skill folder (skills/firebase-cloud-firestore in evanca/flutter-ai-rules) into .claude/skills/firebase-cloud-firestore in your project. Claude Code loads it when a task matches its description.

How do I install Firebase Cloud Firestore in Codex?

Run `npx skills add evanca/flutter-ai-rules --skill firebase-cloud-firestore -a codex`. Or copy the skill folder (skills/firebase-cloud-firestore in evanca/flutter-ai-rules) into .agents/skills/firebase-cloud-firestore in your project. Codex loads it when a task matches its description.

Can I use Firebase Cloud Firestore in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add evanca/flutter-ai-rules --skill firebase-cloud-firestore -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/firebase-cloud-firestore, .gemini/skills/firebase-cloud-firestore, .github/skills/firebase-cloud-firestore and .opencode/skills/firebase-cloud-firestore in your project.

What does Firebase Cloud Firestore need to run?

Going by SKILL.md and its folder, Firebase Cloud Firestore needs the command-line tools its instructions call (flutter).

Does Firebase Cloud Firestore access the network?

SKILL.md names 2 domains. In commands or code: github.com; the agent is likely to contact it when it follows the instructions. As links in the text: firebase.google.com. This is read from the text; nothing was executed.

Is Firebase Cloud Firestore safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Firebase Cloud Firestore use?

Firebase Cloud Firestore is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Firebase Cloud Firestore use?

About 2.2k tokens (SKILL.md is roughly 8.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Firebase Cloud Firestore?

Skills that share tags, products or a category with Firebase Cloud Firestore: Exposed Migration (GerardPaligot/Confily, 152 stars), Kotlin Linting (GerardPaligot/Confily, 152 stars), Post Edit Verification (GerardPaligot/Confily, 152 stars) and Deploy (duyet/pricetrack, 139 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Firebase Cloud Firestore?

evanca (a GitHub user) maintains it in evanca/flutter-ai-rules, which has 647 GitHub stars. The repository holds 37 skills in this directory. The repository was last updated on September 14, 2026.

Source: evanca/flutter-ai-rules on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.