firestore-rules-creation skill: have your agent write and attack-test Firestore security rules
Makes your coding agent read your app, write Firestore security rules for it, and try to break them before it saves the file.
- Installs
- 28.7K
- on skills.sh
- Stars
- 497
- on GitHub
- Updated
- Oct 2026
- last repo commit
firestore-rules-creation is a skill from the Firebase team (author listed as Google LLC). Your agent scans your code for collections, queries and data models, writes a default-deny firestore.rules file with validator functions, then runs a list of 21 attack checks on its own rules and fixes what breaks.
It tells the agent to call the rules a prototype and to say so in a fixed sentence to you. SKILL.md also tells it to check syntax with firebase deploy --only firestore:rules --dry-run or a similar tool, so you need the Firebase CLI for that step. If a firestore-rules-author subagent is installed, the skill hands the work to it.
Good for
- Developers adding Firestore to an app who want a first draft of security rules
- Teams reviewing existing rules for open reads and privilege escalation
- Solo builders who do not write rules often and want checks built in
Install firestore-rules-creation
Claude Code
- 1
Copy this prompt.
Install the firestore-rules-creation skill in Claude Code. Run this command: npx skills add https://github.com/firebase/agent-skills --skill firestore-rules-creation Then check that it loaded and tell me how to use it.
- 2
Paste it into Claude Code. It shows the change and asks before running it.
Requires Node.js.
From its listing on skills.sh. Source.
What's in the skill
When it loads
Designs, authors, refactors, and hardens production-grade Cloud Firestore Security Rules (firestore.rules). IMPORTANT: If subagent delegation AND the firestore-rules-author subagent are available in your environment, delegate authoring firestore.rules to the firestore-rules-author subagent. If subagent delegation is unavailable (e.g. not enabled in the IDE), firestore-rules-author is not installed, or you are running inside firestore-rules-author, follow this skill directly.
Sections in SKILL.md
- Workflow
- Advanced Validation for Business Logic
- Critical Constraints
Key facts
- Installs on skills.sh
- 28,650 (data from 2026-11-02)
- License
- Apache-2.0
- Last repo commit
- 2026-10-30
- What is inside
- 1 file: SKILL.md only, no scripts
What it includes
Delegates to firestore-rules-author when that subagent is available
If subagent delegation and the firestore-rules-author subagent both exist, the skill tells the agent not to write the rules itself. Otherwise the agent follows the workflow directly.
Read ·
Subagent hand-offScans your code for collections, queries, data models and auth
Collects every Firestore path, every where, orderBy and limit clause, field types, constraints and CRUD operations. The rules must allow the queries your app really runs.
Try: “Read this codebase and write Firestore security rules for it.”
Files ·
Phase 1: codebase analysisDefault deny, validator functions, no public reads on first draft
Starts from deny-all and adds helper functions such as isAuthenticated and isOwner. Every create and update must call a validator, and the first file must contain no allow read: true.
Write ·
Phase 2: rules generationKeeps personal data out of readable profile documents
Documents with email or phone can be read only by their owner. For public profiles the skill asks for denormalized public fields or a separate public collection.
Write ·
User data separationBlocks users from creating or raising their own roles
Rules must stop self-assigned admin roles and role changes. The skill gives a bad and a good example.
Write ·
Role guidelinesEnums, state transitions, path scoping, safe counters
Covers allowed values, legal status changes, scoped paths and counter updates verified with getAfter().
Write ·
Business-logic checks21 attack checks run on the agent's own rules
The agent tries things like ownership hijacking, schema pollution, 1MB strings and mixed-content leaks, then fixes the rules and repeats until no attack works.
Read ·
Phase 3: devil's advocateChecks rules with firebase deploy --only firestore:rules --dry-run
SKILL.md says to validate with that command or a similar tool before the final file is output. Then the agent creates or updates firestore.rules.
Runs code ·
Phase 4: syntax validation
From the official docs
Permissions
Low risk
The rules it writes decide who can read and change your Firestore data, so a gap could expose user data. Treat the output as a draft and review it before you deploy.
What it can do
- Read your data
- Create and change things
- Delete things
- Read-only mode
Watch out for
Generated rules are a first draft
SKILL.md tells the agent to call them a prototype and to tell users to review and harden them before launching to a large audience. A rule gap can expose user data.
It writes your security rules file
The skill creates or overwrites firestore.rules. Use a git branch and read the diff before you deploy anything.
It asks for a Firebase CLI command
The syntax check uses firebase deploy with --dry-run, or a similar tool. Check which project the CLI points at before approving it.
The subagent definition can run commands
agents/firestore-rules-author.md in the repo lists run_command among its tools and sets commandExecutionPolicy: auto. The skills CLI route installs the skill; check whether your install route also adds this subagent. github.com
Plugin routes add a Firebase MCP server
The README plugin routes install more than this skill. The repo .mcp.json registers an MCP server that runs npx -y firebase-tools@15.32.1 mcp. github.com
Technical details
| Talks to | Firebase CLI command for the dry-run check |
|---|---|
| Scopes |
|
Questions
What does the firestore-rules-creation skill do?
It makes your agent write Firestore security rules from your code and then try to break them. The output is a firestore.rules file with documented data models, helper functions and validators.
How do I install it in Claude Code?
Use the install box at the top of this page. The Firebase README also documents a Claude plugin, a Codex plugin, a Gemini CLI extension and a Kimi plugin that install the whole Firebase set, not only this skill. The repo's .mcp.json registers a Firebase MCP server that runs npx -y firebase-tools@15.32.1 mcp, so check what a plugin route adds before you use it.
Are the rules it writes safe to ship?
Not without review. SKILL.md tells the agent to present the rules as a prototype, to say so in a fixed sentence, and not to give overly confident guarantees. It says users should review the rules and work with the agent to harden and validate them before launching to a large audience.
Does it need an API key or the Firebase CLI?
SKILL.md names no API key. The syntax check it asks for uses firebase deploy --only firestore:rules --dry-run or a similar tool, so the Firebase CLI needs to be available to your agent.
Is it safe?
It writes a rules file in your project and may run a Firebase CLI command, so read the file and the command before you approve them. Deploy only after you have reviewed the rules yourself.
What is the firestore-rules-author subagent?
A separate subagent the skill names. If it and subagent delegation are available, the skill tells the main agent to hand the rules work to it. If not, the main agent follows the skill's workflow itself. The repo keeps its definition in agents/firestore-rules-author.md.
Does it check my existing rules?
The skill is written for creating, refactoring and hardening rules, as its description says. Its attack checks run on whatever rules the agent produces, so ask it to harden your current firestore.rules file.
Information
updated Nov 2, 2026
- Repository
- firebase/agent-skills
- Folder
skills/firestore-rules-creation
Sources
Docs, issue trackers and discussions this page is built from.
Show all 4Hide
- firestore-rules-creation SKILL.md · github.com
- firebase/agent-skills .mcp.json · github.com
- firestore-rules-author agent · github.com
- firebase/agent-skills README · github.com