Skip to main content

firebase-firestore

Sets up, manages, queries, and configures Cloud Firestore databases (Standard/Enterprise edition), including data modeling, security rules, indexes, and SDK integrations (Web, Admin, Python, iOS, Android, Flutter). Use when adding or migrating app databases, creating/listing Firestore databases, defining data models/indexes, writing SDK queries, or integrating Firestore SDKs. For authoring or modifying Firestore Security Rules (firestore.rules), delegate to the firestore-rules-author subagent if subagent delegation is available, or use firestore-rules-creation otherwise. Don't use for Data Connect, BigQuery, or standalone Hosting, Auth, Storage/GCS, Crashlytics, or Functions tasks.

FirebaseApache-2.0

SKILL.md

Written by Firebase and published in firebase/agent-skills under the Apache-2.0 license. Treq shows it unchanged except for heading levels and links to files on GitHub.

Cloud Firestore Database and Operations

[!IMPORTANT] Security Rules Authoring (firestore.rules) Whenever setting up a Firestore-backed app or creating/modifying firestore.rules, configure "firestore": { "rules": "firestore.rules" } in firebase.json and deploy firestore.rules (npx -y firebase-tools@latest deploy --only firestore:rules), even if server routes use the Admin SDK:

  • If subagent delegation AND the firestore-rules-author subagent are available: delegate authoring firestore.rules to the firestore-rules-author subagent rather than writing firestore.rules directly in the main agent.
  • If subagent delegation is unavailable (e.g., subagents not enabled in the IDE) OR firestore-rules-author is not installed: read and follow the firestore-rules-creation skill to write firestore.rules directly.

Before setting up dependencies, writing data models, or configuring security rules, you MUST always identify the Firestore instance edition.

1. Instance Selection and Edition Detection

Run the following command to list current Firestore databases:

npx -y firebase-tools@latest firestore:databases:list

A. Instance Found

  1. For each database found, inspect its edition and details:

    npx -y firebase-tools@latest firestore:databases:get <database-id>
    
  2. Ask the user which database instance they wish to target or if they would prefer to create a new instance.

  3. Once the target instance is established:

    • If the edition is STANDARD, follow the guides under references/standard/.
    • If the edition is ENTERPRISE or native mode, follow the guides under references/enterprise/.

B. No Instance Found (or New Requested)

If no databases exist or the user requests a new one, default to provisioning an Enterprise edition database and ask the user what location to use. Run npx -y firebase-tools@latest firestore:locations to get the list of options. Suggest colocating with other resources if applicable.

Once the location is determined, create the database:

npx -y firebase-tools@latest firestore:databases:create <database-id> --edition="enterprise" --location="<selected-location>"

Proceed with using the guides under references/enterprise/.


2. Specialized Guides

Based on the identified or created instance edition, open and read the corresponding reference guides:

Standard Edition (references/standard/)

Enterprise Edition / Native Mode (references/enterprise/)

When firebase-firestore runs

Claude Code and Codex keep each installed skill's name and description in context. When a request matches the description, the agent loads the full SKILL.md. You can also run it yourself: type /firebase-firestore in Claude Code or $firebase-firestore in Codex.

The description says when to use it:

Use when adding or migrating app databases, creating/listing Firestore databases, defining data models/indexes, writing SDK queries, or integrating Firestore SDKs.

Install firebase-firestore

Claude Code

Copy the firebase-firestore folder into .claude/skills/ in your project. To use it in every project, copy it into ~/.claude/skills/ instead.

git clone --depth 1 https://github.com/firebase/agent-skills.git /tmp/firebase-agent-skills
mkdir -p .claude/skills
cp -r /tmp/firebase-agent-skills/skills/firebase-firestore .claude/skills/

Codex

Codex reads skills from .agents/skills/ in your repository, and from ~/.agents/skills/ for every repository. It detects new skills on its own. Restart Codex if firebase-firestore does not appear.

git clone --depth 1 https://github.com/firebase/agent-skills.git /tmp/firebase-agent-skills
mkdir -p .agents/skills
cp -r /tmp/firebase-agent-skills/skills/firebase-firestore .agents/skills/

Treq

Open Settings and select the Skills tab. The tab appears when Skills installation is on under Settings → Feature Preview. Search for firebase-firestore and choose Install….

Install for repository writes the skill under .treq/skills/ in the current repository. Install for application makes it available to every repository on this machine. Each new workspace gets a copy in .claude/skills/ and .agents/skills/, so Claude Code and Codex both find it. See Installing Skills from the Library.

Files

firebase-firestore ships 15 files, 69.6 KB in total. Select a file to load it from GitHub.

references/enterprise/android_sdk_usage.md9.7 KBView on GitHub ↗

All skills by Firebase