moai-platform-firestore

Implement Firestore NoSQL patterns for real-time sync, offline caching, and Security Rules.

Updated Jun 18, 2026
One-click install
npx skills add https://github.com/h102-log/pdfrag --skill moai-platform-firestore-h102-log
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: moai-platform-firestore
Source: https://github.com/h102-log/pdfrag/tree/main/.claude/skills/moai-platform-firestore
Command: npx skills add https://github.com/h102-log/pdfrag --skill moai-platform-firestore-h102-log

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Building mobile-first applications with Firebase Firestore requires correctly handling real-time synchronization, offline persistence, access control, and atomic multi-document operations, which are easy to misconfigure and can lead to security holes or data inconsistency. ## Core Features & Use Cases - Security Rules Authoring: Declarative field-level access control with role-based patterns, custom claims, data validation, and emulator-based rule testing. - Offline & Real-time Patterns: Persistent IndexedDB caching with multi-tab managers, snapshot listeners with metadata tracking, and sync status indicators. - Transactions & Batch Operations: Atomic writes, distributed sharded counters, idempotent operations, and chunked bulk updates. - Use Case: When building a collaborative task management app, use this Skill to configure offline persistence, subscribe to real-time task updates with pending-write indicators, and enforce per-user Security Rules. ## Quick Start Ask the AI to set up a Firestore database with offline persistence, real-time listeners, and role-based Security Rules for your application.

Frequently Asked Questions about moai-platform-firestore

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enable offline persistence in Firestore?▼

Enable offline persistence by calling initializeFirestore with persistentLocalCache, optionally adding persistentMultipleTabManager for multi-tab support and CACHE_SIZE_UNLIMITED for cache size. On Flutter, set persistenceEnabled to true in the Firestore settings.

How do I write Firestore Security Rules for role-based access?▼

Write role-based Security Rules by storing roles in custom claims via the Admin SDK or in member documents, then checking request.auth.token or using get() on membership documents inside match blocks. Test rules with the Firebase emulator and @firebase/rules-unit-testing.

What is the difference between Firestore transactions and batch writes?▼

Transactions read current document values and retry automatically on conflicts, making them suitable for operations dependent on existing data. Batch writes execute up to 500 operations atomically without reads, making them better for bulk updates.

Does Firestore support real-time listeners with offline data?▼

Yes, Firestore onSnapshot listeners work offline by serving data from the local cache. Set includeMetadataChanges to true to detect hasPendingWrites and fromCache flags, which indicate whether data is synced or still local.

Why does my Firestore transaction fail with an error?▼

Transactions fail when a read occurs after a write, when documents change during execution causing aborted errors, or when preconditions fail. Ensure all transaction.get calls happen before any writes and handle aborted errors with retries.

What are the limits of Firestore batch writes and transactions?▼

Both batch writes and transactions support a maximum of 500 documents per operation. For larger updates, split operations into chunks of 500 and commit each batch sequentially.