$npx -y skills add firebase/agent-skills --skill firebase-firestoreSets up, manages, and executes queries against Cloud Firestore database instances, including advanced native full-text search and relational joins using pipelines. You MUST unconditionally activate this skill if you plan to use Firestore in any way. Use when listing or creating F
| 1 | # Cloud Firestore Database and Operations |
| 2 | |
| 3 | Before setting up dependencies, writing data models, or configuring security |
| 4 | rules, you MUST always identify the Firestore instance edition. |
| 5 | |
| 6 | ## 1. Instance Selection and Edition Detection |
| 7 | |
| 8 | Run the following command to list current Firestore databases: |
| 9 | `bash npx -y firebase-tools@latest firestore:databases:list` |
| 10 | |
| 11 | ### A. Instance Found |
| 12 | |
| 13 | 1. For each database found, inspect its edition and details: |
| 14 | `bash npx -y firebase-tools@latest firestore:databases:get <database-id>` |
| 15 | 1. Ask the user which database instance they wish to target or if they would |
| 16 | prefer to create a new instance. |
| 17 | 1. Once the target instance is established: |
| 18 | - If the **`edition`** is `STANDARD`, follow the guides under |
| 19 | `references/standard/`. |
| 20 | - If the **`edition`** is `ENTERPRISE` or native mode, follow the guides |
| 21 | under `references/enterprise/`. |
| 22 | |
| 23 | ### B. No Instance Found (or New Requested) |
| 24 | |
| 25 | If no databases exist or the user requests a new one, default to provisioning an |
| 26 | **Enterprise** edition database and ask the user what location to use. Run |
| 27 | `npx -y firebase-tools@latest firestore:locations` to get the list of options. |
| 28 | Suggest colocating with other resources if applicable. |
| 29 | |
| 30 | Once the location is determined, create the database: |
| 31 | `bash npx -y firebase-tools@latest firestore:databases:create <database-id> --edition="enterprise" --location="<selected-location>"` |
| 32 | |
| 33 | Proceed with using the guides under `references/enterprise/`. |
| 34 | |
| 35 | ______________________________________________________________________ |
| 36 | |
| 37 | ## 2. Specialized Guides |
| 38 | |
| 39 | Based on the identified or created instance edition, open and read the |
| 40 | corresponding reference guides: |
| 41 | |
| 42 | ### Standard Edition (`references/standard/`) |
| 43 | |
| 44 | - **Provisioning**: Read [provisioning.md](references/standard/provisioning.md) |
| 45 | - **Security Rules**: Read |
| 46 | [security_rules.md](references/standard/security_rules.md) |
| 47 | - **SDK Usage**: Read [web_sdk_usage.md](references/standard/web_sdk_usage.md), |
| 48 | [android_sdk_usage.md](references/standard/android_sdk_usage.md), |
| 49 | [ios_setup.md](references/standard/ios_setup.md), or |
| 50 | [flutter_setup.md](references/standard/flutter_setup.md) |
| 51 | - **Indexes**: Read [indexes.md](references/standard/indexes.md) |
| 52 | |
| 53 | ### Enterprise Edition / Native Mode (`references/enterprise/`) |
| 54 | |
| 55 | - **Provisioning**: Read |
| 56 | [provisioning.md](references/enterprise/provisioning.md) |
| 57 | |
| 58 | - **Data Model**: Read [data_model.md](references/enterprise/data_model.md) |
| 59 | |
| 60 | - **Security Rules**: Read |
| 61 | [security_rules.md](references/enterprise/security_rules.md) |
| 62 | |
| 63 | - **SDK Usage**: |
| 64 | |
| 65 | > [!CRITICAL] **Mandatory Reference Reading** Before writing or modifying any |
| 66 | > application code for Firestore Enterprise Edition, you **MUST** read at |
| 67 | > least one of the relevant reference documents below for the target |
| 68 | > platform/language to understand specific architectural requirements and |
| 69 | > pipeline initialization patterns. |
| 70 | |
| 71 | Read [web_sdk_usage.md](references/enterprise/web_sdk_usage.md), |
| 72 | [python_sdk_usage.md](references/enterprise/python_sdk_usage.md), |
| 73 | [android_sdk_usage.md](references/enterprise/android_sdk_usage.md), |
| 74 | [ios_setup.md](references/enterprise/ios_setup.md), or |
| 75 | [flutter_setup.md](references/enterprise/flutter_setup.md) |
| 76 | |
| 77 | - **Indexes**: Read [indexes.md](references/enterprise/indexes.md) |