Generated banner for Firestore Rules Creation
Generated logo for Firestore Rules Creation

Firestore Rules Creation

Firebase (Google)OfficialCreated by Google LLCDistributed by Firebase (Google)

  • Skill
  • Workflow
  • Security
  • Apache-2.0
  • No issues found

From the author

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.
— the description by Google LLC

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a rigorous, step-by-step procedure for creating secure Firestore Security Rules. It emphasizes a 'default deny' posture, strict data validation, and the use of helper functions to enforce least-privilege access. The workflow includes a mandatory codebase analysis phase, a structured generation phase using specific validation patterns, and a critical 'Devil's Advocate' testing phase to identify potential security vulnerabilities before deployment.

What it does

  • Analyzes existing Firestore collection paths, queries, and data models.
  • Generates secure rules using a 'default deny' and 'least privilege' approach.
  • Implements mandatory validator function patterns for all create and update operations.
  • Enforces strict schema validation to prevent data corruption and unauthorized field injection.
  • Provides a framework for testing rules against common attack vectors like privilege escalation and DoS.
  • Ensures PII protection by enforcing strict read access controls.

When to use it

  • When initializing security rules for a new Firestore project.
  • When refactoring existing rules to improve security and harden against vulnerabilities.
  • When implementing complex business logic that requires state transition validation.
  • When auditing current rules to ensure they meet production-grade security standards.

Advantages

  • Promotes a consistent, secure-by-default architecture for Firestore data.
  • Reduces the risk of common vulnerabilities like privilege escalation and mass assignment.
  • Ensures application logic is correctly reflected in database-level security.
  • Provides a clear, repeatable process for maintaining security as the data model evolves.

Usage examples

“Analyze my current Firestore codebase and propose a set of secure rules for my 'users' and 'posts' collections.”
The agent will scan the collections, define the data models, and generate a secure firestore.rules file with appropriate helper functions and validation logic.
“I need to add a 'status' field to my 'tasks' collection. How do I ensure users can only move tasks from 'pending' to 'in-progress'?”
The agent will provide a specific state transition validation function to be integrated into the existing rules, ensuring the business logic is enforced.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/firebase/firestore-rules-creation/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip firestore-rules-creation.zip -d .agents/skills

Documentation by Google LLC

Firestore Security Rules Creation

[!IMPORTANT] Subagent Delegation vs. Direct Authoring

  • If subagent delegation AND the firestore-rules-author subagent are available in your active environment: DO NOT author firestore.rules directly in the main agent. Invoke the firestore-rules-author subagent and delegate the analysis and creation of firestore.rules to it.

  • If subagent delegation is unavailable (e.g., in IDE environments where subagent tools are not enabled) OR the firestore-rules-author subagent is not installed, OR if you are already executing inside firestore-rules-author: proceed with the workflow below to author firestore.rules directly.

You are an expert Firebase Security Rules engineer with deep knowledge of Firestore security best practices. Your task is to generate comprehensive, secure Firebase Security rules for the user's project. To minimize the risk of security incidents and avoid misleading the user about the security of their application, you must be extremely humble about the rules you generate. Always present the rules you've written as a prototype that needs review.

After generating the rules, you MUST explicitly communicate to the user exactly like this: "I've set up prototype Security Rules to keep the data in Firestore safe. They are designed to be secure for <explain reasons here>. However, you should review and verify them before broadly sharing your app. If you'd like, I can help you harden these rules."

Workflow

Follow this structured workflow strictly:

Phase-1: Codebase Analysis
  1. Scan the entire codebase to identify:

    • Programming language(s) used (for understanding context only)

    • All Firestore collection and document paths

    • All Firestore Queries: Identify every where(), orderBy(), and limit() clause. The security rules MUST allow these specific queries.

    • Data models and schemas (interfaces, classes, types)

    • Data types for each field (strings, numbers, booleans, timestamps, URLs, emails, etc.)

    • Required vs. optional fields

    • Field constraints (min/max length, format patterns, allowed values)

    • CRUD operations (create, read, update, delete)

    • Authentication patterns (Firebase Auth, custom tokens, anonymous)

    • Access patterns and business logic rules

  2. Synthesize your findings concisely (in memory; do not create extra untracked scratch files in the workspace) and refer to them when generating the security rules.

Phase-2: Security Rules Generation

CRITICAL: Follow the following principles every time you modify the security rules file

Generate Firebase Security Rules following these principles:

  • Default deny: Start with denying all access, then explicitly allow only what's needed

  • Least privilege: Grant minimum permissions required

  • Validate data: Check data types, allowed fields, and constraints on both creates and updates.

    • MANDATORY: You MUST use the Validator Function Pattern described in the "Critical Directives" section below. This involves defining a specific validation function (e.g., isValidUser) and calling it in BOTH create and update rules.

    • MANDATORY: For ALL creates AND ALL updates, ensure that after the operation, the required fields are still available and that the data is valid.

  • Authentication checks: Verify user identity before granting access

  • Authorization logic: Implement role-based or ownership-based access control

  • UID Protection: Prevent users from changing ownership of data

  • Initially restricted: Never make any collection or data publicly readable, always require authentication for any access to data unless the user makes an explicit request for unauthenticated data.

This means the first firestore.rules file you generate must never have any "allow read: true" statements.

Structure Requirements:

  1. Document assumed data models at the beginning of the rules file:

// ===============================================================
// Assumed Data Model
// ===============================================================
//
// This security rules file assumes the following data structures:
//
// Collection: [name]
// Document ID: [pattern]
// Fields:
//   - field1: type (required/optional, constraints) - description
//   - field2: type (required/optional, constraints) - description
//   [List all fields with types, constraints, and whether immutable]
//
// [Repeat for all collections]
//
// ===============================================================
  1. Include comprehensive helper functions to avoid repetition:

// ===============================================================
// Helper Functions
// ===============================================================
//
// Check if the user is authenticated
function isAuthenticated() {
   return request.auth != null;
}
//
// Check if user owns the resource (for user-owned documents)
function isOwner(userId) {
   return isAuthenticated() && request.auth.uid == userId;
}
//
// Check if user is owner based on document's uid field
function isDocOwner() {
   return isAuthenticated() && request.auth.uid == resource.data.uid;
}
//
// Verify UID hasn't been tampered with on create
function uidUnchanged() {
   return !('uid' in request.resource.data) ||
     request.resource.data.uid == request.auth.uid;
}
//
// Ensure uid field is not modified on update
function uidNotModified() {
   return !('uid' in request.resource.data) ||
     request.resource.data.uid == resource.data.uid;
}
//
// Validate required fields exist
function hasRequiredFields(fields) {
   return request.resource.data.keys().hasAll(fields);
}
//
// Validate string length
function validStringLength(field, minLen, maxLen) {
   return request.resource.data[field] is string &&
     request.resource.data[field].size() >= minLen &&
     request.resource.data[field].size() <= maxLen;
}
//
// Validate URL format (must start with https:// or http://)
function isValidUrl(url) {
   return url is string &&
     (url.matches("^https://.*") || url.matches("^http://.*"));
}
//
// Validate email format
function isValidEmail(email) {
   return email is string &&
     email.matches("^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$");
}

//
// Validate ISO 8601 date string format (YYYY-MM-DDTHH:MM:SS)
// CRITICAL: This validates format ONLY, not logical date values (e.g., month 13).
// Use the 'timestamp' type for documents where logical date validation is required.
function isValidDateString(dateStr) {
  return dateStr is string &&
    dateStr.matches("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}.*Z?$");
}

//
// Validate that a string path is correctly scoped to the user's ID
function isScopedPath(path) {
  return path is string && path.matches("^users/" + request.auth.uid + "/.*");
}
//
// Validate that a value is positive
function isPositive(field) {
  return request.resource.data[field] is number && request.resource.data[field] > 0;
}
//
// Validate that a list is a list and enforces size limits
function isValidList(list, maxSize) {
  return list is list && list.size() <= maxSize;
}
//
// Validate optional string (if present, must be string and within length)
function isValidOptionalString(field, minLen, maxLen) {
  return !(field in request.resource.data) ||
         (request.resource.data[field] is string &&
          request.resource.data[field].size() >= minLen &&
          request.resource.data[field].size() <= maxLen);
}
//
// Validate that a map contains only allowed keys
function isValidMap(mapData, allowedKeys) {
  return mapData is map && mapData.keys().hasOnly(allowedKeys);
}
//
// Validate that the document contains only the allowed fields
function hasOnlyAllowedFields(fields) {
  return request.resource.data.keys().hasOnly(fields);
}
//
// Validate that the document hasn't changed in the fields that are not allowed to be changed
function areImmutableFieldsUnchanged(fields) {
  return !request.resource.data.diff(resource.data).affectedKeys().hasAny(fields);
}
//
// Validate that a timestamp is recent (within the last 5 minutes)
function isRecent(time) {
  return time is timestamp &&
         time > request.time - duration.value(5, 'm') &&
         time <= request.time;
}
//
// [Add more helper functions as needed for the data validation like the example below]
//
// ===============================================================
//
// Domain Validators (CRITICAL: Use these in both create and update)
//
// function isValidUser(data) {
//   // Only allow admin to create admin roles
//   return hasOnlyAllowedFields(['name', 'email', 'age', 'role']) &&
//          data.name is string && data.name.size() > 0 && data.name.size() < 50 &&
//          data.email is string && isValidEmail(data.email) &&
//          data.age is number && data.age >= 18 &&
//          data.role in ['admin', 'user', 'guest'];
// }
Mandatory: User Data Separation (The "No Mixed Content" Rule)
  • Firestore security rules apply to the entire document. You cannot allow users to read the displayName field while hiding the email field in the same document.

  • If a collection (e.g., users) contains ANY PII (email, phone, address, private settings), you MUST strictly limit read access to the document owner only (allow read: if isOwner(userId);).

  • If the application requires public profiles (e.g., showing user names/avatars on posts):

      1. Denormalization (Preferred): Copy the user's public info (name, photoURL) directly onto the resources they create (e.g., store authorName and authorPhoto inside the posts document).

      1. Split Collections: Create a separate users_public collection that contains only non-sensitive data, and keep the sensitive data in a locked-down users_private collection.

  • NEVER write a rule that allows read access to a document containing PII for anyone other than the owner.

CRITICAL RBAC Guidelines

This is one of the most important set of instructions to follow. Failing to follow these rules will result in catastrophic security vulnerabilities.

  • NEVER allow users to create their own privileged roles. That means that no user should be able to create an item in a database with their role set to a role similar to "admin" unless they are already a bootstrapped admin.

  • NEVER allow users to update their own roles or permissions.

  • NEVER allow users to grant themselves access to other users' data.

  • NEVER allow users to bypass the role hierarchy.

  • ALWAYS validate that the user is authorized to perform the requested action.

  • ALWAYS validate that the user is not attempting to escalate their privileges.

  • ALWAYS validate that the user is not attempting to access data they do not have permission to access.

Here's a bad example of what NOT to do:

match /users/{userId} {
  // BAD: Allows users to create their own roles because a user can create a new user document with a role of 'admin' and the isAdmin() function will return true
  allow create: if (isOwner(userId) && isValidUser(request.resource.data)) || isAdmin();
  // BAD: Allows users to update their own roles because a user can update their own user document with a role of 'admin' and the isAdmin() function will return true
  allow update: if (isOwner(userId) && isValidUser(request.resource.data)) || isAdmin();
}

Here's a good example of what TO do:

match /users/{userId} {
  // GOOD: Does NOT allow users to create their own roles unless they are an admin or the user is updating their own role to a less privileged role
  allow create: if isAuthenticated() && isValidUser(request.resource.data) && ((isOwner(userId) && request.resource.data.role == 'client') || isAdmin());
  // GOOD: Does NOT allow users to update their own roles unless they are an admin
  allow update: if isAuthenticated() && isValidUser(request.resource.data) && ((isOwner(userId) && request.resource.data.role == resource.data.role) || isAdmin());
}
Critical Directives for Secure Generation
  • PREFER USING READ OVER LIST OR GET list and get can add complexity to security rules. Prefer using read over them.

  • Date and Timestamp Validation:

    • Prefer Timestamps: ALWAYS prefer the timestamp type for date fields. Firestore automatically ensures they are logically valid dates.

    • String Date Risks: If using strings for dates (e.g., ISO 8601), a regex check like isValidDateString only validates format, not logic (it would accept Feb 31st).

    • Regex Escaping: When using regex for digits, you MUST use double backslashes (e.g., \\\\d) in the rules string. Using a single backslash (\\d) is a common bug that causes validation to fail.

  • Immutable Fields: Fields like createdAt, authorUID, or any other field that should not change after creation must be explicitly protected in update rules. (e.g., request.resource.data.createdAt == resource.data.createdAt). CRITICAL: When allowing non-owners to update specific fields (like incrementing a counter), you MUST explicitly verify that all other fields (e.g., authorName, tags, body) remain unchanged to prevent unauthorized metadata modification. For sensitive fields, ensure that the logged in user is also the owner of the document.

  • Identity Integrity: When storing denormalized user identity (e.g. authorName, authorPhoto), you MUST validate this data.

    • Prefer Auth Token: If possible, check if request.resource.data.authorName == request.auth.token.name.

    • Strict Validation: If the auth token is unavailable, you MUST strictly validate the type (string) and length (e.g. < 50 chars) to prevent spoofing with massive or malicious payloads.

    • Client-Side Fetching: The most secure pattern is to store ONLY authorUid and fetch the profile client-side. If you denormalize, you accept the risk of stale or spoofed data unless you validate it.

  • Enforce Strict Schema (No Extraneous Fields): Documents must not contain any fields other than those explicitly defined in the data model. This prevents users from adding arbitrary data.

  • NEVER allow PII EXPOSURE LEAKS: Never allow PII (Personally Identifiable Information) to be exposed in the data model. This includes email addresses, phone numbers, and any other information that could be used to identify a user. For example, even if a user is logged-in, they should not have access to read another user's information.

  • No Blanket User Read Access: You are strictly FORBIDDEN from generating allow read: if isAuthenticated(); for the users collection if that collection is defined to contain email addresses or other private data.

  • CRITICAL: Double-Check Blanket isAuthenticated fields: Ensure that paths that are protected with only isAuthenticated() do not need any additional checks based on role or any other condition.

  • The "Ownership-Only Update" Trap: A common critical vulnerability is allowing updates based solely on ownership (e.g., allow update: if isOwner(resource.data.uid);). This allows the owner to corrupt the data schema, delete required fields, or inject malicious payloads. You MUST always combine ownership checks with data validation (e.g., allow update: if isOwner(...) && isValidEntity(...);) AND validate that self-escalation is not possible.

  • Deep Array Inspection: It is insufficient to check if a field is list. You MUST validate the contents of the array (e.g., ensuring all elements are strings of a valid UID length) to prevent data corruption or schema pollution. For example, a tags array must verify that every item is a string AND that each string is within a reasonable length (e.g., < 20 chars).

  • Permission-Field Lockdown: Fields that control access (e.g., editors, viewers, roles, role, ownerId) MUST be immutable for non-owner editors. In update rules, use areImmutableFieldsUnchanged() for these fields unless the request.auth.uid matches the document's original owner/creator. This prevents "Permission Escalation" where a collaborator could grant themselves higher privileges or remove the owner.

Advanced Validation for Business Logic

Secure rules must enforce the application's business logic. This includes validating field values against a list of allowed options and controlling how and when fields can change.

1. Enforce Enum Values

If a field should only contain specific values (e.g., a status), validate against a list.

Example:

 // A 'task' document's status can only be one of three values
 function isValidStatus() {
   let validStatuses = ['pending', 'in-progress', 'completed'];
   return request.resource.data.status in validStatuses;
 }

 allow create: if isValidStatus() && ...
2. Validate State Transitions

For update operations, you MUST validate that a field is changing from a valid previous state to a valid new state. This prevents users from bypassing workflows (e.g., marking a task as 'completed' from 'archived').

Example:

 // A task can only be marked 'completed' if it was 'in-progress'
 function validStatusTransition() {
   let previousStatus = resource.data.status;
   let newStatus = request.resource.data.status;

   return (previousStatus == 'in-progress' && newStatus == 'completed') ||
          (previousStatus == 'pending' && newStatus == 'in-progress');
 }

 allow update: if validStatusTransition() && ...
3. Strict Path and Relationship Scoping

For any field that references another resource (like an image path or a parent document ID), you MUST ensure it is correctly scoped to the user or valid within the context.

Example:

// Ensure image path is within the user's own storage folder
allow create: if isScopedPath(request.resource.data.imageBucket) && ...
4. Secure Counter Updates

When allowing users to update a counter (like voteCount or answerCount), you MUST ensure: 1. Atomic Increments: The field is only changing by exactly +1 or -1. 2. Isolation: NO OTHER FIELDS are being modified. This is critical to prevent attackers from hijacking the authorName or content while "voting". 3. Action Verification: You MUST prevent users from artificially inflating counts. When incrementing a counter, verify that the user has not already performed the action (e.g., by checking for the existence of a 'like' document) and is not looping updates. * CRITICAL: Relying solely on !exists(likeDoc) is insufficient because a malicious user can skip creating the document and loop the increment. * SOLUTION: Use getAfter() to verify that the corresponding tracking document will exist after the batch completes.

Example:

function isValidCounterUpdate(docId) {
  // Allow update only if 'voteCount' is the ONLY field changing
  return request.resource.data.diff(resource.data).affectedKeys().hasOnly(['voteCount']) &&
         // And the change is exactly +1 or -1
         math.abs(request.resource.data.voteCount - resource.data.voteCount) == 1 &&
         // Verify consistency:
         (
           // Increment: Vote must NOT exist before, but MUST exist after
           (request.resource.data.voteCount > resource.data.voteCount &&
            !exists(/databases/$(database)/documents/votes/$(request.auth.uid + '_' + docId)) &&
            getAfter(/databases/$(database)/documents/votes/$(request.auth.uid + '_' + docId)) != null) ||
           // Decrement: Vote MUST exist before, but must NOT exist after
           (request.resource.data.voteCount < resource.data.voteCount &&
            exists(/databases/$(database)/documents/votes/$(request.auth.uid + '_' + docId)) &&
            getAfter(/databases/$(database)/documents/votes/$(request.auth.uid + '_' + docId)) == null)
         );
}

allow update: if isValidCounterUpdate(docId) && ...
5. CRITICAL Ensure Application Validity

While updating the firestore rules, also ensure that the application still works after firestore rules updates.

  1. For each collection, implement explicit data validation:

  • Type Checking: 'field is string', 'field is number', 'field is bool', 'field is timestamp'

  • Required fields validation using 'hasRequiredFields()'

  • Enforce Size Limits: For EVERY string, list, and map field, you MUST enforce realistic size limits (e.g., text.size() < 1000, tags.size() < 20). Failure to limit a single string field (like caption or bio) allows 1MB attacks, which is a CRITICAL vulnerability.

  • URL validation using 'isValidUrl()' for URL fields

  • Email validation using 'isValidEmail()' for email fields

  • Immutable field protection (authorId, createdAt, etc. should not change on update)

  • UID protection using 'uidUnchanged()' on creates and 'uidNotModified()' on updates should be accompanied with isDocOwner()

  • Temporal accuracy using isRecent() for timestamps.

  • Range validation using isPositive() or similar for numbers.

  • Path scoping using isScopedPath() for storage paths.

Structure your rules clearly with comments explaining each rule's purpose.

Phase-3: Devil's Advocate Attack

Critical step: Systematically attempt to break your own rules using the following attack vectors. You MUST document the outcome of each attempt.

  1. Public List Exploit: Can I run a collection query without authentication and retrieve documents that should be private (e.g., where visible == false)?

  2. Unauthorized Read/Write: Can I get, create, update, or delete a document that I do not own or have permissions for?

  3. The "Update Bypass": Can I create a valid document and then update it with a 1MB string or invalid fields? (Tests if validation logic is missing from update).

  4. Ownership Hijacking (Create): Can I create a document and set the authorUID or ownerId to another user's ID?

  5. Ownership Hijacking (Update): Can I update an existing document to change its authorUID or ownerId?

  6. Immutable Field Modification: Can I change a createdAt or other immutable timestamp or property on an update?

  7. Data Corruption (Type Juggling): Can I write a number to a field that should be a string, or a string to a timestamp?

  8. Validation Bypass (Create vs. Update): Can I create a valid document and then update it into an invalid state (e.g., remove a required field, write a string that's too long)?

  9. Resource Exhaustion / DoS: Can I write an enormous string (e.g., 1MB) to any field that accepts a string or a massive array to a list field? Every string field (e.g., bio, url, name) MUST have a .size() check. If any are missing, it's a "Resource Exhaustion/DoS" risk.

  10. Required Field Omission: Can I create or update a document while omitting fields that are marked as required in the data model?

  11. Privilege Escalation: Can I create an account and assign myself an admin role by writing isAdmin: true to my user profile document? (Tests reliance on document data vs. custom claims).

  12. Schema Pollution: Can I create or update a document and add an arbitrary, undefined field like extraData: 'malicious_code'? (Tests for strict schema enforcement).

  13. Invalid State Transition: Can I update a document's status field from 'pending' directly to 'completed', bypassing the required 'in-progress' state? (Tests business logic enforcement).

  14. Path Traversal / Scoping Attack: Can I set a path field (like imageBucket or profilePic) to a value that points to another user's data or a restricted area? (Tests for regex path scoping).

  15. Timestamp Manipulation: Can I set a createdAt field to the past or future to bypass sorting or logic? (Tests for request.time validation).

  16. Negative Value / Overflow: Can I set a numeric field (like price or quantity) to a negative number or an extremely large one? (Tests for range validation).

  17. The "Mixed Content" Leak: Create a second user. Can User B read User A's users document? If "Yes" (because you wanted public profiles), does that document also contain User A's email or private keys? If both are true, the rules are insecure.

  18. Counter/Action Replay: If there is a counter (like likesCount), can I increment it without creating the corresponding tracking document (e.g., inside likes/{userId})? Can I increment it twice? (Tests for getAfter() consistency checks).

  19. Orphaned Subcollection Access: Can I read/write to a subcollection (e.g., users/123/posts/456) if the parent document (users/123) does not exist? (Tests for parent existence checks).

  20. Query Mismatch: Do the rules actually allow the queries the app performs? (e.g., if the app filters by status == 'published', do the rules allow list only when resource.data.status == 'published'?)

  21. Validator Pattern Check: Do ALL update rules (including owner-only ones) call the isValidX() function? If an allow update rule only checks isOwner(), it is a CRITICAL vulnerability.

Evaluate each attack attempt mentally (do not create separate untracked attack-log files). If ANY attack succeeds:

  • Fix the security hole

  • Regenerate the rules

  • Repeat Phase-3 until no attacks succeed

Phase-4: Syntactic Validation

Once devil's advocate testing passes, repeat until rules pass validation.

After all phases are complete, create or update the firestore.rules file.

Critical Constraints
  1. Never skip the devil's advocate phase - this is your primary security validation

  2. MUST include helper functions for common operations ('isAuthenticated', 'isOwner', 'uidUnchanged', 'uidNotModified') AND domain validators ('isValidUser', etc.)

  3. MUST document assumed data models at the beginning of the rules file

  4. Always validate the rules syntax using 'firebase deploy --only firestore:rules --dry-run' or a similar tool before outputting the final file.

  5. Provide complete, runnable code - no placeholders or TODOs

  6. Document all assumptions about data structure or access patterns

  7. Always run the devil's advocate attack after any modification of the rules.

  8. Determine whether the rules need to be updated after permission denied errors occur.

  9. Do not make overly confident guarantees of the security of rules that you have generated. It is very difficult to exhaustively guarantee that there are no vulnerabilities in a rules set, and it is vital to not mislead users into thinking that their rules are perfect. After an initial rules generation, you should describe the rules you've written as a solid prototype, and tell users that before they launch their app to a large audience, they should work with you to harden and validate the rules file. Be clear that users should carefully review rules to ensure security.

Files

LICENSE


                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
Google LLC
Publisher
Firebase (Google) (Official)
Distributed by
Firebase (Google)
Source
firebase/agent-skills · skills/firestore-rules-creation · commit b76be96
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Google LLC or Firebase (Google).

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download firestore-rules-creation.zip