
Firebase Firestore
Add Cloud Firestore to an Android Kotlin app with BoM dependencies, CLI enablement, and a working client instance.
Overview
Firebase-firestore is an agent skill for the Build phase that guides solo builders through enabling Firestore and integrating the Kotlin Android SDK.
Install
npx skills add https://github.com/firebase/agent-skills --skill firebase-firestoreWhat is this skill?
- Enables Firestore on the Firebase project via `npx firebase-tools@latest init firestore`
- Adds Firebase BoM and `firebase-firestore` to module `build.gradle.kts`
- Shows Kotlin initialization with `Firebase.firestore` in an Activity or Fragment
- Targets Firestore Enterprise Native Mode using the standard Cloud Firestore Android SDK
- Reminds agents to fetch the latest BoM version from Firebase release notes before pinning
- Documents a 2-step flow: CLI enablement plus Gradle dependency and Kotlin initialization
- References checking latest Firebase Android BoM from official release notes before pinning
Adoption & trust: 37k installs on skills.sh; 345 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your Android app needs Firestore but the Firebase service is not enabled and Gradle dependencies are missing or outdated.
Who is it for?
Indie developers building Kotlin Android apps who want a minimal, ordered Firestore bootstrap without reading the entire Firebase docs tree.
Skip if: Web, iOS, or Python Firestore setups, or full security-rules and data-model design (use the enterprise native mode skill instead).
When should I use this skill?
User is building an Android Kotlin app and needs Firestore dependencies, CLI enablement, or client initialization patterns from the Firebase agent-skills pack.
What do I get? / Deliverables
You have Firestore enabled in the project, BoM dependencies declared, and a Kotlin `Firebase.firestore` instance ready for reads and writes.
- Firestore-enabled Firebase project step
- app/build.gradle.kts dependency block
- Kotlin Firestore initialization snippet
Recommended Skills
Journey fit
How it compares
Android setup slice of Firebase docs—not a full enterprise provisioning and rules playbook.
Common Questions / FAQ
Who is firebase-firestore for?
Solo builders creating Android apps with Kotlin who need Cloud Firestore dependencies and initialization code, not a cross-platform architecture course.
When should I use firebase-firestore?
During Build backend work when you first connect an Android client to Firestore or refresh BoM and Gradle wiring after upgrading Firebase.
Is firebase-firestore safe to install?
Check the Security Audits panel on this page; the skill instructs CLI init and Gradle changes that affect how your app talks to Google Firebase.
Workflow Chain
Then invoke: firebase firestore enterprise native mode
SKILL.md
READMESKILL.md - Firebase Firestore
# Firestore Enterprise Native Mode on Android (Kotlin) This guide walks you through using the Cloud Firestore SDK in your Android app using Kotlin. The SDK for Firestore Enterprise Native Mode is the same as the standard Cloud Firestore SDK. ### Enable Firestore via CLI Before adding dependencies in your app, make sure you enable the Firestore service in your Firebase Project using the Firebase CLI: ```bash npx -y firebase-tools@latest init firestore ``` --- ### 1. Add Dependencies In your module-level `build.gradle.kts` (usually `app/build.gradle.kts`), add the dependency for Cloud Firestore: ```kotlin dependencies { // [AGENT] Fetch the latest available BoM version from https://firebase.google.com/support/release-notes/android before adding this implementation(platform("com.google.firebase:firebase-bom:<latest_bom_version>")) // Add the dependency for the Cloud Firestore library implementation("com.google.firebase:firebase-firestore") } ``` --- ### 2. Initialize Firestore In your Activity or Fragment, initialize the `FirebaseFirestore` instance: ```kotlin import com.google.firebase.firestore.FirebaseFirestore import com.google.firebase.firestore.ktx.firestore import com.google.firebase.ktx.Firebase class MainActivity : AppCompatActivity() { private lateinit var db: FirebaseFirestore override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) val db = Firebase.firestore setContent { MaterialTheme { Text("Firestore initialized!") } } } } ``` #### Jetpack Compose (Modern) Initialize inside a `ComponentActivity` using `setContent`: ```kotlin import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import com.google.firebase.Firebase import com.google.firebase.firestore.firestore class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) val db = Firebase.firestore setContent { MaterialTheme { Text("Firestore initialized!") } } } } ``` --- ### 3. Basic CRUD Operations The operations are identical to standard Firestore. #### Add Data ```kotlin val user = hashMapOf( "first" to "Alan", "last" to "Turing", "born" to 1912 ) db.collection("users") .add(user) .addOnSuccessListener { documentReference -> Log.d(TAG, "DocumentSnapshot added with ID: ${documentReference.id}") } .addOnFailureListener { e -> Log.w(TAG, "Error adding document", e) } ``` #### Read Data ```kotlin db.collection("users") .get() .addOnSuccessListener { result -> for (document in result) { Log.d(TAG, "${document.id} => ${document.data}") } } .addOnFailureListener { exception -> Log.w(TAG, "Error getting documents.", exception) } ``` #### Update Data ```kotlin val userRef = db.collection("users").document("your-document-id") userRef .update("born", 1913) .addOnSuccessListener { Log.d(TAG, "DocumentSnapshot successfully updated!") } .addOnFailureListener { e -> Log.w(TAG, "Error updating document", e) } ``` #### Delete Data ```kotlin db.collection("users").document("your-document-id") .delete() .addOnSuccessListener { Log.d(TAG, "DocumentSnapshot successfully deleted!") } .addOnFailureListener { e -> Log.w(TAG, "Error deleting document", e) } ``` # Firestore Data Model Reference Firestore is a NoSQL, document-oriented database. Unlike a SQL database, there are no tables or rows. Instead, you store data in **documents**, which are organized into **collections**. ## Document Data Model Data in Firestore is organized into documents, collections, and subcollections. ### Docu