owner-check-rules
Defines strict rules for verifying owner permissions and filtering store data using users collection fields.
Install
mkdir -p .claude/skills/owner-check-rules && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/17420" && unzip -o skill.zip -d .claude/skills/owner-check-rules && rm skill.zipInstalls to .claude/skills/owner-check-rules
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
「オーナー」「オーナー判定」「オーナーの店舗」「オーナー除外」など、オーナーに関する判定・フィルタリング・権限チェックを行う際に、必ずFIRESTORE.mdでデータベース構造を確認してからusersコレクションで判定するためのルール。Key capabilities
- →Read `FIRESTORE.md` to understand database structure
- →Confirm `users` collection fields for owner determination
- →Apply correct owner determination logic based on `isOwner`, `isStoreOwner`, and `createdStores` fields
- →Filter store lists by excluding `createdStores` IDs
- →Utilize existing providers for owner determination
- →Reference Firestore rules for owner check functions
How it works
The skill ensures owner determination is based on the `users` collection by first reading `FIRESTORE.md` to understand the database structure. It then applies specific logic using `isOwner`, `isStoreOwner`, and `createdStores` fields.
Inputs & outputs
When to use owner-check-rules
- →Implement store owner access check
- →Filter store list for owners
- →Check admin owner privileges
About this skill
Owner Check Rules
概要
GrouMapにおける「オーナー」の判定は、usersコレクションのフィールドで行う。storesコレクションのisOwnerフラグは表示制御用であり、オーナー判定のソースではない。
必須手順
「オーナー」に関する実装(判定・除外・フィルタ・権限チェック等)を行う前に、以下を必ず実施する。
1. FIRESTORE.md を読み込む
FIRESTORE.mdが現在のリポジトリに存在する場合はそれを読む。- 見つからない場合は
/Users/kanekohiroki/Desktop/groumapapp/FIRESTORE.mdを読む。 - 特に
usersコレクションの以下のフィールドを確認する:isOwner: オーナー判定(全体管理権限)isStoreOwner: 店舗オーナー判定createdStores: オーナーが作成した店舗IDの配列
2. 正しいオーナー判定を適用する
| 判定内容 | 参照先 | フィールド |
|---|---|---|
| ユーザーが全体管理者か | users/{uid} | isOwner == true |
| ユーザーが店舗オーナーか | users/{uid} | isStoreOwner == true |
| ユーザーが特定店舗のオーナーか | users/{uid} | createdStores 配列に該当storeIdが含まれるか |
| オーナーの店舗を除外する | users/{uid} | createdStores 配列に含まれるstoreIdを除外 |
3. やってはいけないこと
storesコレクションのisOwnerフラグでオーナー判定しない: このフラグはユーザーアプリの表示制御用(isOwner=trueの店舗をマップ等で非表示にする)であり、オーナーの判定ソースではない。- FIRESTORE.mdを確認せずにオーナー判定ロジックを実装しない: データベース構造の変更がある可能性があるため、毎回確認する。
既存のプロバイダー(参考)
店舗用アプリで利用可能なオーナー判定プロバイダー:
userIsAdminOwnerProvider(auth_provider.dart):users/{uid}.isOwner == trueを判定userIsOwnerProvider(auth_provider.dart):users/{uid}.isStoreOwner == trueを判定
Firestoreルールでの判定関数(参考)
function isOwner() {
return request.auth != null &&
get(/databases/$(database)/documents/users/$(request.auth.uid)).data.isOwner == true;
}
function isStoreOwner(storeId) {
return request.auth != null &&
get(/databases/$(database)/documents/users/$(request.auth.uid)).data.isStoreOwner == true &&
get(/databases/$(database)/documents/users/$(request.auth.uid)).data.createdStores.hasAny([storeId]);
}
When not to use it
- →Using `stores` collection's `isOwner` flag for owner determination
- →Implementing owner determination logic without checking `FIRESTORE.md`
Limitations
- →Does not use `stores` collection's `isOwner` flag for owner determination
- →Requires checking `FIRESTORE.md` before implementing owner determination logic
- →Relies on `users` collection for all owner-related checks
How it compares
This skill enforces a specific rule for owner determination by always consulting the `users` collection and `FIRESTORE.md`, preventing reliance on unreliable UI flags in other collections like `stores`.
Compared to similar skills
owner-check-rules side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| owner-check-rules (this skill) | 0 | 4mo | No flags | Beginner |
| supabase-postgres-best-practices | 4 | 6mo | No flags | Intermediate |
| backend-dev | 1 | 5mo | No flags | Intermediate |
| supabase-enterprise-rbac | 1 | 10d | Review | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
supabase-postgres-best-practices
davila7
Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.
backend-dev
marmelab
Coding practices for backend development in Atomic CRM. Use when deciding whether backend logic is needed, or when creating/modifying database migrations, views, triggers, RLS policies, edge functions, or custom dataProvider methods that call Supabase APIs.
supabase-enterprise-rbac
jeremylongshore
Configure Supabase enterprise SSO, role-based access control, and organization management. Use when implementing SSO integration, configuring role-based permissions, or setting up organization-level controls for Supabase. Trigger with phrases like "supabase SSO", "supabase RBAC", "supabase enterprise", "supabase roles", "supabase permissions", "supabase SAML".
hiddenroom-supabase
cuvo1903-ctrl
Hidden Room Supabase backend skill for migrations, generated database types, Edge Functions, RLS policies, auth/profile sync, storage buckets, Stripe integration, cloud_jobs, and database documentation. Use when editing supabase/migrations, supabase/functions, database.types.ts, or Supabase-backed f
Database Rules
taikiwt
Supabase、RLS、マイグレーション、およびデータ操作に関する絶対ルール
inspect-database
Juan961
Workflow para inspeccionar y auditar Supabase/Postgres sin modificar datos, entendiendo esquema, relaciones, migraciones, logs y riesgos. USE FOR: diagnóstico de estructura, inventario de tablas, análisis de dependencias, revisión de seguridad y troubleshooting de consultas.