firestore-rules-creation
БесплатноБез исполняемых скриптовНе проверенDesigns, authors, refactors, and hardens production-grade Cloud Firestore Security Rules (firestore.rules). IMPORTANT: If subagent delegation AND the…
от firebase★ 533 звезды на GitHubОб этом скилле
Firestore Security Rules Creation
[!IMPORTANT] Subagent Delegation vs. Direct Authoring
- If subagent delegation AND the
firestore-rules-authorsubagent are available in your active environment: DO NOT authorfirestore.rulesdirectly in the main agent. Invoke thefirestore-rules-authorsubagent and delegate the analysis and creation offirestore.rulesto it.- If subagent delegation is unavailable (e.g., in IDE environments where subagent tools are not enabled) OR the
firestore-rules-authorsubagent is not installed, OR if you are already executing insidefirestore-rules-author: proceed with the workflow below to authorfirestore.rulesdirectly.
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
Workflow
Follow this structured workflow strictly:
Phase-1: Codebase Analysis
- 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(), andlimit()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
- 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 BOTHcreateandupdaterules. - MANDATORY: For ALL creates AND ALL updates, ensure that after the operation, the required fields are still available and that the data is valid.
- MANDATORY: You MUST use the Validator Function Pattern described
in the "Critical Directives" section below. This involves defining a
specific validation function (e.g.,
- 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:
- 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]
//
// ===============================================================
- Include comprehensive helper functions to avoid repetition:
// ===============================================================
// Helper Functions
// ===============================================================
//
// Check if the user is authenticated
function isAuthentica
Установить firestore-rules-creation в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл firestore-rules-creation?
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.
Как установить скилл firestore-rules-creation?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл firestore-rules-creation запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic