rolandtolnay/llm-toolkit/firebase-admin
Claude Code and agent skill by rolandtolnay/llm-toolkit
- community
Checking that the SKILL.md file is still in the repository.
Inspect and repair Firestore data, Auth users and Storage objects in a Firebase project, or run Admin SDK JavaScript against it. Use for Firebase data investigation and requested data or account repairs, not deployment, emulator lifecycle or infrastructure.
Install
npx vskill@latest install rolandtolnay/llm-toolkit/firebase-adminSKILL.md
The same SKILL.md was published earlier as rolandtolnay/llm-toolkit/firebase-admin.
Firebase Admin Agent CLI
A JSON CLI for Firebase data work. It exists so an agent can investigate and repair Firestore, Auth and Storage without ad hoc scripts, and so every result names the project, database, bucket and identity it ran against. Commands run with the selected identity's real IAM permissions. Reads and emulator-routed writes are routine; confirm a live write unless the user's request already names that change.
Entry point
One-time setup (Node 22+), then run from the consumer project directory:
Examples below use node "$CLI". Each command prints one JSON envelope on stdout: {success, command, result} or {success:false, command, error:{code, message, suggestions?}} with exit status 1. Branch on code; the message includes the service's own explanation, such as the link that creates a missing index, with tokens masked. Diagnostics, including script console.log, go to stderr. Large inputs go in files: --file input.json instead of --data '...'.
Targeting
context reports the resolved project, database, bucket, identity source and emulator endpoints. It proves resolution, not IAM access. Run it in a repository you have not used this session or after switching accounts, and pass --project whenever the report differs from the intended target: a project saved by firebase use in an ancestor directory overrides the repository's .firebaserc.
- Project:
--project ID-or-alias, then the Firebase CLI active project inherited up the directory tree, then legacyfirebase.jsondefaults, then a single.firebasercalias or itsdefault. Missing or ambiguous selection fails rather than guessing. The Firebase root is the nearest ancestor containingfirebase.json. - Identity: one of
--account exact-email,--credential service-account.json,--adc; then an explicitly setGOOGLE_APPLICATION_CREDENTIALS; then the Firebase login selected for this root or the global default login; ADC only when no Firebase login exists. A selected identity that is missing, expired or denied fails; nothing falls back to another identity. - Resources:
--database NAMEand--bucket NAME, or a.firebase-admin.jsonin the root keyed by project ID:{"PROJECT_ID":{"database":"named-db","bucket":"EXACT_BUCKET_NAME"}}. Only the entry for the resolved project applies. Bucket names are never derived from the project ID.
Emulators: set FIRESTORE_EMULATOR_HOST, FIREBASE_AUTH_EMULATOR_HOST and FIREBASE_STORAGE_EMULATOR_HOST to host:port, or pass --firestore-emulator, --auth-emulator, --storage-emulator. --emulator-only and any demo- project use no live identity and refuse a service whose endpoint is unset; exec needs all three. Start and stop emulators with firebase emulators:start|exec.
ADC from plain gcloud auth application-default login is rejected by Firebase Auth. Use gcloud auth application-default login --client-id-file=/path/to/desktop-oauth-client.json or select a service-account credential; the CLI creates no keys or IAM grants.
Reads
Paths, IDs and collection names are literal; nothing appends suffixes or infers an environment from a name. Filters are ANDed with operators ==, !=, <, <=, >, >=, in, not-in, array-contains, array-contains-any; server index constraints still apply. Compose anything more complex in JavaScript.
Pages default to 25 items (max 1000) and return count for the page plus pageInfo: {hasNextPage, endCursor, consistency:"live"}. To continue, repeat the same options with --after END_CURSOR; cursors are opaque and bound to the query. Nothing auto-exhausts pages, so stop paging once you have what the question needs. count answers how-many questions without reading documents.
Writes
createfails if the document exists.replacesets the whole document.mergeupserts the supplied fields.patchrequires an existing document; dotted keys update nested fields, a map value replaces that map, and{"$type":"delete"}removes a field wherenullstores null.deleteremoves one document and leaves its subcollections.patchanddeleteaccept--preconditionwithupdateTimefrom a previous read orexists. UsepatchwithupdateTimefor a repair that must not overwrite a concurrent change;replaceandmergeare unconditional.- A batch is one Firestore commit: all operations apply or none do, and oversized input is rejected rather than split. Auth and Firestore changes are never atomic together.
- Auth data is ordinary Admin SDK user properties;
claims-setreplaces all claims (--data nullclears them). Storage transfers move bytes to the named file or object and return metadata;--if-generation-matchguards against concurrent changes, anddownloadoverwrites the local file.
A receipt carries the resolved target, the resource identity and completion evidence; it is the verification for a write. A timeout, a killed process or an OUTCOME_UNKNOWN error means the write may have landed: read the resource before retrying, because the CLI never replays a mutation and nothing is rolled back.
Admin writes bypass security rules and application-layer logic, and Firestore or Storage triggers may run on them. Check how the application maintains derived data before repairing it directly.
Firebase JSON values
Ordinary JSON stays ordinary data. Special values use exact shapes:
| Value | JSON | |
|---|---|---|
| Timestamp (nanosecond precision) | {"$type":"timestamp","seconds":1700000000,"nanoseconds":123} | |
| Document reference | {"$type":"reference","project":"PROJECT_ID","database":"(default)","path":"records/one"} | |
| Bytes | {"$type":"bytes","base64":"AAH/"} | |
| GeoPoint | {"$type":"geopoint","latitude":1.2,"longitude":3.4} | |
| Int64 beyond safe JS range | {"$type":"integer","value":"9223372036854775807"} | |
| Double with a whole-number value | {"$type":"double","value":5} | |
Ordinary map with a $type key | {"$type":"map","value":{"$type":"ordinary-data"}} | |
| Remove field | {"$type":"delete"} | |
| Server time | {"$type":"serverTimestamp"} | |
| Increment | {"$type":"increment","value":1} | |
| Array transforms | {"$type":"arrayUnion","values":["a"]} / {"$type":"arrayRemove","values":["a"]} |
Data read from a document can be written back unchanged: reads tag whole-number doubles because an untagged 5 is written as an int64, which breaks clients that expect a double. References must belong to the selected project and database. Transforms are write-only. Unsupported values, such as NaN or vectors, fail instead of being coerced; read them through JavaScript.
Sensitive outputs
These return links and tokens marked sensitive: true; keep them out of tickets, logs and chat unless the user asked for them. A custom token is exchanged by a client sign-in flow; it is not an ID token. Signing needs a service-account credential or IAM signing setup, and a SIGNING_FAILED error names the fix. Routine user listings omit password material and claims; Storage output omits download tokens. Script output may contain anything the script returns.
JavaScript
The script is an async function body. Return plain data (for example snapshot.data()), which is serialized with the value table above into result.value; whole-number doubles returned this way appear as plain numbers. Bindings: app, db (the selected database), auth, storage, bucket (or null), target, sdk (Admin app and Firestore helpers plus getMessaging), and require. Relative require and import() paths resolve from the skill, so load consumer files by absolute path. A script that throws reports OUTCOME_UNKNOWN with the error text, because nothing proves which of its writes landed first. Use the supplied db and storage rather than re-initializing them: Admin's convenience initializers reject the Firebase-login credential. Transactions, Messaging and other Admin services live here.
Scripts are trusted code with full process access. There is no sandbox, read-only mode, dry run or rollback, and emulator routing does not constrain what a script does.
Scope
Use firebase for deployment, emulator lifecycle, rules, indexes and function logs; flutterfire for Flutter configuration; gcloud for IAM and infrastructure. This CLI holds no application logic: profile synchronisation, cascades and domain workflows belong in the application or an explicitly authored script.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/firebase-admin/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/rolandtolnay/llm-toolkit/firebase-admin)