Prev
Next
Stack of dark charcoal AI prompt cards with golden amber code brackets connected to Firebase and database icons

Firebase & Firestore AI Prompts for Coding Agents (2026)

Copy-paste AI prompts to configure Firebase Auth, FCM push notifications, and Firestore security rules via Firebase CLI or Admin SDK.

Muhammad Hassaan
Muhammad HassaanMH Labs
•4 min read

This page collects the full, copy-paste AI agent prompts for our Firebase and Firestore setup guides. Drop any of these into Cursor, Claude Code, or Copilot to automate configuration, security rules, and deployment checks without skipping critical safety steps.


Set Up Firebase in Simple Expo Kit

Use this prompt alongside Set Up Firebase, Auth, FCM & Firestore in Simple Expo Kit.

prompt
Use https://muhammadhassaan.com/blog/setting-up-firebase-auth-push-notification-firestore-in-simple-expo-kit to configure Firebase Auth, Push Notifications (FCM V1), and Firestore in my Simple Expo Kit project. Follow the exact process in the guide: 1. Verify `google-services.json` and `GoogleService-Info.plist` are in the project root, and `admin/google-service-key.json` is in `admin/` and listed in `.gitignore`. For any web/JS client config where Google does not provide a file, store the public values in `.env` variables rather than hardcoding them. 2. Check `.env` for `EXPO_PUBLIC_GOOGLE_WEB_CLIENT_ID` and confirm `app.json` has the matching `iosUrlScheme` (`com.googleusercontent.apps.<web-client-id-prefix>`). 3. Help me run `eas credentials` for FCM V1 and extract my Android `SHA-1` fingerprint with `keytool`, then remind me to re-download `google-services.json` after adding the fingerprint in Firebase Console. Double check every file path and secret before running any build commands, and ask me before executing interactive logins.

Set Up Firestore Rules With Firebase CLI

Use this prompt alongside How to Set Up Firestore Security Rules With Firebase CLI.

Option A: Starting a New Firebase Project

prompt
Use https://muhammadhassaan.com/blog/how-to-setup-firestore-rules to set up Firestore security rules for my new project using Firebase CLI. Follow the exact process in the guide: 1. Verify `google-service-account-key.json` is in the project root and added to `.gitignore` immediately. 2. Create or update `.env` with `FIREBASE_SERVICE_ACCOUNT_PATH=./google-service-account-key.json`. 3. Run `npx firebase login` and wait for me to authenticate. 4. Initialize rules and indexes with `npx firebase init firestore`. 5. Write a starter `firestore.rules` file with `rules_version = '2'`, a default deny-all rule, a public `app_config` read rule, and a user-scoped `users/{userId}` rule. 6. Add `"deploy:rules": "npx firebase deploy --only firestore:rules"` to `package.json`. Review the generated `firestore.rules` with me before running `npm run deploy:rules`.

Option B: Using an Existing Firebase Project

prompt
Use https://muhammadhassaan.com/blog/how-to-setup-firestore-rules to set up Firestore security rules for my existing Firebase project (`[INSERT_PROJECT_ID_HERE]`). Follow the exact process in the guide: 1. Verify `google-service-account-key.json` is in the project root and added to `.gitignore`. 2. Create or update `.env` with `FIREBASE_SERVICE_ACCOUNT_PATH=./google-service-account-key.json`. 3. Run `npx firebase login`, then `npx firebase use [INSERT_PROJECT_ID_HERE]`. 4. Run `npx firebase init firestore` to initialize local rules and indexes. 5. Write a starter `firestore.rules` file with `rules_version = '2'`, default deny, public `app_config` read, and user-scoped access rules. 6. Add the `deploy:rules` script to `package.json`. Double check `.gitignore` and review the rules with me before running a test deploy.

Deploy Firestore Rules With Firebase Admin SDK

Use this prompt alongside Deploy Firestore Rules With Firebase Admin SDK (No CLI).

prompt
Use https://muhammadhassaan.com/blog/deploy-firestore-rules-with-admin-sdk to set up programmatic Firestore rules deployment with `firebase-admin` (without `firebase-tools`). Follow the exact process in the guide: 1. Verify `google-service-keys.json` is in `admin/` and added to `.gitignore`. 2. Create or update `admin/.env` with `FIREBASE_SERVICE_ACCOUNT_PATH=./google-service-keys.json` for local runs, and support `FIREBASE_SERVICE_ACCOUNT_BASE64` (base64-encoded JSON string) for GitHub Actions and server environments. 3. Ensure `firebase-admin` is installed in `admin/` and `admin/lib/firebase.ts` initializes the Admin SDK cleanly from either `FIREBASE_SERVICE_ACCOUNT_BASE64` or `FIREBASE_SERVICE_ACCOUNT_PATH`. 4. Create `admin/scripts/deploy-rules.ts` using `admin.securityRules().releaseFirestoreRulesetFromSource()` to read and deploy `admin/firebase/firestore.rules`. 5. Write a starter `firestore.rules` file with `rules_version = '2'`, default deny-all, public `app_config`, and user-scoped access. 6. Add `"deploy:rules": "ts-node scripts/deploy-rules.ts"` to `admin/package.json`. Review the deployment script and `firestore.rules` with me before running `npm run deploy:rules`.

Write Firestore Security Rules for Your Project

Use this prompt alongside Mastering Firestore Security Rules: Patterns & Examples.

prompt
Use https://muhammadhassaan.com/blog/mastering-firestore-security-rules to analyze my Firestore collections and write my `firestore.rules` file. Follow the exact patterns in the guide: 1. Inspect my existing Firestore collections, data models, or TypeScript types. 2. Classify each collection as System Data (app configs, metadata, services) or User Data (scoped by `userId`). 3. Write a complete `firestore.rules` file using `rules_version = '2'`: - Default deny-all rule (`match /{document=**}`). - System collections: public or authenticated read, deny client write. - User collections: read and write only when `request.auth != null && request.auth.uid == userId`. - Field-level validation where types and bounds are known, while avoiding unnecessary `get()` or `exists()` chains that burn Spark plan read quota. 4. Place the file in my project and verify my existing `deploy:rules` script. Show me the complete rules and explain each section before deploying.

Insights, Playbooks, Tips & Kits

Want real patterns from my journey building and selling SaaS & apps. DIY playbooks, code-ready starter kits, and the operational moves that let you scale without the overhead. For builders who learn best from firsthand mistakes, real wins & experience.