OW

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.zip

Installs 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コレクションで判定するためのルール。
118 charsno explicit “when” trigger
Beginner

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

You give it
request for owner-related determination, filtering, or permission checks
You get back
correct owner determination or filtered data based on `users` collection

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を確認せずにオーナー判定ロジックを実装しない: データベース構造の変更がある可能性があるため、毎回確認する。

既存のプロバイダー(参考)

店舗用アプリで利用可能なオーナー判定プロバイダー:

  • userIsAdminOwnerProviderauth_provider.dart): users/{uid}.isOwner == true を判定
  • userIsOwnerProviderauth_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.

SkillInstallsUpdatedSafetyDifficulty
owner-check-rules (this skill)04moNo flagsBeginner
supabase-postgres-best-practices46moNo flagsIntermediate
backend-dev15moNo flagsIntermediate
supabase-enterprise-rbac110dReviewAdvanced

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.

439

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.

11

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".

10

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

00

Database Rules

taikiwt

Supabase、RLS、マイグレーション、およびデータ操作に関する絶対ルール

00

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.

00

Search skills

Search the agent skills registry