firebase-cost-optimization

Installation
SKILL.md

Firebase Cost Optimization

Minimum viable example

The single biggest cost lever in 90% of Firebase apps:

// BAD — every snapshot listener re-reads on every doc change
const unsubs = posts.map((p) => onSnapshot(doc(db, "posts", p.id), handlePost));

// GOOD — one query listener for all visible posts
const unsub = onSnapshot(
  query(collection(db, "posts"), where("authorId", "==", uid), limit(20)),
  (snap) => handleAll(snap.docs),
);

The bad pattern can scale to millions of reads/day before you notice. The good pattern is the same cost for any number of docs.

Installs
1
First Seen
Sep 12, 2026
firebase-cost-optimization — dentvega/firebase-agent-skills