/be:firestore-audit [phase] [path]from Backend Skills
Manually invoked. Firestore audit — clients denied and the data layer the only caller, one Admin client, Timestamps converted before parsing, reads that match the response (batched, chunked at 30, counted, projected), transactions, counters and batches over 500, drift repair, cursor pagination, TTL and cascade deletes, idempotent triggers, indexes by edition, rules and their tests, and backups. Verifies each finding and writes a prioritised report.
Ships in Backend Skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Run this only when the user asks for it by name. It writes a report and changes no code; fixing a finding is a separate request.
A manually-invoked, red-team Firestore audit of an app or a specific diff/PR. It is self-contained — every check is spelled out inline, so it runs a full review with zero other skills installed — and each finding is verified against the real code before it lands in a phase-aware, scored report at _reports/firestore-audit.md.
Self-contained — this checklist is comprehensive on its own and needs no other skill installed. Where
firestoreis installed, apply its house rules too; rule internals go tofirebase-security-rules-auditor(the official Firebase skill, where installed).
Before applying this skill, read the project's root AGENTS.md, the AGENTS.md closest to the files in question, and any doc they link for this skill's topic. Names, values and choices — budgets, tiers, tokens, voice, paths — come from those files, never from this skill.
[phase] — development | production; sets the action-item tiers. Omitted → the audit phase the project's AGENTS.md records, else production (assume the app is live until told otherwise — the safer default).[path] — a file, directory, or PR/diff to scope the audit to; omitted → the whole repo.Mindset — reviewer/attacker first. Don't assume code is fine because it looks careful; find the sequence that breaks it. Report only findings you can justify as real, each verified before it lands.
development | production) if given; else the audit phase the project's AGENTS.md records; else production — assume the app is live with real users until told otherwise, so a CRITICAL finding gets Fix-Now urgency instead of a pre-launch discount. Phase sets the action-item tiers._reports/firestore-audit.md exists, read it, but still run every check against the source. Use it only to keep the ID of each finding still present (status UNRESOLVED), carry its WON'T FIX findings forward unchanged — never re-raised as new findings — drop its FIXED findings and any no longer present, continue ID numbering from its highest ID, and take its scores for the score-change row. First run → mark all NEW.file:line evidence.AGENTS.md or a doc it links._reports/firestore-audit.md — overwriting the whole file, so no resolved history accumulates — and post the chat summary (see Output). Recommend fixes in the report; never modify code. Never commit or push without explicit approval.Findings are ordered worst-first in the report.
Write to _reports/firestore-audit.md, with one Overall row in the score change:
# Firestore audit — <app/scope>
**Date:** <YYYY-MM-DD> · **Phase:** <phase> · **Mode:** Report-only · **Branch:** `<branch>` · **Scope:** <what was audited> · **Overall:** <X>/10
## Score change (previous → current)
| Metric | Previous | Current | Δ | Trend |
| --- | --- | --- | --- | --- |
| Overall | <prev/10 or N/A> | <cur/10> | <+N / -N / 0> | <▲ / ▼ / ■ / N/A> |
## Findings
| ID | Severity | Category | Status | Issue | Location |
| --- | --- | --- | --- | --- | --- |
| 1 | HIGH | <category> | NEW | <one-line issue> | `file/path:line` |
**Status:** `NEW` — found this run for the first time · `UNRESOLVED` — still present from an earlier run · `FIXED` — fixed after the audit; the note names the commit · `WON'T FIX` — the owner ruled it not a defect, intended, or accepted as it is; the note gives their reason
### F1 — <title>
- **What:** <the defect, and the concrete evidence that proves it real>
- **Why it matters:** <impact / who it affects> <· optional ref, e.g. Firestore best practices / OWASP A01>
- **Fix:** <the specific remediation>
- **Note:** <only once `FIXED` (the commit and what changed) or `WON'T FIX` (the owner's reason)>
## Scorecard
| Category | Score | Notes |
| --- | --- | --- |
| Access boundary | <X>/10 | <one-line justification> |
| Reads | <X>/10 | <one-line justification> |
| Writes and atomicity | <X>/10 | <one-line justification> |
| Pagination | <X>/10 | <one-line justification> |
| Lifecycle | <X>/10 | <one-line justification> |
| Indexes | <X>/10 | <one-line justification> |
| Security rules | <X>/10 | <one-line justification> |
| Backups | <X>/10 | <one-line justification> |
## Action items
Tiers by phase — `development` → **Fix Now / Before Launch / Post-Launch**; `production` → **Fix Now / Next Release / Backlog**. Each task references a finding ID.
### <Tier>
| # | Priority | Task (finding ID) | Effort |
| --- | --- | --- | --- |
Every run produces two things:
_reports/firestore-audit.md, in the format above, overwriting the prior run.<X>/10 (with Δ vs last run), a severity count (Critical / High / Medium / Low, i.e. C / H / M / L), the top findings worst-first (id · severity · one-line · file:line), and the report path. Note any "needs confirmation" items.Report-only — this audit recommends fixes in the report; it never modifies code.
Trace each endpoint through route → service → data function, counting Firestore operations. The fix target is firestore, with its references/patterns.md.
collection() or doc() in a route, action, component or service.globalThis, with ignoreUndefinedProperties: true; credentials from the platform (Application Default Credentials), never a key file in the repo or a public variable.Timestamp converted to an ISO string first; flag a Timestamp reaching a contract or a response.getAll, in); in and array-contains-any chunked at 30 (Firestore's cap) and run in parallel, getAll chunked where the project chooses; counts with count().get(); filters and sorts in the query, never in memory; .select() where a large document is read for a few fields; lists through a .pick() projection.orderBy silently drops those without it.create() or a transaction; counters use FieldValue.increment().serverTimestamp() on writes, Timestamp.now() inside a transaction; createdAt and owner fields never change after create.BulkWriter.limit + 1 to detect more, documentId() as the tie-breaker — with a capped page size. Every list query has a limit; a bounded lookup (an in chunk, a create(), a recount job walking a collection in pages) isn't a finding.expiresAt per collection group, set from a retention constant, reads still filtering expiresAt > now. TTL doesn't cascade, so a parent with subcollections needs its own cleanup. Whether the policy is set on every tier is console state — check with gcloud firestore fields ttls list, else "needs confirmation".firestore.indexes.json, changed in the same PR: an equality filter with a range or an orderBy, or several ranges. Queries of equality filters alone can merge single-field indexes and need no entry. On the Standard edition a missing index throws FAILED_PRECONDITION in production — the emulator doesn't enforce indexes — so such a query without an entry is HIGH. On the Enterprise edition an index is optional, a speed and cost choice.--force on production.request.auth (the token), not a get(); size and type caps on every field; createdAt, owners and roles unchanged; append-only collections write: false; hasOnly always paired with ownership. rules_version = '2'.@firebase/rules-unit-testing) in CI, covering a signed-out caller and another account, with assertSucceeds for each caller a rule allows; --dry-run alone isn't a test. Whether the console matches the repo's rules file can't be seen from code — "needs confirmation". Rule internals → firebase-security-rules-auditor (the official Firebase skill, where installed).gcloud firestore databases describe and gcloud firestore backups schedules list, else "needs confirmation". A restore goes into a new database; whether it's been rehearsed is process, "needs confirmation". A migration that reshapes documents ships with its way back or is recorded as one-way.Fixing is a separate request, after the report is written, and covers only the findings the owner chose. Then update the report in place — never re-run the audit to update it: a re-run re-checks the whole codebase, costs a full audit and raises new findings mid-fix. Mark each fixed finding FIXED with its commit and a one-line note of what changed, mark a finding the owner rules out WON'T FIX with their reason, and leave everything else as it stands. Recompute the scorecard categories the fixes touched and the Overall, and rewrite the one score-change row (previous → current) — never add a second row.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub timonwa/engineering-skills --plugin be22 skills in this plugin
/access-controlAccess control for a Next.js API on Firebase — roles, relationships and attributes (RBAC, ReBAC, ABAC) behind permission verbs and one pure can(); guards as the only gate, 404 before 403; tenant scoping; invitations; escalation limits; two-person approval and access reviews; stale claims; API-key scopes; share links and passcodes; where plan and flag checks sit; UI gates that only hide; and tests. Use when adding a permission, role, guarded route, API key, share link, or a control only some people see./access-control-auditManually invoked. Access-control audit — guards on every route and Server Action (BFLA), 404 before 403 and tenant scoping (BOLA), allowlisted writes and projected reads (BOPLA), verbs never role names, roles that add up, escalation and invitations, claims and revocation, sessions and sign-in, API keys and share links, the plan and flag order, UI gates, data rules and the tests. Verifies each finding and writes a prioritised report./api-architectureHow an API route is built in a Next.js API — the fixed order of rate limit, authorise, validate, delegate, audit, respond; thin routes over services; the response envelope and typed errors; caching headers; concurrent edits; long-running work; cursor pagination and allowlisted sorts; resource paths, versions, deprecation and state-transition sub-routes; and what every new route ships with. Cron, webhooks and audit logs are references. Use when adding, changing or reviewing a route handler or the API layer's structure.Other plugins' skills for the same job